16 unsigned int baudrate,
266 bool addparam_success =
false;
277 if (abs(motor_vel) <= min_ticks){
289 (uint8_t*)&motor_vel);
290 if (!addparam_success)
294 int8_t comm_result_ = bulk_write.
txPacket();
309 bool addparam_success =
false;
315 (uint8_t*)&motor_pos);
316 if (!addparam_success)
320 int8_t comm_result_ = bulk_write.
txPacket();
343 const double FromTicks = 1.0 / (motor.
spec.
cpr / 2.0);
344 return static_cast<double>(M_PI-(ticks) * FromTicks * M_PI);
348 double cprDev2 = motor.
spec.
cpr / 2.0f;
349 return (static_cast<double>(ticks) - cprDev2) * M_PI / cprDev2;
353 const double FromTicks = 1.0 / (motor.
spec.
cpr / 2.0);
354 return static_cast<double>((ticks) * FromTicks * M_PI);
359 double cprDev2 = motor.
spec.
cpr / 2.0f;
360 return (static_cast<double>(ticks) - cprDev2) * M_PI / cprDev2;
369 return static_cast<int32_t
>(round((-rads *180.0/ M_PI+180.0)/ 0.088));
372 double cprDev2 = motor.
spec.
cpr / 2.0f;
373 return static_cast<int32_t
>(round(cprDev2 + (rads * cprDev2 / M_PI)));
376 double cprDev2 = motor.
spec.
cpr / 2.0f;
377 return static_cast<int32_t
>(round((rads / M_PI) * cprDev2));
381 double cprDev2 = motor.
spec.
cpr / 2.0f;
382 return static_cast<int32_t
>(round(cprDev2 + (rads * cprDev2 / M_PI)));
394 return static_cast<int32_t
>(83.49f * (rads)-0.564
f);
406 return (100.0
f / 8349.0
f) * ((double)ticks) + (94.0f / 13915.0f);
dynamixel::PortHandler * port_handler_
virtual int broadcastPing(PortHandler *port, std::vector< uint8_t > &id_list)=0
bool isAvailable(uint8_t id, uint16_t address, uint16_t data_length)
static PortHandler * getPortHandler(const char *port_name)
virtual bool openPort()=0
bool broadcastPing(std::vector< uint8_t > result_vec, uint16_t protocol)
bool loadProtocol(uint16_t protocol)
int32_t rads2ticks(double rads, struct motor &motor, float protocol)
bool addParam(uint8_t id, uint16_t start_address, uint16_t data_length)
uint16_t torque_write_addr
uint16_t len_present_speed
uint16_t current_read_addr
bool readMotorsError(std::vector< motor > &motors)
int32_t rad_s2ticks_s(double rads, struct motor &motor, float protocol)
bool dont_allow_zero_ticks_vel
virtual int reboot(PortHandler *port, uint8_t id, uint8_t *error=0)=0
bool readMotorsVel(std::vector< motor > &motors)
bool reboot(const motor &motor)
bool setMotorsLed(std::vector< dxl::motor > &motors, const led_color &color)
virtual void closePort()=0
virtual int write1ByteTxRx(PortHandler *port, uint8_t id, uint16_t address, uint8_t data, uint8_t *error=0)=0
uint16_t len_present_curr
static PacketHandler * getPacketHandler(float protocol_version=2.0)
double ticks2rads(int32_t ticks, struct motor &motor, float protocol)
bool bulkWritePosition(std::vector< motor > &motors)
dynamixel::PacketHandler * pkt_handler_
uint32_t getData(uint8_t id, uint16_t address, uint16_t data_length)
bool readMotorsPos(std::vector< motor > &motors)
virtual int ping(PortHandler *port, uint8_t id, uint8_t *error=0)=0
double ticks_s2rad_s(int32_t ticks, struct motor &motor, float protocol)
virtual bool setBaudRate(const int baudrate)=0
PortState openPort(std::string port_name, unsigned int baudrate, float protocol)
bool readMotorsLoad(std::vector< motor > &motors)
bool setTorque(motor &motor, bool flag)
bool addParam(uint8_t id, uint16_t start_address, uint16_t data_length, uint8_t *data)
int32_t prev_non_zero_velocity_ticks
bool bulkWriteVelocity(std::vector< motor > &motors)