31 #include <std_msgs/Bool.h> 32 #include <geometry_msgs/Twist.h> 51 if (!
nh_.
getParam(
"base_frame_name", base_frame_name_))
54 "Couldn't retrieve parameter 'base_frame_name' from parameter server! Using default '" << base_frame_name_ <<
"'. [" <<
name_ <<
"]");
60 "Couldn't retrieve parameter 'goal_frame_name' from parameter server! Using default '" <<
goal_frame_name_ <<
"'. [" <<
name_ <<
"]");
66 "Couldn't retrieve parameter 'v_min' from parameter server! Using default '" <<
v_min_movement_ <<
"'. [" <<
name_ <<
"]");
72 "Couldn't retrieve parameter 'v_max' from parameter server! Using default '" <<
v_max_ <<
"'. [" <<
name_ <<
"]");
78 "Couldn't retrieve parameter 'w_min' from parameter server! Using default '" <<
w_min_movement_ <<
"'. [" <<
name_ <<
"]");
84 "Couldn't retrieve parameter 'w_max' from parameter server! Using default '" <<
w_max_ <<
"'. [" <<
name_ <<
"]");
91 "Couldn't retrieve parameter 'k_1' from parameter server! Using default '" <<
k_1_ <<
"'. [" <<
name_ <<
"]");
96 "Couldn't retrieve parameter 'k_2' from parameter server! Using default '" <<
k_2_ <<
"'. [" <<
name_ <<
"]");
101 "Couldn't retrieve parameter 'beta' from parameter server! Using default '" <<
beta_ <<
"'. [" <<
name_ <<
"]");
106 "Couldn't retrieve parameter 'lambda' from parameter server! Using default '" <<
lambda_ <<
"'. [" <<
name_ <<
"]");
111 "Couldn't retrieve parameter 'dist_thres' from parameter server! Using default '" <<
dist_thres_ <<
"'. [" <<
name_ <<
"]");
116 "Couldn't retrieve parameter 'orient_thres' from parameter server! Using default '" <<
orient_thres_ <<
"'. [" <<
name_ <<
"]");
122 "Couldn't retrieve parameter 'dist_eps' from parameter server! Using default '" <<
dist_eps_ <<
"'. [" <<
name_ <<
"]");
128 "Couldn't retrieve parameter 'orient_eps' from parameter server! Using default '" <<
orient_eps_ <<
"'. [" <<
name_ <<
"]");
133 "base_frame_name = " << base_frame_name_ <<
", goal_frame_name = " <<
goal_frame_name_ <<
" [" <<
name_ <<
"]");
182 double r = std::sqrt(
190 double theta = heading + delta;
199 std_msgs::Bool bool_msg;
200 bool_msg.data =
true;
206 geometry_msgs::TwistPtr cmd_vel(
new geometry_msgs::Twist());
209 cmd_vel->linear.x =
v_;
210 cmd_vel->angular.z =
w_;
ros::Subscriber disable_controller_subscriber_
subscriber for disabling the controller
double v_min_movement_
minimum linear base velocity at which we still move [m/s]
#define ROS_DEBUG_STREAM_THROTTLE(rate, args)
double wrapAngle(double a)
bool init()
Set-up necessary publishers/subscribers and variables.
double delta_
current heading of the base [rad]
double r_
distance to pose goal [m]
void publish(const boost::shared_ptr< M > &message) const
double dist_eps_
Error in distance above which pose is considered different.
bool getPoseDiff()
Determines the pose difference in polar coordinates.
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
double k_2_
constant factor applied to the heading error feedback
static double getYaw(const Quaternion &bt_q)
tf::TransformListener tf_listener_
tf used to get goal pose relative to the base pose
TFSIMD_FORCE_INLINE const tfScalar & getY() const
ros::Subscriber enable_controller_subscriber_
subscriber for enabling the controller
double orient_eps_
Error in orientation above which pose is considered different.
void setControlOutput()
Calculates the controller output based on the current pose difference.
std::string base_frame_name_
frame name of the base
tf::StampedTransform tf_goal_pose_rel_
transform for the goal pose relative to the base pose
double w_
angular base velocity [rad/s]
double w_min_
(current) minimum angular base velocity [rad/s]
void controlMaxVelCB(const std_msgs::Float32ConstPtr msg)
Callback for updating the controller's maximum linear control velocity.
double cur_
path to goal curvature
bool pose_reached_
True, if pose has been reached (v == 0, w == 0)
double theta_
direction of the pose goal [rad]
void spinOnce()
Calculates velocity commands to move the diff-drive base to the (next) pose goal. ...
double v_max_
maximum linear base velocity [m/s]
virtual void setInput(double distance_to_goal, double delta, double theta)
Set input of controller. Should be called before each spinOnce.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
double w_min_movement_
minimum angular base velocity at which we still move [rad/s]
double v_min_
(current) minimum linear base velocity [m/s]
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
#define ROS_WARN_STREAM_THROTTLE(rate, args)
virtual void onGoalReached()
Publishes goal is reached message.
ros::Publisher pose_reached_publisher_
publishes the status of the goal pose tracking
ros::Publisher command_velocity_publisher_
publisher for sending out base velocity commands
std::string goal_frame_name_
frame name of the goal (pose)
ros::Subscriber control_velocity_subscriber_
subscriber for setting the controller's linear velocity
#define ROS_INFO_STREAM(args)
void enableCB(const std_msgs::StringConstPtr msg)
Callback for enabling the controler.
double orient_thres_
lower bound for the orientation (w = 0)
bool getParam(const std::string &key, std::string &s) const
double v_
linear base velocity [m/s]
TFSIMD_FORCE_INLINE const tfScalar & getX() const
double w_max_
maximum angular base velocity [rad/s]
double dist_thres_
lower bound for the distance (v = 0)
double k_1_
constant factor determining the ratio of the rate of change in theta to the rate of change in r ...
void disableCB(const std_msgs::EmptyConstPtr msg)
Callback for disabling the controler.
double heading(geometry_msgs::Point p)
virtual bool step()
Execute one controller step.