44 for (
const auto & pc : p.precondition )
52 if(count <= pc.stepCondition)
70 if ( pathCounter_ < path_->size() )
79 if ( pathCounter_ >=
path_->size() )
81 ROS_INFO(
"Multi Robot Controller: goal reached" );
109 float theta = atan2( _odom.
y - (*
path_)[pathCounter_].y, _odom.
x - (*
path_)[pathCounter_].x );
112 float d_theta_comp = M_PI / 2 + d_theta;
113 float distance_to_goal = sqrt( ( _odom.
x - (*
path_)[pathCounter_].x ) * ( _odom.
x - (*
path_)[pathCounter_].x ) + ( _odom.
y - (*
path_)[pathCounter_].y ) * ( _odom.
y - (*
path_)[pathCounter_].y ) );
114 float turn_radius_to_goal =
absolute( distance_to_goal / 2 / cos( d_theta_comp ) );
131 if (
absolute( d_theta ) > M_PI / 4 )
135 else if ( turn_radius_to_goal < 10 * distance_to_goal )
137 float v_h = turn_radius_to_goal *
absolute(
w_ );
165 while ( _angle > M_PI )
170 while ( _angle < -M_PI )
bool checkPrecondition(PathPoint p)
void setState(state s)
Set the State (run stop step wait_step)
void setGoalRadius(float _r)
Set the Goal Radius.
void setSpeedParams(float _max_v, float _max_w)
Set the Speed Params of the controller.
SegmentController()
Construct a new Segment Controller object.
std::shared_ptr< std::vector< PathPoint > > path_
float normalizeAngle(float _angle)
void update(PathPoint _odom, float _delta_t)
updates the controller with the current robot position
int getCount()
Returns the checkpoint number the robot is in.
void setPID(float _Kp, float _Ki, float _Kd)
sets the control parameters
enum velocity_controller::state_t state
std::vector< int > actualPreconditions
void updatePrecondition(PathPrecondition pc)
updates the sync step of other robots
float absolute(float _val)
bool checkGoal(PathPoint _odom)
void setPath(std::shared_ptr< std::vector< PathPoint >> _path)
Set the path the contorler has to follow.
void getSpeed(float *_v, float *_w)
Returns the current speed values.