![]() |
IsAutonomous() function
When i'm trying to run this code the program it's working:
Code:
#include <iostream.h>Code:
#include <iostream.h> |
Re: IsAutonomous() function
My first guess would be that "IsAutonomous()" asks the robot if it is still in the autonomous status. Can you tell me what the status of the driver station is? If you are even connected?
I'll get back to you, after double checking the WPILib documentation. But it might be a little bit, so here is my advice. Figure out what IsAutonomous() does. My guess is that it looks at the driver station and if it driver station is enabled and in autonomous mode, then the IsAutonomous() will continue and if the driver station is not in autnomous then IsAutonomous() breaks the loop in which it is called. Check the WPILib documentation, there should be something about IsAutonomous() in there. Good Luck, Sravan |
Re: IsAutonomous() function
I think that this is because calling IsAutonomous() on every pass through the continuous code causes the print buffer to be flushed.
Try calling the function "fflush()" (no arguments) after your printf() statement without calling IsAutonomous(). As an aside, you probably won't want to print in the XXXContinuous() functions. It will go so fast you won't be able to read it. The XXXPeriodic() functions might be a better fit here. |
Re: IsAutonomous() function
As to why your first code block isn't working, I can't say exactly. Looking at the code, IsAutonomous gets data from the driver station and returns the value of the autonomous member. Maybe there's an issue with getting data in the continuous loop?
Additionally, with an IterativeRobot,you don't need to explicitly call IsAutonomous since your AutonomousPeriodic and AutonomousTeleop will only be called when the mode is autonomous (check out IterativeRobot::StartCompetition) Code:
else if (IsAutonomous()) |
Re: IsAutonomous() function
From the doxygen output:
Quote:
When using an iterative robot, you don't need to call IsAutonomous() - the loop will only run while you are in autonomous, and will stop when you aren't. If you're running a simple robot (with no build in looping structure, you'll want to put something similar to: Code:
void Autonomous(void) |
Re: IsAutonomous() function
That brings up a good point. I don't see you doing anything with the watchdog. Unless you a) set the expiration to something manageable and b) feed the watchdog regularly, you have the potential of running into major problems with the cRIO resetting on you. Once you get into this scenario, it will be hard to fix depending on where the problem is because you will have a link to the driver station for just a few seconds before it resets again.
I would highly suggest adding this to your robot1 constructor Code:
GetWatchdog().SetExpiration(100);Code:
GetWatchdog().Feed(); |
Re: IsAutonomous() function
Quote:
As I said in my previous response, I think that this is an issue with the stdout buffer not getting flushed. |
Re: IsAutonomous() function
Hi!
I'm a programming mentor from lev's team, we are trying to get an iterative robot camera example up and running, the DS is OK and configured properlly but still no success we have discoverd that the "isAutonomos()" line is present everthing works fine, and nothing otherwise, any ideas why? (i would appriciate if someone can upload here a simple IterativeRobot camera color tracking example) thanks daniel |
| All times are GMT -5. The time now is 02:30. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi