00001 00002 00003 #define OMNICOM_MAGIC_VERSION 1002 00004 00005 /* Data we read from the EtherCAT slaves */ 00006 typedef struct omniread { 00007 int16_t magic_version; // magic number to prevent version clashes 00008 int16_t torque[4]; // currently not filled in kernel module 00009 uint32_t pkg_count; // Set in omnidrive kernel module 00010 00011 // P0344 == 0x4158: torque actual value (this is what we use) 00012 // P0508 == 0x41fc: calculated motor torque actual value 00013 uint16_t status[4]; 00014 uint32_t position[4]; // P0362 -> 0x41CE 00015 00016 // NO CHANGES BEFORE THIS LINE ////////////////////////////////////////////////////// 00017 00018 uint32_t angle[4]; // P0391 -> 0x4187 00019 00020 int32_t actual_velocity[4]; // P0353 -> 0x606c 00021 00022 int16_t speed_ctrlr_output[4]; // P0356 -> 0x4164 00023 uint32_t revolutions[4]; // P0392 -> 0x4188 00024 int16_t torque_actual_value[4]; // P0333 -> 0x414d, Iq actual value. See manual page 13, figure 2. 00025 int32_t pos_ctrlr_output[4]; // P0351 -> 0x415F, Speed set value. See manual page 16, figure 5. 00026 00027 // ethercat states 00028 int slave_state[4]; 00029 int slave_online[4]; 00030 int slave_operational[4]; 00031 int master_link; 00032 int master_al_states; 00033 int master_slaves_responding; 00034 int working_counter; 00035 int working_counter_state; 00036 } omniread_t; 00037 00038 /* Data we write to the EtherCAT slaves */ 00039 typedef struct omniwrite { 00040 int16_t magic_version; // magic number to prevent version clashes 00041 uint32_t target_position[4]; // P0361 -> 0x4169, Torque set value. See manual page 17, figure 6. 00042 int16_t target_velocity[4]; 00043 int16_t torque_set_value[4]; // P0331 -> 0x414b, Skips speed controller. See manual page 12, figure 1. 00044 00045 int16_t torque_add_set_value[4]; // P1022 -> 0x43fe, Torque additional set value, see manual page 403 and 13. 00046 } omniwrite_t; 00047 00048 // realtime interface 00049 00050 void omni_write_data(struct omniwrite data); 00051 struct omniread omni_read_data(); 00052 00053 int start_omni_realtime(int max_vel); 00054 void stop_omni_realtime();