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 00058 //Opcodes of all TMCL commands that can be used in direct mode 00059 typedef enum TMCLCommandNumber 00060 { 00061 ROR = 1, //Rotate right 00062 ROL = 2, //Rotate left 00063 MST = 3, //Motor stop 00064 MVP = 4, //Move to position 00065 SAP = 5, //Set axis parameter 00066 GAP = 6, //Get axis parameter 00067 STAP = 7, //Store axis parameter into EEPROM 00068 RSAP = 8, //Restore axis parameter from EEPROM 00069 SGP = 9, //Set global parameter 00070 GGP = 10, //Get global parameter 00071 STGP = 11, //Store global parameter into EEPROM 00072 RSGP = 12, //Restore global parameter from EEPROM 00073 RFS = 13, SIO = 14, GIO = 15, SCO = 30, GCO = 31, CCO = 32, FIRMWARE_VERSION = 136 00074 } CommandNumber; 00075 00076 #define USER_VARIABLE_BANK 2 00077 00078 //Opcodes of TMCL control functions (to be used to run or abort a TMCL program in the module) 00079 #define TMCL_APPL_STOP 128 00080 #define TMCL_APPL_RUN 129 00081 #define TMCL_APPL_RESET 131 00082 00083 //Options for MVP commandds 00084 #define MVP_ABS 0 00085 #define MVP_REL 1 00086 #define MVP_COORD 2 00087 00088 //Options for RFS command 00089 #define RFS_START 0 00090 #define RFS_STOP 1 00091 #define RFS_STATUS 2 00092 00093 //Result codes for GetResult 00094 #define TMCL_RESULT_OK 0 00095 #define TMCL_RESULT_NOT_READY 1 00096 #define TMCL_RESULT_CHECKSUM_ERROR 2 00097 00098 enum YouBotJointControllerMode 00099 { 00100 MOTOR_STOP = 0, POSITION_CONTROL = 1, VELOCITY_CONTROL = 2, NO_MORE_ACTION = 3, SET_POSITION_TO_REFERENCE = 4, 00101 CURRENT_MODE = 6, INITIALIZE = 7 00102 }; 00103 00104 enum TMCLModuleAddress 00105 { 00106 DRIVE = 0, GRIPPER = 1 00107 }; 00108 00109 /* 00110 enum ProcessDataErrorFlags { 00111 OVER_CURRENT = 1, 00112 UNDER_VOLTAGE = 2, 00113 OVER_VOLTAGE = 4, 00114 OVER_TEMPERATURE = 8, 00115 HALTED = 16, 00116 HALL_SENSOR = 32, 00117 ENCODER = 64, 00118 MOTOR_WINDING = 128, 00119 CYCLE_TIME_VIOLATION = 256, 00120 INIT_SIN_COMM = 512, 00121 }; 00122 */ 00123 00124 enum MailboxErrorFlags 00125 { 00126 OVER_CURRENT = 0x1, UNDER_VOLTAGE = 0x2, OVER_VOLTAGE = 0x4, OVER_TEMPERATURE = 0x8, MOTOR_HALTED = 0x10, 00127 HALL_SENSOR_ERROR = 0x20, 00128 // ENCODER_ERROR = 0x40, 00129 // INITIALIZATION_ERROR = 0x80, 00130 // PWM_MODE_ACTIVE = 0x100, 00131 VELOCITY_MODE = 0x200, POSITION_MODE = 0x400, TORQUE_MODE = 0x800, 00132 // EMERGENCY_STOP = 0x1000, 00133 // FREERUNNING = 0x2000, 00134 POSITION_REACHED = 0x4000, INITIALIZED = 0x8000, TIMEOUT = 0x10000, I2T_EXCEEDED = 0x20000 00135 00136 }; 00137 00138 enum YouBotMailboxStatusFlags 00139 { 00140 NO_ERROR = 100, INVALID_COMMAND = 2, WRONG_TYPE = 3, INVALID_VALUE = 4, CONFIGURATION_EEPROM_LOCKED = 5, 00141 COMMAND_NOT_AVAILABLE = 6, REPLY_WRITE_PROTECTED = 8 00142 }; 00143 00144 enum ParameterType 00145 { 00146 MOTOR_CONTOLLER_PARAMETER, API_PARAMETER 00147 }; 00148 00149 enum GripperErrorFlags 00150 { 00151 STALL_GUARD_STATUS = 0x1, GRIPPER_OVER_TEMPERATURE = 0x2, PRE_WARNING_OVER_TEMPERATURE = 0x4, SHORT_TO_GROUND_A = 0x8, 00152 SHORT_TO_GROUND_B = 0x10, OPEN_LOAD_A = 0x20, OPEN_LOAD_B = 0x40, STAND_STILL = 0x80 00153 }; 00154 00155 } // namespace youbot 00156 00157 #endif /* PROTOCOLDEFINITIONS_HPP */ 00158