20 #include <boost/scoped_ptr.hpp> 21 #include <boost/thread/mutex.hpp> 28 #include <cob_base_controller_utils/WheelCommands.h> 29 #include <geometry_msgs/Twist.h> 42 }
else if (value < -limit) {
56 ROS_ERROR(
"Parameter 'steer_joint' not set");
60 ROS_ERROR(
"Parameter 'drive_joint' not set");
70 std::string description_name;
71 bool has_model = nh.
searchParam(
"robot_description", description_name) && model.
initParam(description_name);
73 urdf::Vector3 steer_pos;
74 urdf::JointConstSharedPtr steer_joint;
75 urdf::JointConstSharedPtr drive_joint;
109 nh.
param(
"timeout", timeout, 1.0);
135 boost::mutex::scoped_try_lock lock(
mutex_);
185 boost::scoped_ptr<realtime_tools::RealtimePublisher<cob_base_controller_utils::WheelCommands> >
commands_pub_;
195 boost::mutex::scoped_lock lock(mutex_);
196 if(isnan(msg->linear.x) || isnan(msg->linear.y) || isnan(msg->angular.z)) {
197 ROS_FATAL(
"Received NaN-value in Twist message. Reset target to zero.");
218 double r_base = wheel_state_.
pos_x * wheel_state_.
sign;
224 double b1 = k / wheel_state_.
radius;
228 double b2 = - k / wheel_state_.
radius;
void topicCallbackTwistCmd(const geometry_msgs::Twist::ConstPtr &msg)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
virtual void starting(const ros::Time &time)
tf2Scalar getAngle() const
ros::Subscriber twist_subscriber_
boost::scoped_ptr< realtime_tools::RealtimePublisher< cob_base_controller_utils::WheelCommands > > commands_pub_
struct cob_tricycle_controller::WheelController::Target target_
Duration & fromSec(double t)
hardware_interface::JointHandle drive_joint_
bool searchParam(const std::string &key, std::string &result) const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
double limitValue(double value, double limit)
bool parseWheelTransform(const std::string &joint_name, const std::string &parent_link_name, tf2::Transform &transform, urdf::Model *model)
def normalize_angle(angle)
URDF_EXPORT bool initParam(const std::string ¶m)
#define ROS_WARN_STREAM(args)
double getPosition() const
double getVelocity() const
JointHandle getHandle(const std::string &name)
void setCommand(double command)
virtual void update(const ros::Time &time, const ros::Duration &period)
bool getParam(const std::string &key, std::string &s) const
hardware_interface::JointHandle steer_joint_
virtual bool init(hardware_interface::RobotHW *robot_hw, ros::NodeHandle &nh)
#define ROS_ERROR_STREAM(args)
WheelState wheel_command_
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)