5 #define NSEC_2_SECS(A) ((float)A / 1000000000.0) 7 int main(
int argc,
char** argv)
27 ROS_INFO(
"Please specifie name \nrosrun simple_velocity_controller velocity_controller [name]");
79 pt.
x = _pose->pose.pose.position.x;
80 pt.
y = _pose->pose.pose.position.y;
82 tf::Quaternion q(_pose->pose.pose.orientation.x, _pose->pose.pose.orientation.y, _pose->pose.pose.orientation.z,
83 _pose->pose.pose.orientation.w);
85 double roll, pitch, yaw;
86 m.
getRPY(roll, pitch, yaw);
96 geometry_msgs::Twist msg;
108 if (_path->poses.size() == 0)
115 float nearest_dist = std::numeric_limits<float>::max();
118 auto it = _path->poses.begin();
137 std::vector<PathPoint> path;
138 for (; it != _path->poses.end(); ++it)
142 tf::Quaternion q(it->pose.orientation.x, it->pose.orientation.y, it->pose.orientation.z, it->pose.orientation.w);
144 double roll, pitch, yaw;
145 m.
getRPY(roll, pitch, yaw);
147 pt.
x = it->pose.position.x;
148 pt.
y = it->pose.position.y;
154 setPath(std::make_shared<std::vector<PathPoint>>(path));
159 std::string
s = _cmd.data;
161 ROS_INFO(
"Multi Robot Controller: received %s", s.c_str());
162 if (s.compare(
"run") == 0)
166 else if (s.compare(
"stop") == 0)
170 else if (s.compare(
"step") == 0)
void publish(const boost::shared_ptr< M > &message) const
ros::NodeHandle n_param_
Node handler to the current node.
void setPath(std::shared_ptr< std::vector< PathPoint >> _path)
Set the path the contorler has to follow.
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ros::Publisher pubCmdVel_
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void subPoseCb(const geometry_msgs::PoseWithCovarianceStampedConstPtr &_pose)
std::string topic_cmdVel_
void setState(state s)
Set the State (run stop step wait_step)
void subPathCb(const nav_msgs::Path::ConstPtr &_path)
void setPID(float _Kp, float _Ki, float _Kd)
sets the control parameters
void getSpeed(float *_v, float *_w)
Returns the current speed values.
void subCtrlCb(const std_msgs::String _cmd)
void getRPY(tfScalar &roll, tfScalar &pitch, tfScalar &yaw, unsigned int solution_number=1) const
void setSpeedParams(float _max_v, float _max_w)
Set the Speed Params of the controller.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ControllerNode(ros::NodeHandle &n)
Construct a new Controller Node object.
TFSIMD_FORCE_INLINE const tfScalar & w() const
void setGoalRadius(float _r)
Set the Goal Radius.
void update(PathPoint _odom, float _delta_t)
updates the controller with the current robot position
bool getParam(const std::string &key, std::string &s) const
ROSCPP_DECL void spinOnce()