Go to Post I think rovers on Mars are way cool but you won't get a crowd of enthusiastic participants cheering as they trudge 150 meters a day. - Andrew Schuetze [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 27-01-2013, 21:44
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
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
Reply With Quote
  #2   Spotlight this post!  
Unread 27-01-2013, 21:50
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #3   Spotlight this post!  
Unread 27-01-2013, 21:54
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Moving autonomous programs to teleop

Quote:
Originally Posted by Greg McKaskle View Post
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
Thanks! I'll try that tomorrow. Could you elaborate on what you mean by using a global? Do you mean make a global boolean variable in teleop to check if the button is pressed, then read the global in periodic tasks and perform the action?
Reply With Quote
  #4   Spotlight this post!  
Unread 28-01-2013, 05:54
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:55.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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