23 #ifndef _PLUGINS_PANTILT_ROBOTIS_RX28_THREAD_H_ 24 #define _PLUGINS_PANTILT_ROBOTIS_RX28_THREAD_H_ 26 #include "../act_thread.h" 29 # include <aspect/tf.h> 31 #include <blackboard/interface_listener.h> 32 #include <utils/time/time.h> 34 #ifdef USE_TIMETRACKER 35 # include <utils/time/tracker.h> 41 class PanTiltInterface;
58 std::string &ptu_cfg_prefix,
59 std::string &ptu_name);
88 std::string pantilt_cfg_prefix_;
89 std::string ptu_cfg_prefix_;
90 std::string ptu_name_;
91 std::string cfg_device_;
92 unsigned int cfg_read_timeout_ms_;
93 unsigned int cfg_disc_timeout_ms_;
94 unsigned int cfg_pan_servo_id_;
95 unsigned int cfg_tilt_servo_id_;
96 bool cfg_goto_zero_start_;
98 unsigned int cfg_cw_compl_margin_;
99 unsigned int cfg_ccw_compl_margin_;
100 unsigned int cfg_cw_compl_slope_;
101 unsigned int cfg_ccw_compl_slope_;
106 float cfg_pan_margin_;
107 float cfg_tilt_margin_;
108 float cfg_pan_offset_;
109 float cfg_tilt_offset_;
110 float cfg_pan_start_;
111 float cfg_tilt_start_;
113 std::string cfg_base_frame_;
114 std::string cfg_pan_link_;
115 std::string cfg_tilt_link_;
117 fawkes::tf::Vector3 translation_pan_;
118 fawkes::tf::Vector3 translation_tilt_;
120 bool cfg_publish_transforms_;
129 WorkerThread(std::string ptu_name,
132 unsigned char pan_servo_id,
133 unsigned char tilt_servo_id,
139 float & tilt_offset);
142 void goto_pantilt(
float pan,
float tilt);
143 void goto_pantilt_timed(
float pan,
float tilt,
float time_sec);
144 void get_pantilt(
float &pan,
float &tilt);
145 void get_pantilt(
float &pan,
float &tilt,
fawkes::Time &time);
146 void set_velocities(
float pan_vel,
float tilt_vel);
147 void get_velocities(
float &pan_vel,
float &tilt_vel);
148 void set_margins(
float pan_margin,
float tilt_margin);
151 void set_enabled(
bool enabled);
152 void set_led_enabled(
bool enabled);
154 bool has_fresh_data();
155 void wait_for_fresh_data();
168 void exec_goto_pantilt(
float pan,
float tilt);
176 unsigned char pan_servo_id_;
177 unsigned char tilt_servo_id_;
185 float max_pan_speed_;
186 float max_tilt_speed_;
197 unsigned int pan_vel_;
198 unsigned int tilt_vel_;
virtual bool bb_interface_message_received(fawkes::Interface *interface, fawkes::Message *message)
BlackBoard message received notification.
virtual void loop()
Code to execute in the thread.
Wait until a given condition holds.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
void update_sensor_values()
Update sensor values as necessary.
Fawkes library namespace.
A class for handling time.
Thread class encapsulation of pthreads.
virtual void run()
Stub to see name in backtrace for easier debugging.
Base class for all Fawkes BlackBoard interfaces.
PanTiltRX28Thread(std::string &pantilt_cfg_prefix, std::string &ptu_cfg_prefix, std::string &ptu_name)
Constructor.
Logger * logger
This is the Logger member used to access the logger.
virtual void init()
Initialize the thread.
PanTilt act thread for RX28 PTU.
Read/write lock to allow multiple readers but only a single writer on the resource at a time.
Class to access a chain of Robotis RX28 servos.
LedInterface Fawkes BlackBoard Interface.
virtual bool prepare_finalize_user()
Prepare finalization user implementation.
PanTiltInterface Fawkes BlackBoard Interface.
JointInterface Fawkes BlackBoard Interface.
Mutex mutual exclusion lock.
virtual void finalize()
Finalize the thread.
BlackBoard interface listener.