00001 /**************************************************************** 00002 * 00003 * Copyright (c) 2012 00004 * 00005 * Fraunhofer Institute for Manufacturing Engineering 00006 * and Automation (IPA) 00007 * 00008 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 * 00010 * Project name: CIN-Reha 00011 * ROS stack name: cob_drivers 00012 * ROS package name: cob_generic_can 00013 * Description: 00014 * 00015 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00016 * 00017 * Author: 00018 * Supervised by: 00019 * 00020 * Date of creation: Jan 2012 00021 * 00022 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00023 * 00024 * Redistribution and use in source and binary forms, with or without 00025 * modification, are permitted provided that the following conditions are met: 00026 * 00027 * * Redistributions of source code must retain the above copyright 00028 * notice, this list of conditions and the following disclaimer. 00029 * * Redistributions in binary form must reproduce the above copyright 00030 * notice, this list of conditions and the following disclaimer in the 00031 * documentation and/or other materials provided with the distribution. 00032 * * Neither the name of the Fraunhofer Institute for Manufacturing 00033 * Engineering and Automation (IPA) nor the names of its 00034 * contributors may be used to endorse or promote products derived from 00035 * this software without specific prior written permission. 00036 * 00037 * This program is free software: you can redistribute it and/or modify 00038 * it under the terms of the GNU Lesser General Public License LGPL as 00039 * published by the Free Software Foundation, either version 3 of the 00040 * License, or (at your option) any later version. 00041 * 00042 * This program is distributed in the hope that it will be useful, 00043 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00044 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00045 * GNU Lesser General Public License LGPL for more details. 00046 * 00047 * You should have received a copy of the GNU Lesser General Public 00048 * License LGPL along with this program. 00049 * If not, see <http://www.gnu.org/licenses/>. 00050 * 00051 ****************************************************************/ 00052 00053 #ifndef CANOpenCiA401_Objects_INCLUDEDEF_H 00054 #define CANOpenCiA401_Objects_INCLUDEDEF_H 00055 //----------------------------------------------- 00056 00057 /*=============================================== 00058 * Object structure 00059 00060 struct CANOpenObj 00061 { 00062 unsigned short Index; 00063 unsigned char SubIndex; 00064 unsigned char Format; 00065 }; 00066 00067 *=============================================*/ 00068 00069 class CANOpenCiA401ObjDirectory 00070 { 00071 public: 00072 00073 struct CANOpenObj 00074 { 00075 unsigned short Index; 00076 unsigned char SubIndex; 00077 unsigned char Format; //UInt8/Int8 == 0x2F; Uint16/Int16 == 0x2B; UInt32/Int32 == 0x23 00078 }; 00079 00080 #define Errorcue 5 00081 00082 CANOpenObj manufacturer_status_register; 00083 CANOpenObj pre_defined_error_field[Errorcue]; 00084 CANOpenObj producer_heartbeat_time; 00085 00086 00087 CANOpenObj controlword; 00088 CANOpenObj statusword; 00089 00090 CANOpenObj mode_of_operation; 00091 // modes of operation 00092 unsigned char POSITION_MODE; 00093 unsigned char VELOCITY_MODE; 00094 unsigned char TORQUE_MODE; 00095 unsigned char HOMING_MODE; 00096 unsigned char IP_MODE; //interpolated mode 00097 00098 CANOpenObj mode_of_operation_display; 00099 00100 CANOpenObj velocity_actual_value; 00101 CANOpenObj target_velocity; 00102 00103 CANOpenObj digital_inputs; 00104 00105 // constructor 00106 CANOpenCiA401ObjDirectory() 00107 { 00108 // 0x1000er mandatory objects 00109 pre_defined_error_field[0].Index = 0x1003; 00110 pre_defined_error_field[0].SubIndex = 0x00; 00111 pre_defined_error_field[0].Format = 0x2f; 00112 00113 pre_defined_error_field[1].Index = 0x1003; 00114 pre_defined_error_field[1].SubIndex = 0x01; 00115 pre_defined_error_field[1].Format = 0x23; 00116 00117 pre_defined_error_field[2].Index = 0x1003; 00118 pre_defined_error_field[2].SubIndex = 0x02; 00119 pre_defined_error_field[2].Format = 0x23; 00120 00121 pre_defined_error_field[3].Index = 0x1003; 00122 pre_defined_error_field[3].SubIndex = 0x03; 00123 pre_defined_error_field[3].Format = 0x23; 00124 00125 pre_defined_error_field[4].Index = 0x1003; 00126 pre_defined_error_field[4].SubIndex = 0x04; 00127 pre_defined_error_field[4].Format = 0x23; 00128 00129 manufacturer_status_register.Index = 0x1002; 00130 manufacturer_status_register.SubIndex = 0x00; 00131 manufacturer_status_register.Format = 0x23; 00132 00133 producer_heartbeat_time.Index = 0x1017; 00134 producer_heartbeat_time.SubIndex = 0x00; 00135 producer_heartbeat_time.Format = 0x2b; 00136 00137 // 0x6000er mandatory objects 00138 controlword.Index = 0x6040; 00139 controlword.SubIndex = 0x00; 00140 controlword.Format = 0x2b; 00141 00142 statusword.Index = 0x6041; 00143 statusword.SubIndex = 0x00; 00144 statusword.Format = 0x2b; 00145 00146 mode_of_operation.Index = 0x6060; 00147 mode_of_operation.SubIndex = 0x00; 00148 mode_of_operation.Format = 0x2f; 00149 00150 // modes of operation values 00151 POSITION_MODE = 0x1; 00152 VELOCITY_MODE = 0x3; 00153 TORQUE_MODE = 0x4; 00154 HOMING_MODE = 0x6; 00155 IP_MODE = 0x7; 00156 00157 mode_of_operation_display.Index = 0x6061; 00158 mode_of_operation_display.SubIndex = 0x00; 00159 mode_of_operation_display.Format = 0x2f; 00160 00161 velocity_actual_value.Index = 0x606c; 00162 velocity_actual_value.SubIndex = 0x00; 00163 velocity_actual_value.Format = 0x23; 00164 00165 target_velocity.Index = 0x60FF; 00166 target_velocity.SubIndex = 0x00; 00167 target_velocity.Format = 0x23; 00168 00169 digital_inputs.Index = 0x60FD; 00170 digital_inputs.SubIndex = 0x00; 00171 digital_inputs.Format = 0x23; 00172 } 00173 00174 // destructor 00175 ~CANOpenCiA401ObjDirectory() 00176 {} 00177 }; 00178 00179 00180 00181 //----------------------------------------------- 00182 #endif 00183