![]() |
Moving autonomous programs to teleop
I am looking for some help with automating some tasks in teleop by using code from autonomous.
For example, lets say I have an autonomous mode where the first while loop is to drive straight using encoders for a certain distance, then move to another loop where the robot turns in a circle using the encoders, and then moves to a while loop where the motors are stopped. Now lets say that I want to use that code during teleop if i press a button. Do I just copy the code from autonomous and place it in a case structure attached to the button in teleop? Does it have to go in periodic tasks instead? Does each while loop have to be in a flat sequence as well? Help please? Thanks |
Re: Moving autonomous programs to teleop
TeleOp is designed to return to the scheduler and be called again every 20ms. If you put code there that takes longer than 20ms to run, it will cause the robot to miss joystick values. I'd recommend putting the code into Periodic tasks and using a global to cause it to start and stop when appropriate, auto or teleop.
Greg McKaskle |
Re: Moving autonomous programs to teleop
Quote:
|
Re: Moving autonomous programs to teleop
That would work. Or make a global that is set in teleOp based on button state and other logic and Periodic reads it to determine what to do next.
Greg McKaskle |
| All times are GMT -5. The time now is 12:02. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi