21 #include "cmdvel_thread.h" 22 #include <interfaces/MotorInterface.h> 23 #include <ros/node_handle.h> 24 #include <geometry_msgs/Twist.h> 36 :
Thread(
"ROSCmdVelThread",
Thread::OPMODE_WAITFORWAKEUP)
43 std::string motor_if_id =
config->
get_string(
"/ros/cmdvel/motor_interface_id");
45 sub_ =
rosnode->subscribe(
"cmd_vel", 10, &ROSCmdVelThread::twist_msg_cb,
this);
49 ROSCmdVelThread::twist_msg_cb(
const geometry_msgs::Twist::ConstPtr &msg)
51 send_transrot(msg->linear.x, msg->linear.y, msg->angular.z);
69 ROSCmdVelThread::send_transrot(
float vx,
float vy,
float omega)
81 ROSCmdVelThread::stop()
83 send_transrot(0., 0., 0.);
TransRotMessage Fawkes BlackBoard Interface Message.
Fawkes library namespace.
Thread class encapsulation of pthreads.
Logger * logger
This is the Logger member used to access the logger.
virtual void init()
Initialize the thread.
virtual bool prepare_finalize_user()
Prepare finalization user implementation.
ROSCmdVelThread()
Constructor.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
bool has_writer() const
Check if there is a writer for the interface.
const char * name() const
Get name of thread.
virtual void log_warn(const char *component, const char *format,...)=0
Log warning message.
unsigned int msgq_enqueue(Message *message)
Enqueue message at end of queue.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for reading.
LockPtr< ros::NodeHandle > rosnode
Central ROS node handle.
MotorInterface Fawkes BlackBoard Interface.
Configuration * config
This is the Configuration member used to access the configuration.
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.
BlackBoard * blackboard
This is the BlackBoard instance you can use to interact with the BlackBoard.
virtual void close(Interface *interface)=0
Close interface.