View unanswered posts | View active topics It is currently Tue Oct 21, 2014 9:36 pm






Reply to topic  [ 9 posts ] 
Detecting Alliance Color 
Author Message
Rookie

Joined: Sat Jan 18, 2014 1:18 pm
Posts: 5
Post Detecting Alliance Color
I noticed that the JoystickDriver.c file contained a commented out line
Code:
// joystickCopy.TeamColor = false;
in the section of the code where the default values for the joystick are set. This made me curious if it was in fact possible to detect the TeamColor through the joystick. I also noted that when the tempBuffer values are read and converted into the fields for the joystick, the first one used is
Code:
joystickCopy.UserMode           = tempBuffer[1];
This is interesting because arrays start with element 0, so what does tempBuffer[0] contain? Is it the team color flag? If so, why is it not implemented?
Thanks!

Note: When I say team/alliance color, I'm talking about whether the robot is set up in Samantha to be Red or Blue.


Sat Jan 18, 2014 1:26 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Detecting Alliance Color
As you can see below, the TJoystick structure does not have the TeamColor field and the initialization line was commented out. So it is safe to say it is something not yet implemented. Regarding the tempBuffer[0] byte, I am not the RobotC folks so I don't know exactly what it is but my experience tells me that it is either the length of the transmitted packet or the version number so that RobotC can tell if the laptop is transmitting the correct version of the structure.
Code:
typedef struct
{
  bool    UserMode;          // Autonomous or Telep-Operated mode
  bool    StopPgm;           // Stop program

  short   joy1_x1;           // -128 to +127
  short   joy1_y1;           // -128 to +127
  short   joy1_x2;           // -128 to +127
  short   joy1_y2;           // -128 to +127
  short   joy1_Buttons;      // Bit map for 12-buttons
  short   joy1_TopHat;       // value -1 = not pressed, otherwise 0 to 7 for selected "octant".

  short   joy2_x1;           // -128 to +127
  short   joy2_y1;           // -128 to +127
  short   joy2_x2;           // -128 to +127
  short   joy2_y2;           // -128 to +127
  short   joy2_Buttons;      // Bit map for 12-buttons
  short   joy2_TopHat;       // value -1 = not pressed, otherwise 0 to 7 for selected "octant".
} TJoystick;
TJoystick joystick;      // User defined variable access
...
task readMsgFromPC()
{
  bool bMsgFound;

  TFileIOResult nBTCmdRdErrorStatus;
  const int kMaxSizeOfMessage = 18;
  sbyte tempBuffer[kMaxSizeOfMessage];

  // Initialize setting to default values

  //joystickCopy.TeamColor = false;
  joystickCopy.UserMode  = false;
  joystickCopy.StopPgm   = true;
  ...


Sat Jan 18, 2014 4:54 pm
Profile
Rookie

Joined: Sat Jan 18, 2014 1:18 pm
Posts: 5
Post Re: Detecting Alliance Color
I did notice that it wasn't in the Joystick structure, but it seems odd for them to make the line
Code:
//joystickCopy.TeamColor = false;
Why waste time even typing that line out if it wasn't implemented? Seems kind of odd to me. I don't know. But yeah, I suppose I'll just do some testing with the tempBuffer[0] flag at our next meeting and see if I can figure out what exactly it signifies


Sat Jan 18, 2014 5:02 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Detecting Alliance Color
It sounds like they are going to support it but it's not there yet.


Sat Jan 18, 2014 10:07 pm
Profile
Rookie

Joined: Sat Jan 18, 2014 1:18 pm
Posts: 5
Post Re: Detecting Alliance Color
MHTS wrote:
It sounds like they are going to support it but it's not there yet.

Oh I hope so, any idea how long that lines been there? If it's been there a while I doubt it'll ever make it in, but maybe it's new and almost done, lol


Sat Jan 18, 2014 11:24 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Detecting Alliance Color
alexrcoleman wrote:
Oh I hope so, any idea how long that lines been there? If it's been there a while I doubt it'll ever make it in, but maybe it's new and almost done, lol

I have no idea but I think this is not a difficult thing to implement. It just needs the team info from the FCS. I am expecting this to be part of 4.0.


Sun Jan 19, 2014 12:05 am
Profile
Rookie

Joined: Sat Jan 18, 2014 1:18 pm
Posts: 5
Post Re: Detecting Alliance Color
MHTS wrote:
alexrcoleman wrote:
Oh I hope so, any idea how long that lines been there? If it's been there a while I doubt it'll ever make it in, but maybe it's new and almost done, lol

I have no idea but I think this is not a difficult thing to implement. It just needs the team info from the FCS. I am expecting this to be part of 4.0.

Yeah, I was thinking it wouldn't be too tough to implement, which made me wonder why it was sortve setup in robotc but commented out, lol. And yeah, hopefully, any idea how long til 4.0 is out?


Sun Jan 19, 2014 12:08 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Detecting Alliance Color
According to the RobotC folks, the beta should be coming out real soon, probably next month or so.


Sun Jan 19, 2014 12:18 am
Profile
Rookie

Joined: Sat Jan 18, 2014 1:18 pm
Posts: 5
Post Re: Detecting Alliance Color
MHTS wrote:
According to the RobotC folks, the beta should be coming out real soon, probably next month or so.

Sweet, I'll keep my eye out for that, thanks :)


Sun Jan 19, 2014 12:58 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.