![]() |
Method of Programming Drive
So in my programming past, I have always used the method for programming the Drive motors like in the SimpleTemplate.out (below);
Code:
RobotDrive myRobot;Code:
myRobotThanks, Davis |
Re: Method of Programming Drive
Do you mean when you don't feed the watchdogs? If it is, then there's either something holding up your main loop that will stop feeding the motors. Or it's not running a motor that would cause the watchdog to disable your robot.
Can you show the code for your drive train? |
Re: Method of Programming Drive
I don't remember the specific message the DS gives, but what is typically happening is you aren't calling any of the myRobot.Drive routines OFTEN enough.
It doesn't really matter how you initialize your drive system, but there are lots of methods for doing so. If you look at the robot drive header file (try control clicking "RobotDrive" in windriver), all of the functions labeled RobotDrive() are the different constructors you can use. Here is how I've constructed my drive system, which isn't the same as the normal template way: Code:
Robot2012(void):It is possible that some of the alternate constructors for RobotDrive such as mine don't turn on the motor safety of the jaguars that were passed to them at construction; because in my method, I first create the jaguars, which by default don't enable motor safety, then I pass them into the RobotDrive constructor by reference, at this point it depends on the robot drive code whether or not it enables the motor safety on the jags it is passed or if it abstains from modifying their safety settings, and this could be different for each constructor. However, in order to fix this error message the correct way, you will want to modify your code so that there is always somebody controlling the motors. For example, if you use any wait statements in your code you would replace them with timed while loop statements or structured if else statements: (I prefer the latter, as timed while loops make me queezy :)) Code:
if (autonomousStateTimer.Get() > AUTONOMOUS_BACKUP_TIME)If you don't 'feed' the watchdog periodically, the RobotDrive will assume that there is nobody in control of the robot and stop the wheels. The reason this is done is for safety; imagine your laptop gets hit by a meteor while the driver has the joysticks going forward full speed, the robot doesn't know anything has happened and continues driving forward at full throttle; however the motor safety watchdog knows it needs to get new speeds set every .5sec, when the robot stops getting new joystick values, it will automatically stop after 0.5 seconds. |
| All times are GMT -5. The time now is 17:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi