00001 /**************************************************************** 00002 * 00003 * Copyright (c) 2011 00004 * All rights reserved. 00005 * 00006 * Hochschule Bonn-Rhein-Sieg 00007 * University of Applied Sciences 00008 * Computer Science Department 00009 * 00010 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00011 * 00012 * Author: 00013 * Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov 00014 * Supervised by: 00015 * Gerhard K. Kraetzschmar 00016 * 00017 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00018 * 00019 * This sofware is published under a dual-license: GNU Lesser General Public 00020 * License LGPL 2.1 and BSD license. The dual-license implies that users of this 00021 * code may choose which terms they prefer. 00022 * 00023 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00024 * 00025 * Redistribution and use in source and binary forms, with or without 00026 * modification, are permitted provided that the following conditions are met: 00027 * 00028 * * Redistributions of source code must retain the above copyright 00029 * notice, this list of conditions and the following disclaimer. 00030 * * Redistributions in binary form must reproduce the above copyright 00031 * notice, this list of conditions and the following disclaimer in the 00032 * documentation and/or other materials provided with the distribution. 00033 * * Neither the name of the Hochschule Bonn-Rhein-Sieg 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 2.1 of the 00040 * License, or (at your option) any later version or the BSD license. 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 and the BSD license for more details. 00046 * 00047 * You should have received a copy of the GNU Lesser General Public 00048 * License LGPL and BSD license along with this program. 00049 * 00050 ****************************************************************/ 00051 00052 #ifndef PROTOCOLDEFINITIONS_HPP 00053 #define PROTOCOLDEFINITIONS_HPP 00054 00055 namespace youbot { 00056 00057 //Opcodes of all TMCL commands that can be used in direct mode 00058 typedef enum TMCLCommandNumber { 00059 ROR = 1, //Rotate right 00060 ROL = 2, //Rotate left 00061 MST = 3, //Motor stop 00062 MVP = 4, //Move to position 00063 SAP = 5, //Set axis parameter 00064 GAP = 6, //Get axis parameter 00065 STAP = 7, //Store axis parameter into EEPROM 00066 RSAP = 8, //Restore axis parameter from EEPROM 00067 SGP = 9, //Set global parameter 00068 GGP = 10, //Get global parameter 00069 STGP = 11, //Store global parameter into EEPROM 00070 RSGP = 12, //Restore global parameter from EEPROM 00071 RFS = 13, 00072 SIO = 14, 00073 GIO = 15, 00074 SCO = 30, 00075 GCO = 31, 00076 CCO = 32, 00077 FIRMWARE_VERSION = 136 00078 } CommandNumber; 00079 00080 #define USER_VARIABLE_BANK 2 00081 00082 //Opcodes of TMCL control functions (to be used to run or abort a TMCL program in the module) 00083 #define TMCL_APPL_STOP 128 00084 #define TMCL_APPL_RUN 129 00085 #define TMCL_APPL_RESET 131 00086 00087 //Options for MVP commandds 00088 #define MVP_ABS 0 00089 #define MVP_REL 1 00090 #define MVP_COORD 2 00091 00092 //Options for RFS command 00093 #define RFS_START 0 00094 #define RFS_STOP 1 00095 #define RFS_STATUS 2 00096 00097 //Result codes for GetResult 00098 #define TMCL_RESULT_OK 0 00099 #define TMCL_RESULT_NOT_READY 1 00100 #define TMCL_RESULT_CHECKSUM_ERROR 2 00101 00102 enum YouBotJointControllerMode { 00103 MOTOR_STOP = 0, 00104 POSITION_CONTROL = 1, 00105 VELOCITY_CONTROL = 2, 00106 NO_MORE_ACTION = 3, 00107 SET_POSITION_TO_REFERENCE = 4, 00108 CURRENT_MODE = 6, 00109 INITIALIZE = 7 00110 }; 00111 00112 enum TMCLModuleAddress { 00113 DRIVE = 0, 00114 GRIPPER = 1 00115 }; 00116 00117 /* 00118 enum ProcessDataErrorFlags { 00119 OVER_CURRENT = 1, 00120 UNDER_VOLTAGE = 2, 00121 OVER_VOLTAGE = 4, 00122 OVER_TEMPERATURE = 8, 00123 HALTED = 16, 00124 HALL_SENSOR = 32, 00125 ENCODER = 64, 00126 MOTOR_WINDING = 128, 00127 CYCLE_TIME_VIOLATION = 256, 00128 INIT_SIN_COMM = 512, 00129 }; 00130 */ 00131 00132 enum MailboxErrorFlags { 00133 OVER_CURRENT = 0x1, 00134 UNDER_VOLTAGE = 0x2, 00135 OVER_VOLTAGE = 0x4, 00136 OVER_TEMPERATURE = 0x8, 00137 MOTOR_HALTED = 0x10, 00138 HALL_SENSOR_ERROR = 0x20, 00139 // ENCODER_ERROR = 0x40, 00140 // INITIALIZATION_ERROR = 0x80, 00141 // PWM_MODE_ACTIVE = 0x100, 00142 VELOCITY_MODE = 0x200, 00143 POSITION_MODE = 0x400, 00144 TORQUE_MODE = 0x800, 00145 // EMERGENCY_STOP = 0x1000, 00146 // FREERUNNING = 0x2000, 00147 POSITION_REACHED = 0x4000, 00148 INITIALIZED = 0x8000, 00149 TIMEOUT = 0x10000, 00150 I2T_EXCEEDED = 0x20000 00151 00152 }; 00153 00154 00155 enum YouBotMailboxStatusFlags { 00156 NO_ERROR = 100, 00157 INVALID_COMMAND = 2, 00158 WRONG_TYPE = 3, 00159 INVALID_VALUE = 4, 00160 CONFIGURATION_EEPROM_LOCKED = 5, 00161 COMMAND_NOT_AVAILABLE = 6, 00162 REPLY_WRITE_PROTECTED = 8 00163 }; 00164 00165 enum ParameterType { 00166 MOTOR_CONTOLLER_PARAMETER, 00167 API_PARAMETER 00168 }; 00169 00170 enum GripperErrorFlags { 00171 STALL_GUARD_STATUS = 0x1, 00172 GRIPPER_OVER_TEMPERATURE = 0x2, 00173 PRE_WARNING_OVER_TEMPERATURE = 0x4, 00174 SHORT_TO_GROUND_A = 0x8, 00175 SHORT_TO_GROUND_B = 0x10, 00176 OPEN_LOAD_A = 0x20, 00177 OPEN_LOAD_B = 0x40, 00178 STAND_STILL = 0x80 00179 }; 00180 00181 } // namespace youbot 00182 00183 #endif /* PROTOCOLDEFINITIONS_HPP */ 00184