/* * $Id: AX12.h,v 1.3 2010/06/14 19:14:07 clivewebster Exp $ * * Revision History * ================ * $Log: AX12.h,v $ * Revision 1.3 2010/06/14 19:14:07 clivewebster * Add copyright license info * * Revision 1.2 2010/03/24 19:49:27 clivewebster * Alpha release * * Revision 1.1 2010/03/08 17:05:57 clivewebster * *** empty log message *** * * =========== * * Copyright (C) 2010 Clive Webster ([email protected]) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * * AX12.h * * Created on: 24 Feb 2010 * Author: Clive Webster * * Dynamixel AX-12 Servo * See: http://www.trossenrobotics.com/dynamixel-ax-12-robot-actuator.aspx * Voltage: 7v to 10v recommended=9.6 * Current: 50mA to 0.9Amps(max) * * *** This is not tested as I don't have one **** */

// The data type used to return from ax12Infotypedef struct s_ax12_info {DRIVE_SPEEDspeed;// current servo position/motor speed: DRIVE_SPEED_MIN to DRIVE_SPEED_MAXint16_tload;// Present load -0x3ff to +0x3ffuint8_tvoltage;// In tenths of a voltuint8_ttemperature;// In celsiusbooleanbatch;// Are we sending a command batch?booleanmoving;// Is the servo movingint8_trpm;// The current RPM: -114 to +114} AX12_INFO;

// The infomation about one servotypedef struct s_dynamixel_ax12 {__ACTUATOR actuator;// has all the common stuffstruct s_dynamixel_ax12_driver* driver;// The driver it is attached to, set by init'ing the driveruint8_tid;// unique Id 0-0xfd, 0xfe is reserved for broadcastbooleancontinuous;// Is it a continuous rotation (ie a motor)AX12_INFOinfo;// The current settings} DYNAMIXEL_AX12;

typedef struct s_dynamixel_ax12_driver{const DYNAMIXEL_AX12_LIST* const servos;// The servosuint8_t num_servos; // The total number of servosHW_UART* ax12uart;// The hardware UART to use (must be h/w as baud=1,000,000const IOPin* directionPin;// Pin for changing xmit/receive buffersuint8_twriteCmd;// The current write command} DYNAMIXEL_AX12_DRIVER;

// Error return codes#define AX12_RECV_LEN 0x1000/* we received an invalid length*/#define AX12_RECV_ID 0x800/* we received an invalid servo id*/#define AX12_RECV_HEADER 0x400/* we received an invalid header*/#define AX12_RECV_CHECKSUM 0x200/* we received an invalid checksum*/#define AX12_RECV_TIMEOUT 0x100/* we timed out when receiving */#define AX12_ERROR_INSTRUCTION 0x40 /* undefined instruction */#define AX12_ERROR_OVERLOAD 0x20 /* the maximum torque cannot drive the load */#define AX12_ERROR_CHECKSUM 0x10/* we sent the wrong checksum to the AX12 */#define AX12_ERROR_RANGE 0x8/* the instruction range was invalid */#define AX12_ERROR_OVERHEAT 0x4/* the servo is overheating */#define AX12_ERROR_ANGLE 0x2/* the angle is out of range */#define AX12_ERROR_VOLTAGE 0x1/* the voltage is out of range */

// Get the actual speed/position of the servoDRIVE_SPEED getActualSpeed(void) const{return m_ax12->info.speed;}

// Get the current rotational speed -114 rpm to +114 rpmint8_tgetActualRPM(void) const{return m_ax12->info.rpm;}// Get the current load -0x3ff to +0x3ffint16_tgetActualLoad(void) const{return m_ax12->info.load;}// In tenths of a voltuint8_tgetActualVoltage(void) const{return m_ax12->info.voltage;}// Get temperature in celsiusuint8_tgetActualTemperature(void) const{return m_ax12->info.temperature;}// Is the servo moving?booleangetActualIsMoving(void) const{return m_ax12->info.moving;}

/* * $Id: AX12.h,v 1.3 2010/06/14 19:14:07 clivewebster Exp $ * * Revision History * ================ * $Log: AX12.h,v $ * Revision 1.3 2010/06/14 19:14:07 clivewebster * Add copyright license info * * Revision 1.2 2010/03/24 19:49:27 clivewebster * Alpha release * * Revision 1.1 2010/03/08 17:05:57 clivewebster * *** empty log message *** * * =========== * * Copyright (C) 2010 Clive Webster ([email protected]) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * * AX12.h * * Created on: 24 Feb 2010 * Author: Clive Webster * * Dynamixel AX-12 Servo * See: http://www.trossenrobotics.com/dynamixel-ax-12-robot-actuator.aspx * Voltage: 7v to 10v recommended=9.6 * Current: 50mA to 0.9Amps(max) * * *** This is not tested as I don't have one **** */

// The data type used to return from ax12Infotypedef struct s_ax12_info {DRIVE_SPEEDspeed;// current servo position/motor speed: DRIVE_SPEED_MIN to DRIVE_SPEED_MAXint16_tload;// Present load -0x3ff to +0x3ffuint8_tvoltage;// In tenths of a voltuint8_ttemperature;// In celsiusbooleanbatch;// Are we sending a command batch?booleanmoving;// Is the servo movingint8_trpm;// The current RPM: -114 to +114} AX12_INFO;

// The infomation about one servotypedef struct s_dynamixel_ax12 {__ACTUATOR actuator;// has all the common stuffstruct s_dynamixel_ax12_driver* driver;// The driver it is attached to, set by init'ing the driveruint8_tid;// unique Id 0-0xfd, 0xfe is reserved for broadcastbooleancontinuous;// Is it a continuous rotation (ie a motor)AX12_INFOinfo;// The current settings} DYNAMIXEL_AX12;

typedef struct s_dynamixel_ax12_driver{const DYNAMIXEL_AX12_LIST* const servos;// The servosuint8_t num_servos; // The total number of servosHW_UART* ax12uart;// The hardware UART to use (must be h/w as baud=1,000,000const IOPin* directionPin;// Pin for changing xmit/receive buffersuint8_twriteCmd;// The current write command} DYNAMIXEL_AX12_DRIVER;

// Error return codes#define AX12_RECV_LEN 0x1000/* we received an invalid length*/#define AX12_RECV_ID 0x800/* we received an invalid servo id*/#define AX12_RECV_HEADER 0x400/* we received an invalid header*/#define AX12_RECV_CHECKSUM 0x200/* we received an invalid checksum*/#define AX12_RECV_TIMEOUT 0x100/* we timed out when receiving */#define AX12_ERROR_INSTRUCTION 0x40 /* undefined instruction */#define AX12_ERROR_OVERLOAD 0x20 /* the maximum torque cannot drive the load */#define AX12_ERROR_CHECKSUM 0x10/* we sent the wrong checksum to the AX12 */#define AX12_ERROR_RANGE 0x8/* the instruction range was invalid */#define AX12_ERROR_OVERHEAT 0x4/* the servo is overheating */#define AX12_ERROR_ANGLE 0x2/* the angle is out of range */#define AX12_ERROR_VOLTAGE 0x1/* the voltage is out of range */

// Get the actual speed/position of the servoDRIVE_SPEED getActualSpeed(void) const{return m_ax12->info.speed;}

// Get the current rotational speed -114 rpm to +114 rpmint8_tgetActualRPM(void) const{return m_ax12->info.rpm;}// Get the current load -0x3ff to +0x3ffint16_tgetActualLoad(void) const{return m_ax12->info.load;}// In tenths of a voltuint8_tgetActualVoltage(void) const{return m_ax12->info.voltage;}// Get temperature in celsiusuint8_tgetActualTemperature(void) const{return m_ax12->info.temperature;}// Is the servo moving?booleangetActualIsMoving(void) const{return m_ax12->info.moving;}

Assuming you are still using C++ then just call the dumpAll() method on the driver. ie probably something like:ax12_driver1.dumpAll();I say 'probably' as it depends on what name you've given the driver in Project Designer.Output will go to wherever you set the stdout to in the CodeGen from Project Designer.

Quote

These things are very cool.

Absolutely! If I had the money I would never buy any other sort of servo!