ROBOTC.net forums
http://robotc.net/forums/

Switching between RC and autonomous
http://robotc.net/forums/viewtopic.php?f=11&t=8532
Page 1 of 1

Author:  Rod [ Thu Apr 17, 2014 3:38 pm ]
Post subject:  Switching between RC and autonomous

How do we switch between autonomous and RC mode? I've created a challenge for my students but they can only use the RC mode for a short period of time and most of the time will be spent in autonomous. I am hoping they can switch in and out whenever they like.

Author:  denrya [ Sun Aug 17, 2014 1:14 am ]
Post subject:  Re: Switching between RC and autonomous

You can do this a couple of different ways, but I like to use multitasking to do it. Check out this forum post on multitasking:
viewtopic.php?f=11&t=3341

You can write your manual joystick controls as one task, and your autonomous as a second task. Then use task main to simply start/stop the tasks as you wish. For example:

if (vexRT[Btn5U] == 1)
{
stopTask (joydrive);
startTask (autodrive);
}
if (vexRT[Btn6D] == 1)
{
stopTask (autodrive);
startTask (joydrive);
}

Put that into a while loop, and you'll be all set.

Good luck!

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/