Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Autonomous Example (http://www.chiefdelphi.com/forums/showthread.php?t=143550)

alexusaywla 02-09-2016 10:42 PM

Autonomous Example
 
Can someone please provide me with an example of an autonomous code you've used before or are currently using? And please explain what everything means? As of right now I'm simply trying to drive during autonomous so even an explanation of how to program that will help. We are using VictorSPs to drive. I'll also appreciate any other help! I've searched through numerous sources but I am completely lost. :confused:

nollchr 02-10-2016 08:09 AM

Re: Autonomous Example
 
Are you using "Command Based" programming framework?

alexusaywla 02-10-2016 09:17 AM

Re: Autonomous Example
 
To my understanding no... I'm using SampleRobot. My current code can be found here so correct me if I'm wrong please http://pastebin.com/DQdALFKA. My autonomous is a mess!!

Dpurry23 02-21-2016 05:24 PM

Re: Autonomous Example
 
It seems like you're trying to have multiple options for autonomous.
http://pastebin.com/8zBk4hG0
Look at the lines highlighted and I hope it helps :D

chesterm 03-04-2016 11:29 PM

Re: Autonomous Example
 
try this for a simple straight ahead run in SampleRobot:

class declarations:
uint64_t autoTime = 0;
uint64_t testTime = 0;

void Autonomous()
{
if (IsAutonomous() && IsEnabled())
{
std::cout << "AutoMode START" << std::endl;
driveTrain.SetSafetyEnabled(true);
autoTime = GetFPGATime();
}
while (IsAutonomous() && IsEnabled())
{
testTime = GetFPGATime();
testTime = (testTime - autoTime) / 1000; //get milliseconds
if (testTime < 3250) //want to travel 11 feet in straight line
driveTrain.TankDrive(-0.65,-0.65); //drive forward
else
driveTrain.TankDrive(0.0,0.0); //stop
}
driveTrain.StopMotor();
std::cout << "AutoMode STOP" << std::endl;
}


All times are GMT -5. The time now is 10:25 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi