0240_palm_edc_IMU_ethercat_protocol.h
Go to the documentation of this file.
1 //
2 // © 2010 Shadow Robot Company Limited.
3 //
4 // FileName: this_node.h
5 // Dependencies:
6 // Processor: PIC32
7 // Compiler: MPLAB® C32
8 //
9 // +------------------------------------------------------------------------+
10 // | This file is part of The Shadow Robot PIC32 firmware code base. |
11 // | |
12 // | It is free software: you can redistribute it and/or modify |
13 // | it under the terms of the GNU General Public License as published by |
14 // | the Free Software Foundation, either version 3 of the License, or |
15 // | (at your option) any later version. |
16 // | |
17 // | It is distributed in the hope that it will be useful, |
18 // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 // | GNU General Public License for more details. |
21 // | |
22 // | You should have received a copy of the GNU General Public License |
23 // | along with this code repository. The text of the license can be found |
24 // | in Pic32/License/gpl.txt. If not, see <http://www.gnu.org/licenses/>. |
25 // +------------------------------------------------------------------------+
26 //
27 //
28 //
29 // Doxygen
30 // -------
31 //
42 //
43 
44 #ifndef PALM_EDC_0240_ETHERCAT_PROTOCOL_H_INCLUDED
45 #define PALM_EDC_0240_ETHERCAT_PROTOCOL_H_INCLUDED
46 
47 #include "../0220_palm_edc/0220_palm_edc_ethercat_protocol.h"
48 
49 #define IMU_COMMAND_NONE 0
50 #define IMU_COMMAND_SET_SCALE 1
51 
52 typedef struct
53 {
55  int8u argument[2];
57 
59 typedef struct
60 {
61  EDC_COMMAND EDC_command;
62 
66  int16u sensors[SENSORS_NUM_0220+1];
67 
68  FROM_MOTOR_DATA_TYPE motor_data_type;
69  int16s which_motors;
72 
75  int32u which_motor_data_arrived;
76  int32u which_motor_data_had_errors;
77 
78  MOTOR_DATA_PACKET motor_data_packet[10];
79 
80  int32u tactile_data_type;
81  int16u tactile_data_valid;
82  TACTILE_SENSOR_STATUS_v1 tactile[5]; //
83 
84  int16u idle_time_us;
85 
87 } __attribute__((packed)) ETHERCAT_DATA_STRUCTURE_0240_PALM_EDC_STATUS;
88 
89 
91 typedef struct
92 {
93  EDC_COMMAND EDC_command;
94 
95  FROM_MOTOR_DATA_TYPE from_motor_data_type;
96  int16s which_motors;
97 
99  TO_MOTOR_DATA_TYPE to_motor_data_type;
100  int16s motor_data[NUM_MOTORS];
101 
102  int32u tactile_data_type;
103  IMU_COMMAND_TYPE imu_command; // Command to configure the IMU
104 
105 } __attribute__((packed)) ETHERCAT_DATA_STRUCTURE_0240_PALM_EDC_COMMAND;
106 
107 /*
108 #define ETHERCAT_COMMAND_HEADER_SIZE ( sizeof(EDC_COMMAND) \ //!< What's the minimum amount of
109  + sizeof(FROM_MOTOR_DATA_TYPE) \
110  + sizeof(int16s) )
111 */
112 
113 #define PALM_0240_ETHERCAT_COMMAND_HEADER_SIZE ( sizeof(EDC_COMMAND) + sizeof(FROM_MOTOR_DATA_TYPE) + sizeof(int16s) )
114 
115 #define PALM_0240_ETHERCAT_STATUS_DATA_SIZE sizeof(ETHERCAT_DATA_STRUCTURE_0240_PALM_EDC_STATUS)
116 #define PALM_0240_ETHERCAT_COMMAND_DATA_SIZE sizeof(ETHERCAT_DATA_STRUCTURE_0240_PALM_EDC_COMMAND)
117 
118  // Now we need to be *sure* that the Host and the Slave definitely
119  // agree on the size of the EtherCAT packets, even if the host is a
120  // 64-bit machine or something. So we have these calculated sizes.
121  // The host and slave can ASSERT that the sizeof() the packets
122  // matches the agreed sizes.
123 #define ETHERCAT_STATUS_0240_AGREED_SIZE 232
124 #define ETHERCAT_COMMAND_0240_AGREED_SIZE 74
125 
126 
127 
138 
139 #define PALM_0240_ETHERCAT_COMMAND_DATA_ADDRESS 0x1000
140 #define PALM_0240_ETHERCAT_CAN_BRIDGE_DATA_COMMAND_ADDRESS (PALM_0240_ETHERCAT_COMMAND_DATA_ADDRESS + PALM_0240_ETHERCAT_COMMAND_DATA_SIZE)
141 
142 #define PALM_0240_ETHERCAT_STATUS_DATA_ADDRESS (PALM_0240_ETHERCAT_CAN_BRIDGE_DATA_COMMAND_ADDRESS + ETHERCAT_CAN_BRIDGE_DATA_SIZE)
143 #define PALM_0240_ETHERCAT_CAN_BRIDGE_DATA_STATUS_ADDRESS (PALM_0240_ETHERCAT_STATUS_DATA_ADDRESS + PALM_0240_ETHERCAT_STATUS_DATA_SIZE)
144 
145 //#define NUM_CONFIGS_REQUIRED 5
146 
147 
148 #endif
unsigned short int16u
This needs to be a #define for symmetry with SENSORS_NUM.
unsigned int int32u
unsigned char int8u
EDC_COMMAND
The host can request different types of data from the palm.
#define SENSORS_NUM_0220
signed short int16s


sr_external_dependencies
Author(s): Ugo Cupcic
autogenerated on Mon Feb 28 2022 23:50:40