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;
59 std::string &ptu_cfg_prefix,
60 std::string &ptu_name);
74 protected:
virtual void run() { Thread::run(); }
84 std::string __pantilt_cfg_prefix;
85 std::string __ptu_cfg_prefix;
86 std::string __ptu_name;
87 std::string __cfg_device;
88 unsigned int __cfg_read_timeout_ms;
89 unsigned int __cfg_disc_timeout_ms;
90 unsigned int __cfg_pan_servo_id;
91 unsigned int __cfg_tilt_servo_id;
92 bool __cfg_goto_zero_start;
94 unsigned int __cfg_cw_compl_margin;
95 unsigned int __cfg_ccw_compl_margin;
96 unsigned int __cfg_cw_compl_slope;
97 unsigned int __cfg_ccw_compl_slope;
100 float __cfg_tilt_min;
101 float __cfg_tilt_max;
102 float __cfg_pan_margin;
103 float __cfg_tilt_margin;
104 float __cfg_pan_offset;
105 float __cfg_tilt_offset;
106 float __cfg_pan_start;
107 float __cfg_tilt_start;
109 std::string __cfg_base_frame;
110 std::string __cfg_pan_link;
111 std::string __cfg_tilt_link;
113 fawkes::tf::Vector3 __translation_pan;
114 fawkes::tf::Vector3 __translation_tilt;
116 bool __cfg_publish_transforms;
127 unsigned char pan_servo_id,
unsigned char tilt_servo_id,
128 float &pan_min,
float &pan_max,
float &tilt_min,
float &tilt_max,
129 float &pan_offset,
float &tilt_offset);
132 void goto_pantilt(
float pan,
float tilt);
133 void goto_pantilt_timed(
float pan,
float tilt,
float time_sec);
134 void get_pantilt(
float &pan,
float &tilt);
135 void get_pantilt(
float &pan,
float &tilt,
fawkes::Time &time);
136 void set_velocities(
float pan_vel,
float tilt_vel);
137 void get_velocities(
float &pan_vel,
float &tilt_vel);
138 void set_margins(
float pan_margin,
float tilt_margin);
141 void set_enabled(
bool enabled);
142 void set_led_enabled(
bool enabled);
144 bool has_fresh_data();
145 void wait_for_fresh_data();
150 protected:
virtual void run() { Thread::run(); }
153 void exec_goto_pantilt(
float pan,
float tilt);
161 unsigned char __pan_servo_id;
162 unsigned char __tilt_servo_id;
170 float __max_pan_speed;
171 float __max_tilt_speed;
182 unsigned int __pan_vel;
183 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.