Go to Post The fact that although many of us disagree on specifics of how FIRST should conduct events, design a game, and facilitate as much fairness between teams as possible, in the end we still greatly enjoy each other's passion for FIRST and provide genuine respect for each other - Andy Baker [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 17-02-2011, 08:14
Daniel Daniel is offline
Daniel Katanski
#0240
Team Role: Mentor
 
Join Date: Feb 2004
Location: Monroe, MI
Posts: 32
Daniel is on a distinguished road
Starting Position from the DriverStation class

The folowing line should give you the robot starting location:

DriverStation ds; // define the drivers station object
int position = ds.getLocation(); // get the starting position

But I can not find what values to expect to be returned.

In test situations it returns -48. I would expect something like 1, 2, or 3 for left, center or right.

From this I hope to automatically determine which position the bot is in to let the autonomous adjust accordingly.

Does anyone know what this does?

Daniel
  #2   Spotlight this post!  
Unread 17-02-2011, 08:19
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: Starting Position from the DriverStation class

That value will not be useful for returning the starting position of the robot in competition matches. That value is based on which of the three driver stations your team is in which is not necessarily tied to where you place your robot. Where you place your robot should be determined through a discussion with your alliance partners before the match.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
  #3   Spotlight this post!  
Unread 17-02-2011, 08:27
Chexposito's Avatar
Chexposito Chexposito is offline
Registered User
AKA: Expo
FRC #1730
Team Role: Alumni
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Missouri
Posts: 272
Chexposito is a glorious beacon of lightChexposito is a glorious beacon of lightChexposito is a glorious beacon of lightChexposito is a glorious beacon of lightChexposito is a glorious beacon of lightChexposito is a glorious beacon of light
Re: Starting Position from the DriverStation class

we use the driver station digital inputs we will probably use two of them to determine the location
  #4   Spotlight this post!  
Unread 22-02-2011, 08:53
Daniel Daniel is offline
Daniel Katanski
#0240
Team Role: Mentor
 
Join Date: Feb 2004
Location: Monroe, MI
Posts: 32
Daniel is on a distinguished road
Re: Starting Position from the DriverStation class

Replies from FIRST:
-----
If you check for the position in the constructor for the main SimpleRobot or IterativeRobot class, no driver station data has passed between the field and the robot yet and you get a bogus value. If you either delay for a few seconds in the constructor, or do the check during the autonomous or operatorControl methods it correctly returns 1, 2, or 3.

The reason for the –48 for the value is that the passed value is a position as a character: '0', '1', or '2'. To make the character value into a number the code subtracts '0' which happens to be 48. Since Java initializes memory to all zeros, then you get 0-48 as the result until a real value shows up.
-----
There are two sets of values that come back from the dashboard, the alliance and location. The alliances are instances of the Alliance object:

public static class Alliance {

/** The integer value representing this enumeration. */
public final int value;
/** The Alliance name. */
public final String name;

public static final int kRed_val = 0;
public static final int kBlue_val = 1;
public static final int kInvalid_val = 2;

/** alliance: Red */
public static final Alliance kRed = new Alliance(kRed_val, "Red");
/** alliance: Blue */
public static final Alliance kBlue = new Alliance(kBlue_val, "Blue");
/** alliance: Invalid */
public static final Alliance kInvalid = new Alliance(kInvalid_val, "invalid");

private Alliance(int value, String name) {
this.value = value;
this.name = name;
}
} /* Alliance */

The locations are values 1, 2, or 3 and refer to the robot starting position from the FMS.

You can test both off the field by using the driver station and setting the combo box to "red 1", "red 2", "red 3", "blue 1", etc. and running the code. Those values should exactly correspond to the values you'll get from the FMS on a real field in a competition.
-----

I hope that this helps someone.
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


All times are GMT -5. The time now is 23:39.

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