|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#16
|
||||
|
||||
|
Re: Share you Autonomous
We used a record and replay system for autonomous this year. Attached are the complete projects for the custom dashboard and robot.
There is a tab on the dashboard for starting and stopping the recording process. It uses the SmartDashboard to communicate between the dashboard and robot. |
|
#17
|
||||
|
||||
|
Re: Share you Autonomous
Quote:
I forgot to mention the best part is that the script file is just a text file that resides on the cRio. The cRio has a built in ftp server, so you can change these sequences, and re-run without connecting to labview, compiling, etc. The whole process to change the script and ftp to the cRio can be done in about a min. We have done this while queuing for a match. It takes less time to change the auto code, and download, than it takes to charge the pneumatic system. We also have a dashboard selection that chooses between 7 automodes. |
|
#18
|
||||
|
||||
|
Re: Share you Autonomous
Quote:
Code:
#Load the shooting mechanism LOAD_SHOT #Drive forward 5 feet DRIVE 5 #Internal timer waits until 5 second mark if not hot DELAY_IF_NOT_HOT #shoot when ready WAIT_ON_LOAD SHOOT #Make sure the shooter is down for start of teleop LOAD_SHOT Instead you can write your command to tell a different process the same thing, letting the script continue. It then can meet back up with the WAIT_ON_LOAD command to make sure its ready to shoot. In this way, both the driving and the camera code are running in parallel with the code to load the shooter. Essentially you can write your commands to set off a parallel part of the code and continue. If all of the main robot actions are handled in a separate process, this becomes much easier to do (and it carries over to teleop). Last edited by wt200999 : 02-05-2014 at 13:29. |
|
#19
|
||||
|
||||
|
Re: Share you Autonomous
any reason you choose to save it on the crio and not just read it from a laptop?
|
|
#20
|
||||
|
||||
|
Re: Share you Autonomous
Yes, I don't know how to get the cRio to read a file over the FMS to the driver station. Maybe there is something there already, but I have never tried it.
|
|
#21
|
|||
|
|||
|
Re: Share you Autonomous
You can implement your own UDP/TCP connection to communicate between the dashboard and the cRIO. We have done this in labview when we needed extra vision processing computing power. Also, the smart dashboard may have similar capabilities.
|
|
#22
|
||||
|
||||
|
Re: Share you Autonomous
Another interesting way to do this would be to use port 80 (HTTP) or 443 (HTTPS) which are both not blocked, and write some kind of snazzy web app to create/modify/save your scripts. The current cRio already runs a web server, and setting this up on the robotRIO will be even easier. If you are worried about resource usage you can do something to pause or kill the web server when you are not in a disabled mode.
|
|
#23
|
||||
|
||||
|
Re: Share you Autonomous
Quote:
What I was trying to ask is if you could do something like: Code:
if goal is hot: fire drive forward else: turn fire |
|
#24
|
|||||
|
|||||
|
Re: Share you Autonomous
Quote:
TwoBallTwoHotGoalCommand Code:
HotGoalFinder finder = new HotGoalFinder(); addSequential(new DriveStraightCommand(0.85, 240)); addSequential(finder, 0.5); addSequential(new DecisionCommand (finder, new TurnandShootSeries(), new ShootCommand())); addSequential(new DeployArmCommand(Arm.DEPLOY, RobotMap.pickupPower)); addSequential(new DriveStraightCommand(-0.85, 240)); addSequential(new WaitCommand(1)); addSequential(new DriveStraightCommand(0.85, 240)); addSequential(finder, 0.5); addSequential(new HotGoalDecision(finder, new TurnandShootSeries(), new ShootCommand())); Code:
public class DecisionCommand extends Command {
public DecisionCommand (IProvidesDecision decision, Command trueCommand, Command falseCommand) {}
public void initialize() {
if (decision.getValue()) {
trueCommand.initialize();
} else {
falseCommand.initialize());
}
}
public void execute() {
if (decision.getValue()) {
trueCommand.execute();
} else {
falseCommand.execute());
}
etc...
}
Code:
public interface IProvidesDecision {
boolean getValue();
}
|
|
#25
|
||||
|
||||
|
Re: Share you Autonomous
This isn't our main autonomous (our main autonomous uses vision tracking to detect the hot goal and shoot at it; don't have access to the team's programming computer atm and left my flash drive in it) but it's a 2-ball autonomous VI that wasn't used in the final code. It's pretty basic as it was written in a blank VI and so I didn't get to use global variables or subVIs. See if it helps.
|
|
#26
|
||||
|
||||
|
Re: Share you Autonomous
Quote:
in twoBallHot.script Code:
SHIFT on WAIT 1000 SET_SHOULDER 49 IF right_hot rightHot leftHot Code:
DRIVE_STRAIGHT 75 0 TURN 12 WAIT 100 SHOOT WAIT 400 SET_SHOULDER -5 TURN -152 INTAKE in DRIVE_STRAIGHT 75 -152 SET_SHOULDER 49 TURN -7 INTAKE off DRIVE_STRAIGHT 70 -7 WAIT 200 SHOOT SHIFT off Code:
DRIVE_STRAIGHT 75 0 TURN -12 WAIT 100 SHOOT WAIT 400 SET_SHOULDER -5 TURN -150 INTAKE in DRIVE_STRAIGHT 75 -150 SET_SHOULDER 49 TURN 17 INTAKE off DRIVE_STRAIGHT 80 17 WAIT 200 SHOOT SHIFT off |
|
#27
|
||||
|
||||
|
Re: Share you Autonomous
Our one ball hot check script was this:
Code:
#One Ball, with Hot Checking WAIT 500 CHECK_HOT ARM_MOVE 1 SET_ROLLER_SPEED 25 DRIVE_STRAIGHT 96 5000 #Was 3500 SHOOT_HOT 3000 STOP_ALL |
|
#28
|
||||
|
||||
|
Re: Share you Autonomous
Quote:
|
|
#29
|
||||
|
||||
|
Re: Share you Autonomous
Quote:
Here's something you could do if you wanted to be avoid duplicating the end of command conditions in the subsequent if: Code:
class Continuable extends Command{
//I don't remember whether I've set this class up is valid Java...
//this would return self unless you wnated to run a different command.
abstract public Continuable next();
public bool isFinished(){
return next()==null;
}
}
class Continues extends Command{
Continuable current;
Continues(Continuable cmd){
current=cmd;
}
void initialize(){
if(current!=null) current.initialize();
}
void execute(){
if(current!=null){
current.execute();
}
}
bool isFinished(){
if(current==null) return 1;
current=current.next();
return current==null;
}
}
|
|
#30
|
|||||
|
|||||
|
Re: Share you Autonomous
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|