|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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.
![]() |
|
#2
|
|||
|
|||
|
Re: Autonomous Example
Are you using "Command Based" programming framework?
|
|
#3
|
|||
|
|||
|
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!!
|
|
#4
|
||||
|
||||
|
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 ![]() |
|
#5
|
|||
|
|||
|
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; } |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|