83 #ifndef DYNAMIXEL_INTERFACE_DRIVER_H_ 84 #define DYNAMIXEL_INTERFACE_DRIVER_H_ 89 #include <unordered_map> 156 bool use_legacy_protocol =
false,
bool use_group_read =
true,
bool use_group_write =
true);
163 bool initialise(
void);
168 bool ping(
int servo_id)
const;
173 auto it = model_specs_.find(model_number);
174 if (it != model_specs_.end())
176 return &(it->second);
190 bool getModelNumber(
int servo_id, uint16_t *
model_number)
const;
218 bool getTargetTorque(
int servo_id,
DynamixelSeriesType type, int16_t *target_torque)
const;
226 bool readRegisters(
int servo_id, uint16_t address, uint16_t length, std::vector<uint8_t> *
response)
const;
236 bool getBulkState(std::unordered_map<int, DynamixelState> &state_map)
const;
241 bool getBulkDataportInfo(std::unordered_map<int, DynamixelDataport> &data_map)
const;
246 bool getBulkDiagnosticInfo(std::unordered_map<int, DynamixelDiagnostic> &diag_map)
const;
267 bool setAngleLimits(
int servo_id,
DynamixelSeriesType type, int32_t min_angle, int32_t max_angle)
const;
341 bool setPositionPIDGains(
int servo_id,
DynamixelSeriesType type,
double p_gain,
double i_gain,
double d_gain)
const;
348 bool setPositionProportionalGain(
int servo_id,
DynamixelSeriesType type, uint16_t gain)
const;
362 bool setPositionDerivativeGain(
int servo_id,
DynamixelSeriesType type, uint16_t gain)
const;
371 bool setVelocityPIDGains(
int servo_id,
DynamixelSeriesType type,
double p_gain,
double i_gain)
const;
378 bool setVelocityProportionalGain(
int servo_id,
DynamixelSeriesType type, uint16_t gain)
const;
408 bool writeRegisters(
int servo_id, uint16_t address, uint16_t length, uint8_t *data)
const;
415 bool setMultiPosition(std::unordered_map<int, SyncData> &position_data)
const;
420 bool setMultiVelocity(std::unordered_map<int, SyncData> &velocity_data)
const;
425 bool setMultiProfileVelocity(std::unordered_map<int, SyncData> &velocity_data)
const;
430 bool setMultiTorque(std::unordered_map<int, SyncData> &torque_data)
const;
437 std::string series_name =
"undefined";
453 series_name =
"Legacy MX";
465 series_name =
"Legacy Pro";
474 bool loadMotorData(
void);
484 bool bulkRead(std::unordered_map<int, SyncData*> &read_data, uint16_t address, uint16_t length)
const;
493 bool syncRead(std::unordered_map<int, SyncData*> &read_data, uint16_t address, uint16_t length)
const;
503 bool syncWrite(std::unordered_map<int, SyncData> &write_data, uint16_t address, uint16_t length)
const;
516 bool initialised_ =
false;
525 #endif // DYNAMIXEL_INTERFACE_DRIVER_H_
int32_t effort
effort register value, units differ by series
int32_t position
position register value, units differ by series
Struct that describes the dynamixel motor's static and physical properties.
int32_t temperature
temperature register value, usually units of 0.1C
std::unique_ptr< dynamixel::PortHandler > portHandler_
The port handler object. The dynamixel sdk serial object.
data struct used with getBulkDataportInfo() to retrieve dataport values
data struct used with getBulkDiagnosticInfo() to retrieve diagnostics
bool external_ports
If this model has data ports.
int32_t velocity
velocity register value, units differ by series
std::unique_ptr< dynamixel::PacketHandler > packetHandler_
packet handler. Provides raw response deconstruction.
std::string device_
name of device to open
const DynamixelSpec * getModelSpec(uint model_number) const
Get pointer to model spec data for given model number.
std::string getSeriesName(DynamixelSeriesType type) const
DynamixelSeriesType
Dynamixel types.
int32_t voltage
voltage register value, usually units of 0.1V
double velocity_radps_to_reg
Conversion factor from velocity in radians/sec to register counts.
bool success
bool indicating comms success
Defines the register address tables for each series of dynamixel, as well as the control and status c...
bool use_group_write_
using monolothic syncWrite for bulk data exchange
std::unordered_map< uint16_t, const DynamixelSpec > model_specs_
map of model numbers to motor specifications
uint16_t model_number
Model number (e.g 29 = MX-28)
std::string name
The Model Name.
bool use_group_read_
using monolothic bulkRead or syncRead for bulk data exchange
DynamixelSeriesType type
Model type (e.g MX, AX, Pro)
Basic struct for representing dynamixel data exchange.
double encoder_range_deg
Motor encoder range in degrees.
int encoder_cpr
Motor encoder counts per revolution.
uint8_t single_read_fallback_counter_
indicates group comm failure fallback interval
double effort_reg_max
Max possible value for effort register.
double effort_reg_to_mA
Conversion factor from register values to current in mA.
std::unordered_map< int, std::vector< uint8_t > > raw_read_map_
map to store raw reads into
data struct used with getBulkState() to retrieve physical state
DynamixelSeriesType type
type of dynamixel
std::vector< uint8_t > data
IO data array.
std::array< uint16_t, 4 > port_values
values from dataports, units differ by series and dataport setting
const std::string response
bool use_legacy_protocol_
if we are using legacy 1.0 protocol or newer 2.0 protocol (depends on model support) ...