|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Robot seems to be Disabled when using Jaguars
ok, I am writing my first basic program for the robot. I know the robot is in functioning order because i can load and run the Simple Template and that works. Unfortunatly when I run my program, nothing happens. I know that values are being read in from the joystick because I have some printfs and the console. Here is the weird thing, even while the robot is enabled, the signal light continues to blink like its in disabled mode. When I use the Simple Template, the light works correctly.
Here is the relevant code: Code:
class Robot : public IterativeRobot
{
Jaguar *leftDrive;
Jaguar *rightDrive;
Joystick *stick;
public:
void RobotInit(void)
{
printf("RobotInit:\n");
leftDrive = new Jaguar(4, 1);
rightDrive = new Jaguar(4, 2);
GetWatchdog().SetExpiration(0.1);
}
void TeleopPeriodic()
{
printf("TeleopPeriodic:\n");
drive();
}
void drive()
{
float joyX = stick->GetX();
float joyY = stick->GetY();
float leftPower;
float rightPower;
printf("joyX: %f\n", joyX);
printf("joyY: %f\n", joyY);
rightPower = joyY;
leftPower = joyY;
printf("rightPower: %f\n", rightPower);
printf("leftPower: %f\n", leftPower);
rightDrive->Set(rightPower);
leftDrive->Set(leftPower);
printf("rightDrive: %f\n", rightDrive->Get());
printf("leftDrive: %f\n", leftDrive->Get());
}
};
START_ROBOT_CLASS(Robot);
Code:
TeleopPeriodic: joyX: 0.000000 joyY: -0.476563 rightPower: -0.476563 leftPower: -0.476563 rightDrive: -0.476563 leftDrive: -0.476563 Thxe |
|
#2
|
|||
|
|||
|
Re: Robot seems to be Disabled when using Jaguars
Ok, I found the problem myself. I wasn't feeding the watch dog! It should be noted that the watch dog does not stop your code from executing, it only prevents commands to motors and such from going through, with no error messages at all! So if you see your signal light doing the disabled blink while your robot is enabled, it may be because the watch dog timed out.
Thxe |
|
#3
|
||||
|
||||
|
Re: Robot seems to be Disabled when using Jaguars
It looks like this is because the watchdog is not being fed, so the motor outputs are disabled. Add in GetWatchdog().Feed() to your teleop function and it should work.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Disabled Robot Scoring? | DM7000 | Rules/Strategy | 15 | 01-09-2009 09:50 PM |
| Question: Can robot block lower goals to prevent scoring? Seems unfair. | 456RoboChick | Rules/Strategy | 1 | 01-11-2006 08:04 PM |
| using SCORBOT for disabled people | kandyuee | Robotics Education and Curriculum | 2 | 04-16-2004 07:31 AM |