|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
cRio to DS packet spec.
Hello all,
I'm working on a personal project where I'm hooking a Gumstix mini computer to an iCreate. The Gumstix has 802.11 on it and I was thinking of using a FIRST drivers station as the thing on my end to control it. In order to do this I will need to learn the packet communication between the two so I can implement the code that the cRio has on it onto the Gumstix. I was thinking of sniffing the packets on our practice robot which is at my house currently, but then I thought someone else may already have this info and can share it with me. So…. Does anyone have the packet communication between the DS and the cRio that they can share with me? -Jim |
|
#2
|
||||
|
||||
|
Re: cRio to DS packet spec.
I was working on somthing similar, but I never finished coding it.
You can view the source code and documentation I was working on on Codeplex, but the documentation is really more of note for myself than usable documentation. The data from the DS to robot is defined as: Code:
#define USER_CONTROL_DATA_SIZE 984 //This number is from memory, it wasn't in this chuck of code from my docs.
struct FRCControlData{
UINT16 packetIndex;
union {
UINT8 control;
struct {
UINT8 reset : 1;
UINT8 notEStop : 1;
UINT8 enabled : 1;
UINT8 autonomous : 1;
UINT8 :1;
UINT8 resync : 1;
UINT8 cRIOChkSum :1;
UINT8 fpgaChkSum :1;
};
};
UINT8 dsDigitalIn;
UINT16 teamID;
char dsID_Alliance;
char dsID_Position;
union {
INT8 stick0Axes[6];
struct {
INT8 stick0Axis1;
INT8 stick0Axis2;
INT8 stick0Axis3;
INT8 stick0Axis4;
INT8 stick0Axis5;
INT8 stick0Axis6;
};
};
UINT16 stick0Buttons; // Left-most 4 bits are unused
union {
INT8 stick1Axes[6];
struct {
INT8 stick1Axis1;
INT8 stick1Axis2;
INT8 stick1Axis3;
INT8 stick1Axis4;
INT8 stick1Axis5;
INT8 stick1Axis6;
};
};
UINT16 stick1Buttons; // Left-most 4 bits are unused
union {
INT8 stick2Axes[6];
struct {
INT8 stick2Axis1;
INT8 stick2Axis2;
INT8 stick2Axis3;
INT8 stick2Axis4;
INT8 stick2Axis5;
INT8 stick2Axis6;
};
};
UINT16 stick2Buttons; // Left-most 4 bits are unused
union {
INT8 stick3Axes[6];
struct {
INT8 stick3Axis1;
INT8 stick3Axis2;
INT8 stick3Axis3;
INT8 stick3Axis4;
INT8 stick3Axis5;
INT8 stick3Axis6;
};
};
UINT16 stick3Buttons; // Left-most 4 bits are unused
//Analog inputs are 10 bit right-justified
UINT16 analog1;
UINT16 analog2;
UINT16 analog3;
UINT16 analog4;
UINT64 cRIOChecksum;
UINT32 FPGAChecksum0;
UINT32 FPGAChecksum1;
UINT32 FPGAChecksum2;
UINT32 FPGAChecksum3;
char versionData[8];
};
/**
* Structure for DS to robot control packets
*/
typedef struct {
FRCControlData commonData;
char userDefined[USER_CONTROL_DATA_SIZE];
INT32 crcPad;
INT32 crcChecksum;
} ControlData;
1 byte - ? 2 bytes - battery voltage 5 bytes -? 6 bytes - robot MAC address 14 bytes - ? 2 bytes - reply ID(ID of previous packet sent from DS) 936 bytes - user configureable data 4 bytes - crc pad 4 bytes - crc32 They use some weird data formating for some data. If it isn't simpy encoded data here are the conversions I have recorded. Battery voltage (vb.net) Code:
Dim batteryBytes = reader.ReadBytes(2)
BatteryVoltage = Convert.ToDecimal(batteryBytes(0).ToString("x")) + (Convert.ToDecimal(batteryBytes(1).ToString("x")) / 100.0)
Code:
Public Function ReadTeamNumber(ByVal reader As BinaryReader) As Integer
Dim temp1 = reader.ReadByte()
Dim temp2 = reader.ReadByte()
Return temp1 * 100 + temp2
End Function
Alliance, 0x52 = 1, 0x42 = 2 Control byte - see DS to robot data structure Notes: If I remember correctly, the DS sends the full data structure even if the robot isn't replying. It just sets the disabled bit to 1. This could mean you don't have to implement the reply logic, but you would some saftey features. Last edited by EHaskins : 21-10-2009 at 18:49. |
|
#3
|
||||
|
||||
|
Re: cRio to DS packet spec.
Eric,
Thanks this is what I needed. -Jim |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DS -> PC Packet Description | rfrank | Programming | 1 | 16-02-2009 15:03 |
| New dashboard packet spec | Ameya | Programming | 2 | 08-01-2004 19:59 |
| sponsor packet | AlbertW | Fundraising | 9 | 13-07-2003 05:22 |
| sponsor packet | AlbertW | Computer Graphics | 5 | 12-07-2003 07:27 |
| Team packet? | rollncoast | General Forum | 7 | 30-05-2002 07:14 |