21 #include "cmdvel_thread.h"
22 #include <interfaces/MotorInterface.h>
23 #include <ros/node_handle.h>
24 #include <geometry_msgs/Twist.h>
27 using namespace fawkes;
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)
77 ROSCmdVelThread::stop()
79 send_transrot(0., 0., 0.);
TransRotMessage Fawkes BlackBoard Interface Message.
Thread class encapsulation of pthreads.
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.
unsigned int msgq_enqueue(Message *message)
Enqueue message at end of queue.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier)=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.