Go to Post "The robot is horribly overweight. We need to delete some code" - Dumper FTW 435 [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

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #18   Spotlight this post!  
Unread 03-05-2014, 10:03
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,715
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Share you Autonomous

Quote:
Originally Posted by SoftwareBug2.0 View Post
This still seems linear to me. All it's doing is waiting for some condition and deciding to go on to the next step or continue waiting.

What I was trying to ask is if you could do something like:
Code:
if goal is hot:
  fire
  drive forward
else:
  turn
  fire
This is one of the things I want to investigate during the off season. This is my untested theory so take it with a grain of salt.

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()));
HotGoalDecision
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...
}
IProvidesDescision
Code:
public interface IProvidesDecision {
   boolean getValue();
}
 


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 23:57.

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