ROBOTC.net forums
http://www.robotc.net/forums/

Detecting Alliance Color
http://www.robotc.net/forums/viewtopic.php?f=52&t=7728
Page 1 of 1

Author:  alexrcoleman [ Sat Jan 18, 2014 1:26 pm ]
Post subject:  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.

Author:  MHTS [ Sat Jan 18, 2014 4:54 pm ]
Post subject:  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;
  ...

Author:  alexrcoleman [ Sat Jan 18, 2014 5:02 pm ]
Post subject:  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

Author:  MHTS [ Sat Jan 18, 2014 10:07 pm ]
Post subject:  Re: Detecting Alliance Color

It sounds like they are going to support it but it's not there yet.

Author:  alexrcoleman [ Sat Jan 18, 2014 11:24 pm ]
Post subject:  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

Author:  MHTS [ Sun Jan 19, 2014 12:05 am ]
Post subject:  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.

Author:  alexrcoleman [ Sun Jan 19, 2014 12:08 am ]
Post subject:  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?

Author:  MHTS [ Sun Jan 19, 2014 12:18 am ]
Post subject:  Re: Detecting Alliance Color

According to the RobotC folks, the beta should be coming out real soon, probably next month or so.

Author:  alexrcoleman [ Sun Jan 19, 2014 12:58 am ]
Post subject:  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 :)

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/