82 #ifndef DYNAMIXEL_INTERFACE_CONTROLLER_H_ 83 #define DYNAMIXEL_INTERFACE_CONTROLLER_H_ 96 #include <sensor_msgs/JointState.h> 100 #include <dynamixel_interface/DataPort.h> 101 #include <dynamixel_interface/DataPorts.h> 102 #include <dynamixel_interface/ServoDiag.h> 103 #include <dynamixel_interface/ServoDiags.h> 137 std::unique_ptr<DynamixelInterfaceDriver>
driver;
139 std::unordered_map<std::string, DynamixelInfo>
joints;
160 bool parseParameters(
void);
195 bool initialisePort(
PortInfo &port);
207 void jointStateCallback(
const sensor_msgs::JointState::ConstPtr &joint_commands);
215 void multiThreadedIO(
PortInfo &port, sensor_msgs::JointState &read_msg, dynamixel_interface::DataPorts &dataport_msg,
216 dynamixel_interface::ServoDiags &status_msg,
bool perform_write)
const;
221 void multiThreadedWrite(
PortInfo &port, sensor_msgs::JointState joint_commands)
const;
228 void multiThreadedRead(
PortInfo &port, sensor_msgs::JointState &read_msg,
229 dynamixel_interface::DataPorts &dataports_msg,
230 dynamixel_interface::ServoDiags &diags_msg)
const;
232 std::unique_ptr<ros::NodeHandle>
nh_;
239 bool write_ready_ =
false;
252 uint diagnostics_counter_ = 0;
253 uint diagnostics_iters_ = 0;
257 uint dataport_counter_ = 0;
258 uint dataport_iters_ = 0;
262 bool parameters_parsed_ =
false;
263 bool initialised_ =
false;
274 int recv_queue_size_ = 1;
279 #endif // DYNAMIXEL_INTERFACE_CONTROLLER_H_ std::string port_name
User defined port name.
std::unique_ptr< DynamixelInterfaceDriver > driver
The driver object.
double max_vel
Motor maximum joint velocity (rad/s)
DynamixelControlMode control_type_
ros::Publisher debug_publisher_
Debug message publisher.
Struct that describes the dynamixel motor's static and physical properties.
int zero_pos
Motor initial position (in raw encoder values). This value defines the 0 radian position.
int min_pos
Motor minimum encoder value. Note that if min > max, the motor direction is reversed.
std::string device
Serial device name.
int id
The unique (per port) ID of the motor.
ros::Timer broadcast_timer_
Timer that controls the rate of the IO callback.
Struct that describes each servo's place in the system including which joint it corresponds to...
ros::Publisher diagnostics_publisher_
Publishes joint states from reads.
std::mutex write_mutex_
Mutex for write_msg, as there are potentially multiple threads.
ros::Publisher dataport_publisher_
Publishes the data from the external ports on dynamixel_pros.
double diagnostics_rate_
Desired rate at which servo diagnostic information is published.
std::unordered_map< std::string, DynamixelInfo > joints
map of joint information by name
bool read_diagnostics_
Bool for telling threads to read diagnostics data.
sensor_msgs::JointState write_msg_
Stores the last message received from the write command topic.
std::vector< PortInfo > dynamixel_ports_
method of control (position/velocity/torque)
Struct which stores information about each port in use and which joints use that port.
bool read_dataport_
Bool for telling threads to read dataport data.
DynamixelControlMode current_mode
control mode (position, velocity, torque)
bool use_legacy_protocol
boolean indicating if legacy protocol (for older series dynamixels) is in use
int baudrate
Serial baud rate.
bool torque_enabled
Motor enable flag.
ros::Subscriber joint_state_subscriber_
Gets joint states for writes.
bool stop_motors_on_shutdown_
Indicates if the motors should be turned off when the controller stops.
double dataport_rate_
Rate at which the pro external dataport is read.
Defines the hardware abstraction methods for communicating with dynamixels.
std::string joint_name
The unique (globally) name of the joint.
bool ignore_input_velocity_
can set driver to ignore profile velocity commands in position mode
double torque_limit
Motor maximum torque limit (rated max)
const DynamixelSpec * model_spec
Motor model specification including encoder counts and unit conversion factors.
int max_pos
Motor maximum encoder value. Note that if min > max, the motor direction is reversed.
double global_torque_limit_
global joint torque limit
uint8_t hardware_status
current motor status, used for hardware error reporting
double global_max_vel_
global joint speed limit
std::unique_ptr< ros::NodeHandle > nh_
Handler for the ROS Node.
ros::Publisher joint_state_publisher_
Publishes joint states from reads.
double loop_rate_
Desired loop rate (joint states are published at this rate)