|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Random autonomous
Hello! I am programming in C++, and I came up with an interesting idea. What I would like to do is write multiple autonomous programs/routines, and have one of them randomly selected at the beginning of the match. I'm pretty sure we would first generate a random number between 1 and ___, and then have a series of case statements with each autonomous code assigned to a different case. Does this sound like something that can/should be done? I suppose I'll ask how on the C++ forum if it seems okay with everyone.... Thanks!
|
|
#2
|
||||
|
||||
|
Re: Random autonomous
Quote:
|
|
#3
|
|||
|
|||
|
Re: Random autonomous
you could have the choices not random but controlled, the options would be available on the dash board and according to your surroundings you could change what happens in autonomous.
|
|
#4
|
||||
|
||||
|
Re: Random autonomous
It's mostly the concept I'm interested in. I've seen it implemented on robots that were unanimously successful, with separate programs for defense, offense, and whatnot.... This year, we'll only be focusing on one aspect, so it wont really be of much concern. I'm just interested. Thanks!
|
|
#5
|
|||
|
|||
|
Re: Random autonomous
You can do this. But you should not make it random, I used C++ last year, and programmed it so that by holding a single button on the joystick during disabled mode, the robot would select different routines to run in autonomous. The driver station had a text output describing the mode.
It was indeed very useful/effective. We could switch between shooting 2 balls from the key, shooting 2 and tipping the bridge, driving up to the fender and shooting 2 balls, shooting 4 balls, or feeding balls to an alliance member. It made life easier to be able to switch modes without a reprogram, the only thing to watch out for is if your robot gets reset, or the field is reset, you have to re-select the mode (it's a good idea to use your preferred mode as the default). Here is a link to my main source code file: https://github.com/TeamExcel/Project.../Robot2012.cpp Line 489 shows the switching logic. Line 420 resets the mode when the robot gets disabled. Line 665 shows the switching between autonomous cases during running. Last edited by DjScribbles : 01-08-2013 at 02:44 PM. Reason: forgot to add the link |
|
#6
|
||||
|
||||
|
Re: Random autonomous
For Lunacy we had several auto modes. One of them would randomly pick an existing auto mode. To make it more fun we also had an auto mode to drive straight for a random amount of time, then turn for a random amount of time, then drive straight for a random amount of time. This random auto mode could have been one of the randomly selected auto modes.
Granted in that year, as long as you kept moving in auto you were good. |
|
#7
|
||||
|
||||
|
Re: Random autonomous
This method sounds perfect. I was not aware that you were allowed to influence the robot in any way during disabled/autonomous mode. Thanks for the example! Thanks everyone else, as well :D I'm glad I'm not the only person who thinks something similar to this is a good idea.
|
|
#8
|
|||||
|
|||||
|
Re: Random autonomous
Many years ago, we selected our auto mode using switches on the robot. On off off meant one thing, on off on another, and so on.
Of course we knew which one we wanted to choose before the match started |
|
#9
|
|||
|
|||
|
Re: Random autonomous
Quote:
The match begins with a fifteen (15)-second Autonomous Period in which robots operate independently of driver inputs. Hitting a button on the joystick is an input, so this is an illegal tactic. |
|
#10
|
||||
|
||||
|
Re: Random autonomous
What we've done traditionally is include a rotary binary switch (a more compact version of what Don mentioned) somewhere on our OI or robot, and tie a specific auton routine to each setting using a switch block. By changing the switch's state, we can choose between auton routines on the fly when we need to switch roles for a certain match.
|
|
#11
|
||||
|
||||
|
Re: Random autonomous
Quote:
|
|
#12
|
|||
|
|||
|
Re: Random autonomous
Moreover, the joystick data sent to the robot during autonomous ignores never changes during auto. The values it uses are the last read during disable. To select an auto, you have many choices ...
Joystick values (like on the third axis), FIRST Touch switches, I/O tab switches without a I/O board, Robot jumpers or switches, Dashboard settings sent over SmartDashboard, The cRIO DIP on the 8 slot, and of course similar mechanisms with a pot compared to various ranges. Greg McKaskle |
|
#13
|
|||
|
|||
|
Re: Random autonomous
There are some examples in Java and C++ of choosing a (not random) autonomous program from the SmartDashboard with Command based programs on this page:
http://wpilib.screenstepslive.com/s/...smartdashboard The idea is that after caucusing with your alliance partners, you decide which of several strategies you might want to use and run the agreed one. Brad |
|
#14
|
|||
|
|||
|
Re: Random autonomous
This seems to be a cool idea, how would you do this if you were programming the robot in Java?
|
|
#15
|
||||
|
||||
|
Re: Random autonomous
Normally, the Lunatecs select an autonomous mode by using the analog inputs on the dashboard. As soon as the robot is enabled, the code reads the analog input, and uses the appropriate autonomous mode.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|