[joyos] r291 committed - Updated packet structure and types for this year's competition

0 views
Skip to first unread message

jo...@googlecode.com

unread,
Jan 18, 2011, 12:34:14 AM1/18/11
to joyos...@googlegroups.com
Revision: 291
Author: vaumnou
Date: Mon Jan 17 21:17:21 2011
Log: Updated packet structure and types for this year's competition
http://code.google.com/p/joyos/source/detail?r=291

Modified:
/trunk/src/drivers/rf.c
/trunk/src/inc/packet.h

=======================================
--- /trunk/src/drivers/rf.c Mon Jan 17 21:17:07 2011
+++ /trunk/src/drivers/rf.c Mon Jan 17 21:17:21 2011
@@ -32,8 +32,6 @@

packet_buffer tx, rx;

-volatile board_coord goal_position; //The target position received from a
goal packet
-
FILE rfio = FDEV_SETUP_STREAM(rf_put, rf_get, _FDEV_SETUP_RW);

volatile char rf_str_buf[PAYLOAD_SIZE+1];
@@ -44,12 +42,8 @@
volatile uint8_t rf_new_str;

struct lock rf_lock;
-
-volatile uint8_t light_port = 0xFF;
volatile uint8_t robot_id = 0xFF;

-volatile uint8_t caught[4];
-
void rf_status_update(uint8_t caught){

extern volatile uint8_t robot_id;
@@ -313,10 +307,6 @@
position_microtime = get_time_us();
break;

- case GOAL:
- goal_position = rx->payload.coords[0];
- break;
-
case START:
if (robot_id != 0xFF) {
//Remaining bytes are robots which are starting. Check if
we're one of them.
@@ -342,23 +332,6 @@
memcpy((char *)rf_str_buf, rx->payload.array, PAYLOAD_SIZE);
break;

- case LIGHT:
- if (light_port != 0xFF && robot_id != 0xFF) {
- for (int i=0; i<4; i++) {
- if (rx->payload.lights[i].id == robot_id)
- motor_set_vel(light_port,
rx->payload.lights[i].value);
- }
- }
- break;
-
- case STATUS:
- for (uint8_t i=0; i<4; i++){
- if (rx->payload.status.id == objects[i].id){
- caught[i] = rx->payload.status.caught;
- break;
- }
- }
- break;
default:
break;
}
=======================================
--- /trunk/src/inc/packet.h Mon Apr 19 21:40:36 2010
+++ /trunk/src/inc/packet.h Mon Jan 17 21:17:21 2011
@@ -10,24 +10,24 @@

#define PAYLOAD_SIZE 30

-#define POSITION 0x00 //Updated position of this bot, other bot, or mouse
-#define START 0x01 //Start of the round
-#define STOP 0x02 //End of the round
-#define STRING 0x03 //String from bot to board
-#define SYNC 0x04 //Not sure how to use yet. Established IDs of all
bots/vision system on board
-#define GOAL 0x05 //Sets the target position of this robot
-#define LIGHT 0x06 //Instructs robots to turn their lights on or off
-#define REPLY_STRING 0x07 //String from board to bot
-#define STATUS 0x08 // Status packet from mouse
+enum {
+ POSITION, //Updated position of this bot, other bot, or mouse
+ START, //Start of the round
+ STOP, //End of the round
+ STRING, //String from bot to board
+ REPLY_STRING //String from board to bot
+} packet_type;

#endif

typedef struct {
- uint8_t id;
+ unsigned id : 8;
signed x : 12;
signed y : 12;
signed theta : 12;
- unsigned confidence : 12;
+ signed a : 4;
+ signed b : 4;
+ unsigned radius : 4;
#ifndef SIMULATE
} __attribute__ ((aligned (1))) __attribute__ ((packed)) board_coord;
#else

Reply all
Reply to author
Forward
0 new messages