Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
DynaServoAX12.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Dynamixel
4 //
5 // Library: libDynamixel
6 //
7 // File: DynaServoAX12.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2015-01-12 10:56:06 -0700 (Mon, 12 Jan 2015) $
12  * $Rev: 3845 $
13  *
14  * \brief AX-12, AX-12+, and AX-12A Dynamixel servo class.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  *
18  * \copyright
19  * \h_copy 2011-2017. RoadNarrows LLC.\n
20  * http://www.roadnarrows.com\n
21  * All Rights Reserved
22  */
23 /*
24  * @EulaBegin@
25  *
26  * Unless otherwise stated explicitly, all materials contained are copyrighted
27  * and may not be used without RoadNarrows LLC's written consent,
28  * except as provided in these terms and conditions or in the copyright
29  * notice (documents and software) or other proprietary notice provided with
30  * the relevant materials.
31  *
32  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
33  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
34  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
35  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
36  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
37  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
40  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
41  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
42  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
43  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
44  *
45  * @EulaEnd@
46  */
47 ////////////////////////////////////////////////////////////////////////////////
48 
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <libgen.h>
52 #include <string.h>
53 #include <stdarg.h>
54 
55 #include "rnr/rnrconfig.h"
56 #include "rnr/log.h"
57 #include "rnr/new.h"
58 #include "rnr/units.h"
59 
60 #include "Dynamixel/Dynamixel.h"
61 #include "Dynamixel/AX.h"
62 #include "Dynamixel/DynaError.h"
63 #include "Dynamixel/DynaComm.h"
64 #include "Dynamixel/DynaServo.h"
67 
68 #include "DynaLibInternal.h"
69 
70 
71 // ---------------------------------------------------------------------------
72 // Private Interface
73 // ---------------------------------------------------------------------------
74 
75 
76 // ---------------------------------------------------------------------------
77 // DynaServoAX12 Class
78 // ---------------------------------------------------------------------------
79 
80 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81 // Constructors and Destructors
82 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
83 
85  int nServoId,
86  uint_t uModelNum,
87  uint_t uFwVer) :
88  DynaServoGeneric(comm)
89 {
90  Init(nServoId, uFwVer); // this class
91  SyncData(); // generic
92  CheckData(); // generic
93 }
94 
96 {
97 }
98 
99 
100 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
101 // Servo Read/Write Functions
102 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
103 
104 
105 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
106 // Protected Interface
107 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
108 
109 void DynaServoAX12::Init(int nServoId, uint_t uFwVer)
110 {
111  DynaServo::Init(nServoId, DYNA_MODEL_NUM, uFwVer);
112 
113  InitSpec(); // this class
114  InitCfg(); // generic
115  InitState(); // generic
116 }
117 
119 {
120  //
121  // Fixed servo specification.
122  //
123  if( m_spec.m_sModelName != NULL )
124  {
125  delete[] m_spec.m_sModelName;
126  }
127 
128  // physical and fixed features
129  m_spec.m_sModelName = newstr("AX-12");
147 
148  // raw units
160 }
DynaServoAX12(DynaComm &comm)
Bare-bones initialization constructor.
Definition: DynaServoAX12.h:91
RoadNarrows Dynamixel Bus Communications Abstract Base Class Interface.
#define DYNA_AX12_SPEC_GEAR_RATIO
gear reduction ratio : 1
Definition: AX.h:88
RoadNarrows AX Series Dynamixel Declarations.
char * newstr(const char *s)
Allocate new duplicated string.
#define DYNA_AX12_SPEC_ANGLE_MIN_DEG
minimum rotation angle in servo mode (deg)
Definition: AX.h:96
#define DYNA_TORQUE_MAX_RAW
maximum raw torque
Definition: Dynamixel.h:282
double m_fMaxSpeed
max no-load speed (rpm) at optimal power
Definition: DynaTypes.h:91
uint_t m_uRawVoltMin
minimum raw voltage value
Definition: DynaTypes.h:110
#define DYNA_AX12_SPEC_ANGLE_MAX_DEG
maximum rotation angle in servo mode (deg)
Definition: AX.h:99
#define DYNA_POS_MIN_RAW
minimum raw angular position
Definition: Dynamixel.h:244
#define DYNA_TEMP_MIN_RAW
minimum raw temperature
Definition: Dynamixel.h:295
double m_fHeight
height (mm)
Definition: DynaTypes.h:86
uint_t m_uRawPosMin
minimum raw position value (servo mode)
Definition: DynaTypes.h:101
uint_t m_uRawSpeedMax
maximum raw speed magnitude value
Definition: DynaTypes.h:105
#define DYNA_AX12_SPEC_MODES
supported modes (see Dynamixel Operational Modes)
Definition: AX.h:102
#define DYNA_VOLT_MAX_RAW
maximum raw temperature
Definition: Dynamixel.h:309
double m_fVoltMax
maximum operational voltage (V)
Definition: DynaTypes.h:99
#define DYNA_AX12_SPEC_MAX_SPEED_RPM
maximum no-load speed (rpm) at optimal power
Definition: AX.h:93
uint_t m_uRawSpeedMin
minimum raw speed magnitude value
Definition: DynaTypes.h:104
RoadNarrows AX-12, AX-12+, AX-12A Dynamixel Servo Class Interface.
Generic Dynamixel Servo Base Class Interface.
#define DYNA_SPEED_MIN_RAW
minimum raw value
Definition: Dynamixel.h:265
#define DYNA_AX12_SPEC_WEIGHT_G
weight (grams)
Definition: AX.h:82
virtual ~DynaServoAX12()
Destructor.
double m_fDepth
depth (mm)
Definition: DynaTypes.h:87
void Init()
Initialize servo class instance.
uint_t m_uCtlMethodUsed
Dynamixel Internal Position Control Methods
Definition: DynaTypes.h:100
double m_fVoltMin
minimum operational voltage (V)
Definition: DynaTypes.h:98
double m_fAngleMin
min rotation angle in servo mode (deg)
Definition: DynaTypes.h:92
#define DYNA_AX12_SPEC_HEIGHT_MM
height (mm)
Definition: AX.h:84
double m_fGearRedectionRatio
gear reduction ratio
Definition: DynaTypes.h:89
double m_fWeight
weight (grams)
Definition: DynaTypes.h:84
uint_t m_uSupportedModes
Dynamixel Operational Modes
Definition: DynaTypes.h:94
#define DYNA_POS_MODULO
servo position modulo [0-max]
Definition: Dynamixel.h:246
uint_t m_uRawPosModulo
raw position modulo
Definition: DynaTypes.h:103
#define DYNA_AX12_SPEC_DEPTH_MM
depth (mm)
Definition: AX.h:85
#define DYNA_AX12_SPEC_VOLT_MAX_V
maximum operational voltage (V)
Definition: AX.h:117
double m_fResolution
resolution (degrees)
Definition: DynaTypes.h:88
#define DYNA_TORQUE_MIN_RAW
minimum raw torque
Definition: Dynamixel.h:281
uint_t m_uRawTorqueMin
minimum raw torque value
Definition: DynaTypes.h:106
The libDynamixel internal declarations.
#define DYNA_AX12_SPEC_HAS_360_POS
servo does not provide 360 &deg; position data
Definition: AX.h:105
char * m_sModelName
model name
Definition: DynaTypes.h:83
#define DYNA_AX12_SPEC_POS_RES_DEG
resolution (degrees)
Definition: AX.h:87
#define DYNA_AX12_SPEC_TEMP_MIN_C
minimum recommended operational temperature (C)
Definition: AX.h:108
Generic Dynamixel Servo Base Class.
uint_t m_uRawTempMin
minimum raw temperature value
Definition: DynaTypes.h:108
#define DYNA_AX12_SPEC_CTL_METHOD
position control method (see Dynamixel Internal Position Control Methods)
Definition: AX.h:120
double m_fTempMin
minimum operational temperature (C)
Definition: DynaTypes.h:96
void InitCfg()
Initialize servo configuration data.
uint_t m_uRawTorqueMax
maximum raw torque value
Definition: DynaTypes.h:107
void InitState()
Initialize servo state data.
#define DYNA_TEMP_MAX_RAW
maximum raw temperature
Definition: Dynamixel.h:296
void Init(int nServoId, uint_t uModelNum, uint_t uFwVer)
Initialize servo class instance.
Definition: DynaServo.cxx:406
RoadNarrows Dynamixel Archetype Servo Abstract Base Class.
virtual void CheckData()
Check data for consitencies.
#define DYNA_VOLT_MIN_RAW
minimum raw temperature
Definition: Dynamixel.h:308
#define DYNA_POS_MAX_RAW
maximum raw angular position
Definition: Dynamixel.h:245
double m_fTempMax
maximum operational temperature (C)
Definition: DynaTypes.h:97
virtual int SyncData()
Synchronize the shadowed configuration and state data to the servo control table. ...
RoadNarrows Dynamixel Top-Level Package Header File.
#define DYNA_AX12_SPEC_STALL_TORQUE_KGF
maximum stall torque (kgf) at optimal power
Definition: AX.h:90
#define DYNA_AX12_SPEC_WIDTH_MM
width (mm)
Definition: AX.h:83
uint_t m_uRawPosMax
maximum raw position value (servo mode)
Definition: DynaTypes.h:102
DynaServoSpec_T m_spec
servo specification
Definition: DynaServo.h:837
uint_t m_uRawTempMax
maximum raw temperature value
Definition: DynaTypes.h:109
double m_fStallTorque
max stall torque (kgf) at optimal power
Definition: DynaTypes.h:90
#define DYNA_SPEED_MAX_RAW
maximum raw value
Definition: Dynamixel.h:266
double m_fWidth
width (mm)
Definition: DynaTypes.h:85
double m_fAngleMax
max rotation angle in servo mode (deg)
Definition: DynaTypes.h:93
void InitSpec()
Initialize servo fixed specification data.
bool m_bHas360Pos
does [not] have full 360 position info
Definition: DynaTypes.h:95
uint_t m_uRawVoltMax
maximum raw voltage value
Definition: DynaTypes.h:111
RoadNarrows Dynamixel Library Error and Logging Routines.
#define DYNA_AX12_SPEC_TEMP_MAX_C
maximum recommended operational temperature (C)
Definition: AX.h:111
#define DYNA_AX12_SPEC_VOLT_MIN_V
minimum operational voltage (V)
Definition: AX.h:114
Dynamixel Bus Communications Abstract Base Class.
Definition: DynaComm.h:80