|
Page 1 of 1
|
[ 7 posts ] |
|
Robot Randomness at scrimmage?
| Author |
Message |
|
arkarind
Rookie
Joined: Mon Nov 03, 2008 1:11 am Posts: 5
|
 Robot Randomness at scrimmage?
Ok so Im a member of team 2869, and we went to the scrimmage at oregon city on january 31st. Sometimes in a round, when the FMS was starting the driver control mode.. our robot became unresponsive when we were running our teleop program. it didnt move any of its motors. It also happened sometimes when we were running our teleop program via our own laptop. ANy one knows what the problem is?
_________________ I am a Member of FTC team Flaming Cup noodles, team # 2869.
|
| Sun Feb 01, 2009 4:18 pm |
|
 |
|
BHHSrobotics
Rookie
Joined: Wed Jan 21, 2009 1:40 pm Posts: 14 Location: Brookings OR
|
 Re: Robot Randomness at scrimmage?
We also had problems at that scrimmage with the FMS. All of our motors were reversed and our servos didn't move to the correct position while using FMS, but when using our own computer our bot worked just fine. Please inform us if you find a solution. heres our code, maybe its the problem.  |  |  |  | Code: #pragma config(Hubs, S1, HTMotor, HTServo, HTMotor, none) #pragma config(Motor, motorA, Motor1, tmotorNormal, PIDControl) #pragma config(Motor, motorB, Motor2, tmotorNormal, PIDControl) #pragma config(Motor, motorC, Motor3, tmotorNormal, PIDControl) #pragma config(Motor, mtr_S1_C1_1, MotorD, tmotorNormal, PIDControl, reversed) #pragma config(Motor, mtr_S1_C1_2, MotorE, tmotorNormal, PIDControl) #pragma config(Motor, mtr_S1_C3_1, MotorF, tmotorNormal, openLoop, reversed) #pragma config(Motor, mtr_S1_C3_2, MotorG, tmotorNormal, openLoop) #pragma config(Servo, servo1, ServoC, tServoNormal) #pragma config(Servo, servo2, ServoD, tServoNormal) #pragma config(Servo, servo5, ServoA, tServoNormal) #pragma config(Servo, servo6, ServoB, tServoNormal) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
///////////////////////////////////////////////////////////////////////////////////////////////////// // // Tele-Operation Mode Code Template // // This file contains a template for simplified creation of an tele-op program for an FTC // competition. // // You need to customize two functions with code unique to your specific robot. // /////////////////////////////////////////////////////////////////////////////////////////////////////
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
///////////////////////////////////////////////////////////////////////////////////////////////////// // // initializeRobot // // Prior to the start of tele-op mode, you may want to perform some initialization on your robot // and the variables within your program. // // In most cases, you may not have to add any code to this function and it will remain "empty". // /////////////////////////////////////////////////////////////////////////////////////////////////////
void initializeRobot() { // Place code here to sinitialize servos to starting positions. // Sensors are automatically configured and setup by ROBOTC. They may need a brief time to stabilize.
return; }
///////////////////////////////////////////////////////////////////////////////////////////////////// // // Main Task // // The following is the main code for the tele-op robot operation. Customize as appropriate for // your specific robot. // // Game controller / joystick information is sent periodically (about every 50 milliseconds) from // the FMS (Field Management System) to the robot. Most tele-op programs will follow the following // logic: // 1. Loop forever repeating the following actions: // 2. Get the latest game controller / joystick settings that have been received from the PC. // 3. Perform appropriate actions based on the joystick + buttons settings. This is usually a // simple action: // * Joystick values are usually directly translated into power levels for a motor or // position of a servo. // * Buttons are usually used to start/stop a motor or cause a servo to move to a specific // position. // 4. Repeat the loop. // // Your program needs to continuously loop because you need to continuously respond to changes in // the game controller settings. // // At the end of the tele-op period, the FMS will autonmatically abort (stop) execution of the program. // /////////////////////////////////////////////////////////////////////////////////////////////////////
task main() { initializeRobot();
waitForStart(); // wait for start of tele-op phase
while (true) {
{ while (true) { getJoystickSettings(joystick); motor[MotorG] = joystick.joy2_y1; motor[MotorF] = joystick.joy2_y2;
nMotorEncoder[MotorD] = 0; nMotorEncoder[MotorE] = 0;
if(joy1Btn(1)) { while(nMotorEncoder[MotorD] < 100 || nMotorEncoder[MotorE] < 100) { motor[MotorD] = 25; motor[MotorE] = 25; }
motor[MotorD] = 0; motor[MotorE] = 0; wait1Msec(1000);
} else { motor[MotorD] = 0; motor[MotorE] = 0; } if(joy1Btn(2)) { nMotorEncoderTarget[MotorD] = 100; nMotorEncoderTarget[MotorE] = 100;
motor[MotorD] = -75; motor[MotorE] = -75;
while(nMotorRunState[MotorD] != runStateIdle || nMotorRunState[MotorE] != runStateIdle) {
} }
else { motor[MotorD] = 0; motor[MotorE] = 0; }
if(joy2Btn(2)) { motor[Motor1] = -100; motor[Motor2] = -100; motor[Motor3] = -100;
} else { motor[Motor1] = 0; motor[Motor2] = 0; motor[Motor3] = 0; }
if(joy2Btn(1)) { motor[Motor1] = 100; motor[Motor2] = 100; motor[Motor3] = 100;
} else { motor[Motor1] = 0; motor[Motor2] = 0; motor[Motor3] = 0; } if(joy1Btn(5)) { servoTarget[ServoA] = 220; servoTarget[ServoB] = 80; } else { servoTarget[ServoA] = 20; servoTarget[ServoB] = 220; } if(joy2Btn(3)) { servoTarget[ServoC] = 100; servoTarget[ServoD] = 175; } else { servoTarget[ServoC] = 275; servoTarget[ServoD] = 0; } } }
} }
|  |  |  |  |
|
| Mon Feb 02, 2009 2:36 pm |
|
 |
|
Sunny1261
Novice
Joined: Thu Oct 09, 2008 7:58 pm Posts: 79
|
 Re: Robot Randomness at scrimmage?
BHHS, If that is indeed your code, then your robot was being controlled by JFM because it never would have left the first, empty, forever loop.
|
| Mon Feb 02, 2009 6:02 pm |
|
 |
|
chadgeorge
Novice
Joined: Fri Oct 24, 2008 8:58 am Posts: 87
|
 Re: Robot Randomness at scrimmage?
@Sunny: the down side to asking people to post code is you have to be able to read it  (J/K) its two doubly nested while loops, not an empty while loop @BHHS: while Sunny's comment probably isn't the reason the code doesn't work...why do you have two nested while loops? Also you have most of the code in a block?!? Probably this was to get rid of a compiler error, but its definitely not needed looking at the dissasembly of your posted source...it looks like the compiler optimizes it away anyhow. Onto the real question: I can't see anything wrong with the code... all I can think of is... Is it possible that you use other joysticks on your laptop that have changed things in windows? Did you run the windows calibration routine under ControlPanel/Game Controllers? Did you try another PC running the FMS software FIRST provided? Did you try another PC running RobotC? Were you certain you had the right "player 1" vs "player 2"? (probably doesn't fit the symptoms but its worth asking) Was the analog light "on" for the driver's joystick (this swaps the hat and the left analog stick) could make the driver think it was more wrong than it really was? Sorry for not having a real fix, maybe this will get you in the right direction.
|
| Mon Feb 02, 2009 9:55 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
 Re: Robot Randomness at scrimmage?
You should download a copy of the FMS and test your code against it.
I'd also recommend getting rid of that first "while(true)" loop... just for posterity sake.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Tue Feb 03, 2009 10:53 am |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Robot Randomness at scrimmage?
At first glance I would suspect that you were having bluetooth connectivity issues. Since you were having the problem with and without the FMS I suggest reloading the firmware on the NXT or trying a different NXT if you can borrow one. ORTOP will certainly loan you an NXT to test with if you ask them.
_________________ Jeff McBride Benson Robotics Club
|
| Tue Feb 03, 2009 11:55 am |
|
 |
|
Sunny1261
Novice
Joined: Thu Oct 09, 2008 7:58 pm Posts: 79
|
 Re: Robot Randomness at scrimmage?
Sorry bout that.
|
| Tue Feb 03, 2009 8:04 pm |
|
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 3 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|