diff --git a/CHANGELOG.md b/CHANGELOG.md index 156d9c62..db632cc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## May, 16th 2018 + +- [New model] Add (almost complete) support for the servo-motors in the X series + ## March, 26th 2018 - [Improvement] Add support to MX series using protocol 2 diff --git a/src/dynamixel/auto_detect.hpp b/src/dynamixel/auto_detect.hpp index 536a4b5a..6da701c4 100644 --- a/src/dynamixel/auto_detect.hpp +++ b/src/dynamixel/auto_detect.hpp @@ -65,15 +65,33 @@ namespace dynamixel { return std::make_shared(id); case servos::Mx106P2::ct_t::model_number_value: return std::make_shared(id); + case servos::Xm430W210::ct_t::model_number_value: + return std::make_shared(id); + case servos::Xm430W250::ct_t::model_number_value: + return std::make_shared(id); + case servos::Xm430W350::ct_t::model_number_value: + return std::make_shared(id); + case servos::Xm540W150::ct_t::model_number_value: + return std::make_shared(id); + case servos::Xm540W270::ct_t::model_number_value: + return std::make_shared(id); + case servos::Xh430W210::ct_t::model_number_value: + return std::make_shared(id); + case servos::Xh430W350::ct_t::model_number_value: + return std::make_shared(id); + case servos::Xh430V210::ct_t::model_number_value: + return std::make_shared(id); + case servos::Xh430V350::ct_t::model_number_value: + return std::make_shared(id); default: throw errors::Error("Unrecognized model number"); } } /** Send a ping to an ID. If it is answered, read the actuator model and - instanciate a class of the correct type. + instantiate a class of the correct type. - @param id value, from 1 to 254 identifiying an actuator + @param id value, from 1 to 254 identifying an actuator @return std::shared_ptr to a servo object if we got an answer **/ @@ -81,7 +99,7 @@ namespace dynamixel { inline std::shared_ptr> find_servo(const Controller& controller, typename Protocol::id_t id) { - // Dummy variable used only to differenciate between the two version of + // Dummy variable used only to differentiate between the two version of // get_servo (protocol 1 or 2) typename Protocol::address_t selected_protocol = 0; diff --git a/src/dynamixel/servos.hpp b/src/dynamixel/servos.hpp index 9dd01ae1..0923784d 100644 --- a/src/dynamixel/servos.hpp +++ b/src/dynamixel/servos.hpp @@ -13,6 +13,15 @@ #include "servos/mx106.hpp" #include "servos/mx106_p2.hpp" #include "servos/xl320.hpp" +#include "servos/xm430_w210.hpp" +#include "servos/xm430_w250.hpp" +#include "servos/xm430_w350.hpp" +#include "servos/xm540_w150.hpp" +#include "servos/xm540_w270.hpp" +#include "servos/xh430_w210.hpp" +#include "servos/xh430_w350.hpp" +#include "servos/xh430_v210.hpp" +#include "servos/xh430_v350.hpp" #include "servos/pro_h54_200_s500.hpp" #include "servos/pro_h54_100_s500.hpp" #include "servos/pro_h42_20_s300.hpp" diff --git a/src/dynamixel/servos/xh430_v210.hpp b/src/dynamixel/servos/xh430_v210.hpp new file mode 100644 index 00000000..b27d3e9c --- /dev/null +++ b/src/dynamixel/servos/xh430_v210.hpp @@ -0,0 +1,181 @@ +#ifndef DYNAMIXEL_SERVOS_XH430V210_HPP_ +#define DYNAMIXEL_SERVOS_XH430V210_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xh430V210; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1050; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t current_limit = 38; + typedef uint16_t current_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t goal_current = 102; + typedef uint16_t goal_current_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xh430V210 : public Servo { + public: + typedef Xh430V210 Model; + + Xh430V210(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xh430V210); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(current_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(goal_current); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif diff --git a/src/dynamixel/servos/xh430_v350.hpp b/src/dynamixel/servos/xh430_v350.hpp new file mode 100644 index 00000000..b4070485 --- /dev/null +++ b/src/dynamixel/servos/xh430_v350.hpp @@ -0,0 +1,181 @@ +#ifndef DYNAMIXEL_SERVOS_XH430V350_HPP_ +#define DYNAMIXEL_SERVOS_XH430V350_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xh430V350; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1040; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t current_limit = 38; + typedef uint16_t current_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t goal_current = 102; + typedef uint16_t goal_current_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xh430V350 : public Servo { + public: + typedef Xh430V350 Model; + + Xh430V350(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xh430V350); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(current_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(goal_current); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif diff --git a/src/dynamixel/servos/xh430_w210.hpp b/src/dynamixel/servos/xh430_w210.hpp new file mode 100644 index 00000000..e500ad8e --- /dev/null +++ b/src/dynamixel/servos/xh430_w210.hpp @@ -0,0 +1,181 @@ +#ifndef DYNAMIXEL_SERVOS_XH430W210_HPP_ +#define DYNAMIXEL_SERVOS_XH430W210_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xh430W210; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1010; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t current_limit = 38; + typedef uint16_t current_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t goal_current = 102; + typedef uint16_t goal_current_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xh430W210 : public Servo { + public: + typedef Xh430W210 Model; + + Xh430W210(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xh430W210); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(current_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(goal_current); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif diff --git a/src/dynamixel/servos/xh430_w350.hpp b/src/dynamixel/servos/xh430_w350.hpp new file mode 100644 index 00000000..a3687d53 --- /dev/null +++ b/src/dynamixel/servos/xh430_w350.hpp @@ -0,0 +1,181 @@ +#ifndef DYNAMIXEL_SERVOS_XH430W350_HPP_ +#define DYNAMIXEL_SERVOS_XH430W350_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xh430W350; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1000; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t current_limit = 38; + typedef uint16_t current_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t goal_current = 102; + typedef uint16_t goal_current_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xh430W350 : public Servo { + public: + typedef Xh430W350 Model; + + Xh430W350(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xh430W350); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(current_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(goal_current); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif diff --git a/src/dynamixel/servos/xm430_w210.hpp b/src/dynamixel/servos/xm430_w210.hpp new file mode 100644 index 00000000..f39c2c1f --- /dev/null +++ b/src/dynamixel/servos/xm430_w210.hpp @@ -0,0 +1,181 @@ +#ifndef DYNAMIXEL_SERVOS_XM430W210_HPP_ +#define DYNAMIXEL_SERVOS_XM430W210_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xm430W210; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1030; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t current_limit = 38; + typedef uint16_t current_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t goal_current = 102; + typedef uint16_t goal_current_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xm430W210 : public Servo { + public: + typedef Xm430W210 Model; + + Xm430W210(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xm430W210); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(current_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(goal_current); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif diff --git a/src/dynamixel/servos/xm430_w250.hpp b/src/dynamixel/servos/xm430_w250.hpp new file mode 100644 index 00000000..5693573c --- /dev/null +++ b/src/dynamixel/servos/xm430_w250.hpp @@ -0,0 +1,175 @@ +#ifndef DYNAMIXEL_SERVOS_XM430W250_HPP_ +#define DYNAMIXEL_SERVOS_XM430W250_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xm430W250; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1060; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xm430W250 : public Servo { + public: + typedef Xm430W250 Model; + + Xm430W250(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xm430W250); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif diff --git a/src/dynamixel/servos/xm430_w350.hpp b/src/dynamixel/servos/xm430_w350.hpp new file mode 100644 index 00000000..90c8e232 --- /dev/null +++ b/src/dynamixel/servos/xm430_w350.hpp @@ -0,0 +1,181 @@ +#ifndef DYNAMIXEL_SERVOS_XM430W350_HPP_ +#define DYNAMIXEL_SERVOS_XM430W350_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xm430W350; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1020; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t current_limit = 38; + typedef uint16_t current_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t goal_current = 102; + typedef uint16_t goal_current_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xm430W350 : public Servo { + public: + typedef Xm430W350 Model; + + Xm430W350(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xm430W350); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(current_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(goal_current); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif diff --git a/src/dynamixel/servos/xm540_w150.hpp b/src/dynamixel/servos/xm540_w150.hpp new file mode 100644 index 00000000..9593d6a4 --- /dev/null +++ b/src/dynamixel/servos/xm540_w150.hpp @@ -0,0 +1,181 @@ +#ifndef DYNAMIXEL_SERVOS_XM540W150_HPP_ +#define DYNAMIXEL_SERVOS_XM540W150_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xm540W150; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1130; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t current_limit = 38; + typedef uint16_t current_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t goal_current = 102; + typedef uint16_t goal_current_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xm540W150 : public Servo { + public: + typedef Xm540W150 Model; + + Xm540W150(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xm540W150); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(current_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(goal_current); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif diff --git a/src/dynamixel/servos/xm540_w270.hpp b/src/dynamixel/servos/xm540_w270.hpp new file mode 100644 index 00000000..b58e88c7 --- /dev/null +++ b/src/dynamixel/servos/xm540_w270.hpp @@ -0,0 +1,181 @@ +#ifndef DYNAMIXEL_SERVOS_XM540W270_HPP_ +#define DYNAMIXEL_SERVOS_XM540W270_HPP_ + +#include + +#include "servo.hpp" +#include "../protocols/protocol2.hpp" + +namespace dynamixel { + namespace servos { + class Xm540W270; + + template <> + struct ModelTraits { + typedef protocols::Protocol2 protocol_t; + + struct CT { + static const protocol_t::address_t model_number = 0; + typedef uint16_t model_number_t; + static const model_number_t model_number_value = 1120; + static const protocol_t::address_t model_info = 2; + typedef uint32_t model_info_t; + static const protocol_t::address_t firmware_version = 6; + typedef uint8_t firmware_version_t; + static const protocol_t::address_t id = 7; + typedef protocol_t::id_t id_t; + static const protocol_t::address_t baudrate = 8; + typedef uint8_t baudrate_t; + static const protocol_t::address_t return_delay_time = 9; + typedef uint8_t return_delay_time_t; + static const protocol_t::address_t drive_mode = 10; + typedef uint8_t drive_mode_t; + static const protocol_t::address_t operating_mode = 11; + typedef uint8_t operating_mode_t; + static const protocol_t::address_t secondary_id = 12; + typedef uint8_t secondary_id_t; + static const protocol_t::address_t protocol_version = 13; + typedef uint8_t protocol_version_t; + static const protocol_t::address_t homing_offset = 20; + typedef uint32_t homing_offset_t; + static const protocol_t::address_t moving_threshold = 24; + typedef uint32_t moving_threshold_t; + static const protocol_t::address_t highest_temperature_limit = 31; + typedef uint8_t highest_temperature_limit_t; + static const protocol_t::address_t highest_voltage_limit = 32; + typedef uint16_t highest_voltage_limit_t; + static const protocol_t::address_t lowest_voltage_limit = 34; + typedef uint16_t lowest_voltage_limit_t; + static const protocol_t::address_t pwm_limit = 36; + typedef uint16_t pwm_limit_t; + static const protocol_t::address_t current_limit = 38; + typedef uint16_t current_limit_t; + static const protocol_t::address_t acceleration_limit = 40; + typedef uint32_t acceleration_limit_t; + static const protocol_t::address_t speed_limit = 44; + typedef uint32_t speed_limit_t; + static const protocol_t::address_t max_position_limit = 48; + typedef int32_t max_position_limit_t; + static const protocol_t::address_t min_position_limit = 52; + typedef int32_t min_position_limit_t; + static const protocol_t::address_t alarm_shutdown = 63; + typedef uint8_t alarm_shutdown_t; + static const protocol_t::address_t torque_enable = 64; + typedef uint8_t torque_enable_t; + static const protocol_t::address_t led = 65; + typedef uint8_t led_t; + static const protocol_t::address_t status_return_level = 68; + typedef uint8_t status_return_level_t; + static const protocol_t::address_t registered = 69; + typedef uint8_t registered_t; + static const protocol_t::address_t hardware_error_status = 70; + typedef uint8_t hardware_error_status_t; + static const protocol_t::address_t velocity_i_gain = 76; + typedef uint16_t velocity_i_gain_t; + static const protocol_t::address_t velocity_p_gain = 78; + typedef uint16_t velocity_p_gain_t; + static const protocol_t::address_t position_d_gain = 80; + typedef uint16_t position_d_gain_t; + static const protocol_t::address_t position_i_gain = 82; + typedef uint16_t position_i_gain_t; + static const protocol_t::address_t position_p_gain = 84; + typedef uint16_t position_p_gain_t; + static const protocol_t::address_t feedforward_2nd_gain = 88; + typedef uint16_t feedforward_2nd_gain_t; + static const protocol_t::address_t feedforward_1st_gain = 90; + typedef uint16_t feedforward_1st_gain_t; + static const protocol_t::address_t bus_watchdog = 98; + typedef uint8_t bus_watchdog_t; + static const protocol_t::address_t goal_pwm = 100; + typedef uint16_t goal_pwm_t; + static const protocol_t::address_t goal_current = 102; + typedef uint16_t goal_current_t; + static const protocol_t::address_t moving_speed = 104; + typedef uint32_t moving_speed_t; + static const moving_speed_t min_goal_speed = INT32_MIN; + static const moving_speed_t max_goal_speed = INT32_MAX; + static constexpr double rpm_per_tick = 0.229; + static const bool speed_sign_bit = false; + static const protocol_t::address_t profile_acceleration = 108; + typedef uint32_t profile_acceleration_t; + static const protocol_t::address_t profile_speed = 112; + typedef uint32_t profile_speed_t; + static const protocol_t::address_t goal_position = 116; + typedef int32_t goal_position_t; + static const goal_position_t min_goal_position = 0; + static const goal_position_t max_goal_position = 4095; + static const uint32_t min_goal_angle_deg = 0; + static const uint32_t max_goal_angle_deg = 360; + static const protocol_t::address_t realtime_tick = 120; + typedef uint16_t realtime_tick_t; + static const protocol_t::address_t moving = 122; + typedef uint8_t moving_t; + static const protocol_t::address_t moving_status = 123; + typedef uint8_t moving_status_t; + static const protocol_t::address_t present_pwm = 124; + typedef uint16_t present_pwm_t; + static const protocol_t::address_t current = 126; + typedef uint16_t current_t; + static const protocol_t::address_t present_speed = 128; + typedef int32_t present_speed_t; + static const protocol_t::address_t present_position = 132; + typedef int32_t present_position_t; + static const protocol_t::address_t speed_trajectory = 136; + typedef int32_t speed_trajectory_t; + static const protocol_t::address_t position_trajectory = 140; + typedef int32_t position_trajectory_t; + static const protocol_t::address_t present_voltage = 144; + typedef uint16_t present_voltage_t; + static const protocol_t::address_t present_temperature = 146; + typedef uint8_t present_temperature_t; + }; + }; + + class Xm540W270 : public Servo { + public: + typedef Xm540W270 Model; + + Xm540W270(typename protocol_t::id_t id) : Servo(id){}; + + MODEL_NAME(Xm540W270); + + // Here we add the fields that are not common to all dynamixels + READ_FIELD(model_info); + READ_WRITE_FIELD(drive_mode); + READ_WRITE_FIELD(operating_mode); + READ_WRITE_FIELD(secondary_id); + READ_WRITE_FIELD(protocol_version); + READ_WRITE_FIELD(homing_offset); + READ_WRITE_FIELD(moving_threshold); + READ_WRITE_FIELD(pwm_limit); + READ_WRITE_FIELD(current_limit); + READ_WRITE_FIELD(acceleration_limit); + READ_WRITE_FIELD(speed_limit); + READ_WRITE_FIELD(max_position_limit); + READ_WRITE_FIELD(min_position_limit); + READ_WRITE_FIELD(led); + READ_FIELD(registered); + READ_FIELD(hardware_error_status); + READ_WRITE_FIELD(velocity_i_gain); + READ_WRITE_FIELD(velocity_p_gain); + READ_WRITE_FIELD(position_d_gain); + READ_WRITE_FIELD(position_i_gain); + READ_WRITE_FIELD(position_p_gain); + READ_WRITE_FIELD(feedforward_2nd_gain); + READ_WRITE_FIELD(feedforward_1st_gain); + READ_WRITE_FIELD(bus_watchdog); + READ_WRITE_FIELD(goal_pwm); + READ_WRITE_FIELD(goal_current); + READ_WRITE_FIELD(profile_acceleration); + READ_WRITE_FIELD(profile_speed); + READ_FIELD(realtime_tick); + READ_FIELD(moving_status); + READ_FIELD(present_pwm); + // READ_FIELD(current); + READ_FIELD(speed_trajectory); + READ_FIELD(position_trajectory); + }; + } +} + +#endif