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);
73 protected:
virtual void run() { Thread::run(); }
81 std::string __pantilt_cfg_prefix;
82 std::string __ptu_cfg_prefix;
83 std::string __ptu_name;
84 std::string __cfg_device;
85 unsigned int __cfg_read_timeout_ms;
86 unsigned int __cfg_disc_timeout_ms;
87 unsigned int __cfg_pan_servo_id;
88 unsigned int __cfg_tilt_servo_id;
89 bool __cfg_goto_zero_start;
91 unsigned int __cfg_cw_compl_margin;
92 unsigned int __cfg_ccw_compl_margin;
93 unsigned int __cfg_cw_compl_slope;
94 unsigned int __cfg_ccw_compl_slope;
99 float __cfg_pan_margin;
100 float __cfg_tilt_margin;
101 float __cfg_pan_offset;
102 float __cfg_tilt_offset;
103 float __cfg_pan_start;
104 float __cfg_tilt_start;
106 std::string __cfg_base_frame;
107 std::string __cfg_pan_link;
108 std::string __cfg_tilt_link;
110 fawkes::tf::Vector3 __translation_pan;
111 fawkes::tf::Vector3 __translation_tilt;
122 unsigned char pan_servo_id,
unsigned char tilt_servo_id,
123 float &pan_min,
float &pan_max,
float &tilt_min,
float &tilt_max,
124 float &pan_offset,
float &tilt_offset);
127 void goto_pantilt(
float pan,
float tilt);
128 void goto_pantilt_timed(
float pan,
float tilt,
float time_sec);
129 void get_pantilt(
float &pan,
float &tilt);
130 void get_pantilt(
float &pan,
float &tilt,
fawkes::Time &time);
131 void set_velocities(
float pan_vel,
float tilt_vel);
132 void get_velocities(
float &pan_vel,
float &tilt_vel);
133 void set_margins(
float pan_margin,
float tilt_margin);
136 void set_enabled(
bool enabled);
137 void set_led_enabled(
bool enabled);
139 bool has_fresh_data();
140 void wait_for_fresh_data();
145 protected:
virtual void run() { Thread::run(); }
148 void exec_goto_pantilt(
float pan,
float tilt);
156 unsigned char __pan_servo_id;
157 unsigned char __tilt_servo_id;
165 float __max_pan_speed;
166 float __max_tilt_speed;
177 unsigned int __pan_vel;
178 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.
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.
Mutex mutual exclusion lock.
virtual void finalize()
Finalize the thread.
BlackBoard interface listener.