22 #ifndef _PLUGINS_DYNAMIXEL_DRIVER_THREAD_H_ 23 #define _PLUGINS_DYNAMIXEL_DRIVER_THREAD_H_ 25 #include <aspect/blackboard.h> 26 #include <aspect/blocked_timing.h> 27 #include <aspect/configurable.h> 28 #include <aspect/logging.h> 29 #include <blackboard/interface_listener.h> 30 #include <core/threading/read_write_lock.h> 31 #include <core/threading/scoped_rwlock.h> 32 #include <core/threading/thread.h> 33 #include <utils/time/time.h> 35 #ifdef USE_TIMETRACKER 36 # include <utils/time/tracker.h> 42 class DynamixelServoInterface;
95 bool mode_set_pending;
97 unsigned int new_mode;
102 unsigned int torque_limit;
106 std::map<unsigned int, Servo> servos_;
111 std::string cfg_prefix_;
112 std::string cfg_name_;
113 std::string cfg_device_;
114 unsigned int cfg_read_timeout_ms_;
115 unsigned int cfg_disc_timeout_ms_;
116 bool cfg_goto_zero_start_;
118 unsigned int cfg_cw_compl_margin_;
119 unsigned int cfg_ccw_compl_margin_;
120 unsigned int cfg_cw_compl_slope_;
121 unsigned int cfg_ccw_compl_slope_;
122 float cfg_def_angle_margin_;
123 bool cfg_enable_echo_fix_;
124 bool cfg_enable_connection_stability_;
125 bool cfg_autorecover_enabled_;
126 unsigned char cfg_autorecover_flags_;
127 float cfg_torque_limit_;
128 unsigned char cfg_temperature_limit_;
129 bool cfg_prevent_alarm_shutdown_;
130 float cfg_prevent_alarm_shutdown_threshold_;
131 float cfg_min_voltage_;
132 float cfg_max_voltage_;
133 std::vector<unsigned int> cfg_servos_to_discover_;
134 bool cfg_enable_verbose_output_;
136 void goto_angle(
unsigned int servo_id,
float angle);
137 void goto_angle_timed(
unsigned int servo_id,
float angle,
float time_sec);
138 float get_angle(
unsigned int servo_id);
139 float get_angle(
unsigned int servo_id,
fawkes::Time &time);
140 void set_velocity(
unsigned int servo_id,
float vel);
141 float get_velocity(
unsigned int servo_id);
142 void set_speed(
unsigned int servo_id,
unsigned int speed);
143 void set_mode(
unsigned int servo_id,
unsigned int new_mode);
144 void set_margin(
unsigned int servo_id,
float margin);
145 bool is_final(
unsigned int servo_id);
146 bool is_enabled(
unsigned int servo_id);
147 void set_enabled(
unsigned int servo_id,
bool enabled);
148 void set_led_enabled(
unsigned int servo_id,
bool enabled);
149 void stop_motion(
unsigned int servo_id);
150 bool has_fresh_data();
151 void wait_for_fresh_data();
153 void exec_goto_angle(
unsigned int servo_id,
float angle);
154 void exec_set_mode(
unsigned int servo_id,
unsigned int new_mode);
Class to access a chain of Robotis dynamixel servos.
Thread aspect to access to BlackBoard.
Wait until a given condition holds.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
virtual void init()
Initialize the thread.
Driver thread for Robotis dynamixel servos.
Fawkes library namespace.
virtual bool bb_interface_message_received(fawkes::Interface *interface, fawkes::Message *message)
BlackBoard message received notification.
A class for handling time.
virtual void finalize()
Finalize the thread.
Thread class encapsulation of pthreads.
Base class for all Fawkes BlackBoard interfaces.
void exec_act()
Process commands.
Read/write lock to allow multiple readers but only a single writer on the resource at a time.
Thread aspect to log output.
Thread aspect to access configuration data.
virtual void run()
Stub to see name in backtrace for easier debugging.
LedInterface Fawkes BlackBoard Interface.
virtual void loop()
Code to execute in the thread.
void exec_sensor()
Update sensor values as necessary.
DynamixelServoInterface Fawkes BlackBoard Interface.
JointInterface Fawkes BlackBoard Interface.
Mutex mutual exclusion lock.
DynamixelDriverThread(std::string &cfg_name, std::string &cfg_prefix)
Constructor.
BlackBoard interface listener.