3#include "dynamixel_sdk/dynamixel_sdk.h"
7namespace uclv::dynamixel_utils
17 std::string serial_port_;
19 float protocol_version_;
21 uint16_t addrTargetPosition_ = 30;
22 uint16_t addrPresentPosition_ = 36;
24 uint16_t addrTorqueEnable_ = 24;
26 uint16_t lenAddrTargetPosition_ = 2;
27 uint16_t lenAddrPresentPosition_ = 2;
29 dynamixel::PortHandler *portHandler_;
30 dynamixel::PacketHandler *packetHandler_;
43 Motor(
const std::string &serial_port,
int baudrate,
float protocol_version,
44 dynamixel::PortHandler *
const &portHandler, dynamixel::PacketHandler *
const &packetHandler,
55 Motor(
const std::string &serial_port,
int baudrate,
float protocol_version,
70 void setId(uint8_t
id);
135 void setAddrTorqueEnable(uint16_t addrTorqueEnable);
137 uint16_t getAddrTorqueEnable()
const;
The Motor class represents a single motor connected to the system.
Definition motor.hpp:14
void write1OnAddress(uint8_t id, uint16_t address, uint8_t data)
Writes a byte to the specified address of the motor.
Definition motor.cpp:194
uint16_t getAddrPresentPosition() const
Gets the address for the present position.
Definition motor.cpp:116
uint8_t getId()
Gets the identifier of the motor.
Definition motor.cpp:80
bool enableTorque()
Enables torque for the motor.
Definition motor.cpp:270
uint16_t getAddrTargetPosition() const
Gets the address for the target position.
Definition motor.cpp:98
void setLenAddrPresentPosition(uint16_t lenAddrPresentPosition)
Sets the size (nr of bytes to write) for address of the present position.
Definition motor.cpp:143
void setLenAddrTargetPosition(uint16_t lenAddrTargetPosition)
Sets the size (nr of bytes to write) for address of the target position.
Definition motor.cpp:125
uint8_t read1FromAddress(uint8_t id, uint16_t address)
Reads a byte from the specified address of the motor.
Definition motor.cpp:230
void setAddrTargetPosition(uint16_t addrTargetPosition)
Sets the address for the target position.
Definition motor.cpp:89
uint16_t getLenAddrTargetPosition() const
Gets the size (nr of bytes to write) for address of the target position.
Definition motor.cpp:134
void write2OnAddress(uint8_t id, uint16_t address, uint16_t data)
Writes two bytes to the specified address of the motor.
Definition motor.cpp:212
void setTargetPosition(float position)
Sets the target position of the motor.
Definition motor.cpp:173
bool disableTorque()
Disables torque for the motor.
Definition motor.cpp:290
uint16_t readPresentPosition()
Reads the present position of the motor.
Definition motor.cpp:183
void setId(uint8_t id)
Sets the identifier of the motor.
Definition motor.cpp:71
uint16_t read2FromAddress(uint8_t id, uint16_t address)
Reads two bytes from the specified address of the motor.
Definition motor.cpp:250
void setAddrPresentPosition(uint16_t addrPresentPosition)
Sets the address for the present position.
Definition motor.cpp:107
uint16_t getLenAddrPresentPosition() const
Gets the size (nr of bytes to write) for address of the present position.
Definition motor.cpp:152
Motor()
Default constructor.
Definition motor.cpp:57