Go to Post Unlike robot design, in the clothing world there's no such thing as too much pocketing - Jaci [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-04-2010, 16:11
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Autonomous Control

With the goal of making a robot fully autonomous:

How should the mechanisms be controlled?

What sorts of control might you want over a mechanism?

This thread may also be used to discuss the bobotics Autonomous Development Kit.
__________________
-- Marshal Horn
  #2   Spotlight this post!  
Unread 08-04-2010, 16:16
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Autonomous Control

Here's a summary of the Autonomous Development Kit:
Quote:
Originally Posted by lineskier
The idea is each robot registers an autonmous or operator controller.

This controller then determines what the current maneuver is and notifies the mechanisms of a change.
The controller also registers the current maneuver with the robot.

The mechanisms refer to the robot for the current maneuver.
the mechanisms the send a response when they complete or fail a given task.

each mechanism should be able to work independently of the other mechanisms, so your examples of maneuvers are drive maneuvers, not robot maneuvers.

How I implemented it is all mechanisms recieve a drive forward command (which is really drive forward and shoot).
think of it as a phase 1 command (phase 0 being init)

when the drive recieves that command it drives forward infinitely
when the shooter recieves the command it shoots if the ball breaks the ir beam
when it shoots it responds to the controller with a pass.
the controller keeps looping this until it has seen N number of passes
the the passes >= N it has succesfully completed that maneneuver (shooting N balls) and can move on to its next
maneuver.

As the controller handles the maneuvers, if it changes the current maneuver it overrides it for every mechanism, however a mechanism itself can choose to ignore a given maneuver command.
__________________
-- Marshal Horn
  #3   Spotlight this post!  
Unread 08-04-2010, 17:00
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Autonomous Control

Here's how I've interpreted that for translation to LabVIEW:
Each mechanism has an event manager assigned to it, which handles the dequeuing of events for that mechanism, whether to override an event for a newer one, and informs the Planner whether each event succeeded, failed, or was aborted.
The Planner is what actually determines what the robot should be doing.
(Autonomous planning can be discussed here)
__________________
-- Marshal Horn
  #4   Spotlight this post!  
Unread 08-04-2010, 17:10
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Autonomous Control

Quote:
Originally Posted by kamocat View Post
Here's a summary of the Autonomous Development Kit:
First off I would like to thank Marshal (Kamocat) for starting this thread. It is definitely a good place to start.

Let me state it as simply as possible.

There are two types of events in the system: MechanismEvents and ManeuverEvents.

MechanismEvents will be used for mechanism-mechanism communications
-these are one way and have not yet been implemented

All Events are sent through a single EventManager.

ManeuverEvents will be used for controller-mechanism communications.
-these are two way, the AutonomousController sends an event to the mechanisms and waits for a reply

Mechanisms are high level things like arms, shooters and drives. The developer will implement these, not the ADK. However we will provide basic templates

Maneuvers are tasks to be completed by the robot. Each maneuver has a pass fail and time out.

This is a collaborative initiative and we would like as many teams to get involved as they can, regardless of experience level. The idea is that it should be able to be used as a black box, but have many extension points.

Follow the link above to join the first forge project.
(Java, C++ repositories have been created, waiting on the lab view to be accepted.)
__________________
"Never let your schooling interfere with your education" -Mark Twain
  #5   Spotlight this post!  
Unread 08-04-2010, 19:09
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Autonomous Control

Okay, good, were're mostly describing the same thing.
However, to keep the LabVIEW code as transparent as possible, I was thinking that I wouldn't call the mechanism functions by reference and use OOP, but instead use parallel dataflow and cluster (struct) typedefs.

So the way it is working currently, each mechanism has its own task manager, and its own queue. There may have to be a dispatcher taking all the events and putting them in the appropriate queues, and getting the "pass/fail/timeout" back from the mechanism event managers, so that it's easily accessible by the planner.

Currently the event datatype looks like this:

cluster "Action"
string "action name/#"
u16 "Action Type" enum {no action, forward(ft/s), turn(deg/s), strafe(ft/s), move(fwd, stf, trn), kick(ft), retract, kick-retract(ft, s), arm height(ft)}
array "action values" 1D
sgl "value"
cluster "start"
u8 "when" enum {now, named value=, named input=, action complete, wait (s), time (s)}
string "name"
sgl "value"
u8 "compare" enum {=, >, <}
u8 "if conflict" enum {wait until finished, override that, skip this}
cluster "end"
u8 "when" enum {auto, named value=, named input=, action complete, wait (s), time (s)}
string "name"
sgl "value"
u8 "compare" enum {=, <, >}
bool "allow override"
The "override" here is very similar to timeout, but it doesn't time out until another event is sent. I tried to make this as flexible as possible, so people could do anything from "drive forward until you are 20in away from an obstacle" to "kick when the robot is done turning".
__________________
-- Marshal Horn
  #6   Spotlight this post!  
Unread 08-04-2010, 19:26
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Autonomous Control

Code:
while(gameRunning)
{
KickButt("Chuck Norris Style");
}
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #7   Spotlight this post!  
Unread 08-04-2010, 22:39
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Autonomous Control

Quote:
Originally Posted by kamocat View Post

So the way it is working currently, each mechanism has its own task manager, and its own queue. There may have to be a dispatcher taking all the events and putting them in the appropriate queues, and getting the "pass/fail/timeout" back from the mechanism event managers, so that it's easily accessible by the planner.
One goal of this is to have rookie teams be able to use this, so I opted to not go with a queue. In my case the maneuver factory handles all of the pass fail timeout options.

As a maneuver changes it registers the maneuver with the robot. Each mechanisms just reference the robot for the current maneuver. This eliminates the need for different types of ManeuverEvents beyond pass fail and change.

The EventManager also sends all maneuver change events to all mechanisms, all mechanism events to all of the mechanisms. This allows us to keep the event manager unchanged, simplifying to code for rookies.

all a rookie team would have to implement:
Robot
Maneuver Factory (could take a template)
Mechanisms

example maneuver factory
for a robot which drives straight, shoots, repeat.

(draw out the state machine, its easier to picture it way)
..Maneuver(passManeuver,failManeuver,toManeuver);

Code:
public class ManeuverFactory implements IManeuverFactory{
    private static ManeuverFactory factory = new ManeuverFactory();

    private static int mode = 0;

    private ManeuverFactory(){}

    public Maneuver get(String type){
       Maneuver man = null;

       if(type.equalsIgnoreCase(Maneuver.INIT)){
            man = new Initialize();
            man.setNext(ManeuverType.STRAIGHT, Maneuver.INIT, Maneuver.HALT);
       }else if (type.equalsIgnoreCase(ManeuverType.STRAIGHT)){
           man = new Maneuver(ManeuverType.STRAIGHT, ManeuverType.STRAIGHT_TO) {};
           man.setNext(ManeuverType.SHOOT, Maneuver.HALT, Maneuver.HALT);
       }else if (type.equalsIgnoreCase(ManeuverType.SHOOT)){
           man = new Maneuver(ManeuverType.SHOOT, ManeuverType.SHOOT_TO) {};
           man.setNext(ManeuverType.STRAIGHT, ManeuverType.SHOOT, Maneuver.HALT);
       }else if (type.equalsIgnoreCase(Maneuver.OPERATOR)){
            man = new Maneuver(Maneuver.OPERATOR, Maneuver.OPERATOR_TO) {};
            man.setNext(Maneuver.OPERATOR, Maneuver.INIT, Maneuver.OPERATOR);
       }
       return man;
    }

    public static IManeuverFactory getInstance() {
        return factory;
    }
}
__________________
"Never let your schooling interfere with your education" -Mark Twain
  #8   Spotlight this post!  
Unread 08-04-2010, 23:21
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Autonomous Control

The only events I'm familiar with are user events (the user interacting with a GUI). However, you seem to be using "events" as a method of transferring data from one place to another.
How are you "registering" a maneuver? Is it all variable scope?

Does each mechanism only perform one action? For example, is the Drive mechanism always in the form of Drive(Forward, Strafe, Turn); ?

Are all the maneuvers "canned", so to speak? Can a mechanism be controlled without performing a maneuver?
__________________
-- Marshal Horn

Last edited by kamocat : 08-04-2010 at 23:23.
  #9   Spotlight this post!  
Unread 09-04-2010, 01:06
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Autonomous Control

Quote:
Originally Posted by kamocat View Post
The only events I'm familiar with are user events (the user interacting with a GUI). However, you seem to be using "events" as a method of transferring data from one place to another.
How are you "registering" a maneuver? Is it all variable scope?

Does each mechanism only perform one action? For example, is the Drive mechanism always in the form of Drive(Forward, Strafe, Turn); ?

Are all the maneuvers "canned", so to speak? Can a mechanism be controlled without performing a maneuver?
An event is not so much a way transferring data, but more a way of notifying.
If the current maneuver is changed the mechanisms should be notified.

Here's some code from another teams robot which i converted to the ADK

example robot code (registers on initialize):



Code:
public class Wolv extends Robot
 {
    
    public synchronized void initialize() {
        timer.reset();
        timer.start();

        getWatchdog().setExpiration(0.1);

        controller.setFactory(ManeuverFactory.getInstance());

        controller.addEventListener(ManeuverEvent.CHANGE, shooter);
        controller.addEventListener(ManeuverEvent.CHANGE, drive);
        controller.addEventListener(ManeuverEvent.CHANGE, roof);
    }
    
}
example drive code:

Code:
public void actAutonomous() {
        if(timer.get() > GYRO_TO){
            gy.reset();
            timer.stop();
            timer.reset();
            timer.start();
        }
        String type = Wolv.getInstance().getManeuver().getType();
        if (type.equalsIgnoreCase(ManeuverType.NOT_STRAIGHT))
            notStraight();
        else if (type.equalsIgnoreCase(ManeuverType.ROTATE))
           if(rotate())
               this.respond(new MechanismEvent(MechanismEvent.PASS));
        else if (type.equalsIgnoreCase(ManeuverType.STRAIGHT))
            straight();
        else if (type.equalsIgnoreCase(ManeuverType.STRAFE))
            strafe();
        else if (type.equalsIgnoreCase(Maneuver.OPERATOR))
            actOperator();
        else
            halt();

    }

    public void actOperator() {
        if(timer.get() > GYRO_TO){
            gy.reset();
            timer.stop();
            timer.reset();
            timer.start();
        }

        if(Wolv.getJoystick().getRawButton(DRIVE_STRAIGHT_BUTTON))
            driveStraight();
        else
            drive(Wolv.getJoystick());
    }
a maneuver decides for itself what it should do. it could run by itself and ignore everything else.

or it could only listen for events from a MechanismController which would send events through the form of a MechanismEvent

also everything is extendable, beginner users wouldn't make custom maneuvers per se, but advanced users could. Here is a maneuver which needs to receive 3 passes from the mechanisms before it triggers a pass and gets the next maneuver.


Code:
public class DriveForward extends Maneuver{
    private static int BALLS_EXPECTED = 3;

    private int ballCount = 0;

    public DriveForward()
    {
        super(ManeuverType.DRIVE_F, ManeuverType.DF_TO);
    }
    
    public void pass()
    {
        ballCount++;
        if(ballCount >= BALLS_EXPECTED)
        {
            Bob.getInstance().setManeuver(pass);
            Bob.getInstance().getManeuver().start();
        }
        else
            ballCount++;
            
    }
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 09-04-2010 at 12:13.
  #10   Spotlight this post!  
Unread 09-04-2010, 01:58
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Autonomous Control

ADK architecture:


================= Robot
================== |
(Brains)ManeuverFactory - EventManager - Controller(Auton,Operator)
================== |
================ Mechanism

Everything above is extendable except the EventManager.

All basic teams would need to implement is:

ManeuverFactory - Robot - Mechanism

everything else should be able to work as a black box if they want it to.


I hope this helps...
__________________
"Never let your schooling interfere with your education" -Mark Twain
  #11   Spotlight this post!  
Unread 18-04-2010, 02:19
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Autonomous Control

Okay, so I finally understand how the ADK works:
The "robot" consists of three components:
  • Human Operator or the maneuver Planner (decides what maneuver should be performed)
  • Event Handler (makes sure the maneuver factory changes maneuvers when it should)
  • Maneuver Factory (performs the maneuvers)
The manuever types are all pre-coded, and can involve multiple mechanisms. (For example, you could have a maneuver type that says "go forward 2 feet, spin in a circle, and fire 3 balls") It's effectively a canned move, and as far as I'm aware, it is not dynamically configurable.
The maneuver factory can only perform one maneuver at a time (to prevent simultaniously sending two different values to a mechanism).
When the maneuver is changed, the mechanisms don't necessarily stop whatever they were doing and accept the new command. Some actions require completion before a new one can be issued. (for example, you don't want a kicker to try to extend when it's already extended; it must retract for two seconds to avoid penalty.)

How accurate is that?
__________________
-- Marshal Horn
  #12   Spotlight this post!  
Unread 17-04-2010, 22:29
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Autonomous Control

Here is one method of autonomous control for LabVIEW.
NOTE: it is *not* the autonomous development kit, but I *am* calling it an Autonomous Control Framework.
Here's how it works:
Quote:
Originally Posted by README
Each mechanism has its own dequeuer, which deals with dequeuing the events for that mechanism, and what to do when a new event arrives. (abort current, wait until done, or skip new)
There is also a main disbacher, to send events to the appropriate dequeuers.

This framework is intended to go with an autonomous program that includes Planner (for deciding what to do next) and a Perceiver (for taking sensor data, processing it, and storing it as named values)
With it, any action can be started or stopped with any of the following conditions:
  • immidiately
  • time delay
  • time in match
  • named value =, <, or >
  • named input =, <, or >
  • Completion of antother event
  • Sucess of another event


I wanted to try making this in addition to the autonomous development kit described by Mike (lineskier).
This Autonomous Control Framework is quite functional (except perhaps the value comparison being backwards of what is intuitive).

So, now that this is public, I'm going to resume work on the autonomous development kit.
Attached Files
File Type: zip ACF.zip (466.3 KB, 37 views)
__________________
-- Marshal Horn
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Traction Control in Autonomous? dboisvert C/C++ 4 07-03-2009 11:11
control 4 motors in autonomous? pinballwizard96 NI LabVIEW 4 10-02-2009 12:03
pic: Autonomous Control Sample Squall Extra Discussion 4 07-04-2005 01:53
OI/Control Board LEDs during Autonomous ace123 Programming 1 12-02-2005 19:38
Autonomous to Manual control? Lint_Ninja Programming 5 16-02-2004 21:48


All times are GMT -5. The time now is 05:24.

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