UDP comms to ROV
msg.h@2:48524892982c, 2012-01-16 (annotated)
- Committer:
- inky
- Date:
- Mon Jan 16 17:32:54 2012 +0000
- Revision:
- 2:48524892982c
- Parent:
- 0:4a75d653c18c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
inky | 0:4a75d653c18c | 1 | /************************************************************* |
inky | 0:4a75d653c18c | 2 | * Specifies the message format from controller to sub |
inky | 0:4a75d653c18c | 3 | *************************************************************/ |
inky | 0:4a75d653c18c | 4 | #ifndef __MSG_H__ |
inky | 0:4a75d653c18c | 5 | #define __MSG_H__ |
inky | 0:4a75d653c18c | 6 | |
inky | 0:4a75d653c18c | 7 | |
inky | 0:4a75d653c18c | 8 | typedef struct MSG_FORMAT_T { |
inky | 0:4a75d653c18c | 9 | unsigned char cmd; |
inky | 0:4a75d653c18c | 10 | unsigned char data[6]; |
inky | 0:4a75d653c18c | 11 | } MSG_FORMAT; |
inky | 0:4a75d653c18c | 12 | |
inky | 0:4a75d653c18c | 13 | #define MODE_WRITE = 0x0a; |
inky | 0:4a75d653c18c | 14 | #define MODE_READ = 0x05; |
inky | 0:4a75d653c18c | 15 | #define MODE_PWM = 0xa0; // device type uses PWM for control (ie motor control) |
inky | 0:4a75d653c18c | 16 | #define MODE_ON_OFF = 0x50; // device type uses on or off for control (ie camera) |
inky | 0:4a75d653c18c | 17 | |
inky | 0:4a75d653c18c | 18 | #define CMD_INIT 0x00 |
inky | 0:4a75d653c18c | 19 | #define CMD_ROV 0x01 |
inky | 0:4a75d653c18c | 20 | #define CMD_AUX 0x02 |
inky | 0:4a75d653c18c | 21 | #define CMD_STATS 0x04 |
inky | 0:4a75d653c18c | 22 | #define CMD_V 0x08 |
inky | 0:4a75d653c18c | 23 | #define CMD_CLAW 0x40 |
inky | 0:4a75d653c18c | 24 | #define CMD_PTZ 0x80 |
inky | 0:4a75d653c18c | 25 | #define CMD_IMU 0x81 |
inky | 0:4a75d653c18c | 26 | |
inky | 0:4a75d653c18c | 27 | #define HIGH_BYTE(x) ( (x >> 8) & 255) |
inky | 0:4a75d653c18c | 28 | #define LOW_BYTE(x) ( (x ) & 255) |
inky | 0:4a75d653c18c | 29 | #define ROV_SET_SPEED(data, speed) {data[0]=HIGH_BYTE(speed);data[1]=LOW_BYTE(speed);} |
inky | 0:4a75d653c18c | 30 | #define ROV_GET_SPEED(data) ( ((data[0]&0xff)<<8) + (data[1]&0xff) ) |
inky | 0:4a75d653c18c | 31 | |
inky | 0:4a75d653c18c | 32 | // defines the values for various messages |
inky | 0:4a75d653c18c | 33 | // Motor control |
inky | 0:4a75d653c18c | 34 | #define ROV_SPEED_POS 0 |
inky | 0:4a75d653c18c | 35 | #define ROV_TURN_POS 2 |
inky | 0:4a75d653c18c | 36 | #define ROV_VERT_POS 4 |
inky | 0:4a75d653c18c | 37 | |
inky | 0:4a75d653c18c | 38 | // Camera |
inky | 0:4a75d653c18c | 39 | #define CAM_FN_ENABLE 0x80 |
inky | 0:4a75d653c18c | 40 | #define CAM_FN_ZOOM_IN 0x01 |
inky | 0:4a75d653c18c | 41 | #define CAM_FN_ZOOM_OUT 0x02 |
inky | 0:4a75d653c18c | 42 | #define CAM_FN_PAN_LEFT 0x01 |
inky | 0:4a75d653c18c | 43 | #define CAM_FN_PAN_RIGHT 0x02 |
inky | 0:4a75d653c18c | 44 | #define CAM_FN_TILT_UP 0x01 |
inky | 0:4a75d653c18c | 45 | #define CAM_FN_TILT_DOWN 0x02 |
inky | 0:4a75d653c18c | 46 | |
inky | 0:4a75d653c18c | 47 | // Aux_fn messages |
inky | 0:4a75d653c18c | 48 | #define AUX_FN_KILL_CMD 0xDE |
inky | 0:4a75d653c18c | 49 | #define AUX_RESTART_CMD 0x55 |
inky | 0:4a75d653c18c | 50 | #define AUX_FN_LIGHT1_ON 0x0a |
inky | 0:4a75d653c18c | 51 | #define AUX_FN_LIGHT2_ON 0x50 |
inky | 0:4a75d653c18c | 52 | #define AUX_FN_CAM1_ON 0x08 |
inky | 0:4a75d653c18c | 53 | #define AUX_FN_CAM2_ON 0x80 |
inky | 0:4a75d653c18c | 54 | #define AUX_FN_AIR_SOL_ON 0x80 |
inky | 0:4a75d653c18c | 55 | #define AUX_FN_WATER_SOL_ON 0x08 |
inky | 0:4a75d653c18c | 56 | |
inky | 0:4a75d653c18c | 57 | #define AUX_CMD_POS 1 |
inky | 0:4a75d653c18c | 58 | #define AUX_LIGHT_POS 2 |
inky | 0:4a75d653c18c | 59 | #define AUX_CAM_POS 3 |
inky | 0:4a75d653c18c | 60 | #define AUX_SOLENOID_POS 4 |
inky | 0:4a75d653c18c | 61 | |
inky | 0:4a75d653c18c | 62 | // STATS messages |
inky | 0:4a75d653c18c | 63 | #define STATS_COMPASS_POS 1 |
inky | 0:4a75d653c18c | 64 | #define STATS_PRESSURE_POS 2 |
inky | 0:4a75d653c18c | 65 | #define STATS_X_ACCEL_POS 3 |
inky | 0:4a75d653c18c | 66 | #define STATS_Y_ACCEL_POS 4 |
inky | 0:4a75d653c18c | 67 | #define STATS_Z_ACCEL_POS 5 |
inky | 0:4a75d653c18c | 68 | #define STATS_TEMPERATURE_POS 6 |
inky | 0:4a75d653c18c | 69 | #define STATS_MISC_POS 7 |
inky | 0:4a75d653c18c | 70 | |
inky | 0:4a75d653c18c | 71 | #define STATS_LEAK_DETECTED 0x80 |
inky | 0:4a75d653c18c | 72 | #define STATS_MOTOR_ERROR 0x40 |
inky | 0:4a75d653c18c | 73 | #define STATS_1 0x20 |
inky | 0:4a75d653c18c | 74 | #define STATS_2 0x10 |
inky | 0:4a75d653c18c | 75 | |
inky | 0:4a75d653c18c | 76 | |
inky | 0:4a75d653c18c | 77 | // Claw |
inky | 0:4a75d653c18c | 78 | |
inky | 0:4a75d653c18c | 79 | |
inky | 0:4a75d653c18c | 80 | // States |
inky | 0:4a75d653c18c | 81 | |
inky | 0:4a75d653c18c | 82 | // IMU (inertial mgmt unit) |
inky | 0:4a75d653c18c | 83 | #define IMU_PRESSURE_POS 0 |
inky | 0:4a75d653c18c | 84 | #define IMU_COMPASS 2 |
inky | 0:4a75d653c18c | 85 | #define IMU_ACCELEROMETER 4 |
inky | 0:4a75d653c18c | 86 | |
inky | 0:4a75d653c18c | 87 | |
inky | 0:4a75d653c18c | 88 | #endif // indef __MSG_H__ |
inky | 0:4a75d653c18c | 89 | |
inky | 0:4a75d653c18c | 90 | // end of file |