11 #include <iSeeML/rob/ArrayPaths.hpp> 18 norm_dist = max_trans_vel * max_trans_vel / 2,
24 max_curv_deriv = max_rot_acc / max_trans_vel;
28 + iSeeML::rob::OrPtConfig(acc_dist, 0, 0),
30 + iSeeML::rob::OrPtConfig(- dec_dist, 0, 0);
31 path = iSeeML::rob::FscPath(start, end, max_curv, max_curv_deriv);
43 norm_dist = max_trans_vel * max_trans_vel / 2,
47 static iSeeML::rob::ArrayPaths globalPath(3);
49 const iSeeML::rob::OrPtConfig start =
path.start() +
50 iSeeML::rob::OrPtConfig(- acc_dist, 0, 0);
51 globalPath.setPath( 0,
true,
new iSeeML::rob::LinCurvPath
52 ( iSeeML::rob::CurvConfig(start, 0),
55 globalPath.setPath( 1,
false, (iSeeML::rob::Path*)( &
path.clone() ) );
57 globalPath.setPath( 2,
true,
new iSeeML::rob::LinCurvPath
58 ( iSeeML::rob::CurvConfig(
path.end(), 0),
70 norm_dist = max_trans_vel * max_trans_vel / 2,
71 acc_dist = norm_dist / max_trans_acc,
72 dec_dist = - norm_dist / max_trans_dec;
74 double t = 0, v = 0, om = 0, d = - acc_dist, tmp;
76 static std::list<State*> traject;
78 while (! traject.empty() ) {
79 free( traject.front() );
84 iSeeML::rob::OrPtConfig q =
path.start() +
85 iSeeML::rob::OrPtConfig(d, 0, 0);
86 traject.push_back(
new State(t, q, v, 0) );
89 d += v * time_step + tmp * dt2;
92 d -= (v - max_trans_vel) * dt2;
96 iSeeML::rob::CurvConfig q =
path[d];
97 traject.push_back(
new State(t, q, v, q.curvature() * v) );
103 tmp = sqrt(-2 * d * max_trans_dec);
108 iSeeML::rob::OrPtConfig q =
path.end() +
109 iSeeML::rob::OrPtConfig(d, 0, 0);
110 traject.push_back(
new State(t, q, v, 0) );
113 d += v * time_step + tmp * dt2;
116 iSeeML::rob::OrPtConfig q =
path.end() +
117 iSeeML::rob::OrPtConfig(dec_dist, 0, 0);
118 traject.push_back(
new State(t, q, 0, 0) );
125 std::ostream& log_str) {
130 norm_dist = max_trans_vel * max_trans_vel / 2,
131 acc_dist = norm_dist / max_trans_acc,
132 dec_dist = - norm_dist / max_trans_dec,
185 const double lookahead =
time_step * max_trans_vel,
186 arc_length =
distance - acc_dist + lookahead;
188 double length =
path.length() - 1E-6, s = arc_length > length
189 ? length : arc_length, curv =
path[s].curvature();
191 if (fabs(curv) <
path.maxCurv() * 1E-3)
198 path.maxCurv(),
path.maxCurvDeriv() );
200 if (new_path.length() < 1.2 * (length -
distance + acc_dist) ) {
204 length =
path.length() - 1E-6;
206 s = lookahead > length ? length : lookahead;
207 curv =
path[s].curvature();
const iSeeML::rob::Path & getPath() const
Get the path to the aimed oriented point.
void setGoal(const State &goal)
Set the state which is aimed.
void stopMotion()
Stops the robot (i.e. sets both velocities to zero).
Oriented point reaching controller class using a smooth path generator.
const std::list< State * > & getAimedTrajectory() const
Transform the planned path into an aimed trajectory.
const double & maxTranslAcc() const
Descriptive method, giving the maximum translation acceleration.
const State & getGoal() const
Get the state which is aimed.
const double & maxRotVel() const
Descriptive method, giving the maximum rotation velocity.
const double time_step
The time step of the controller.
const iSeeML::rob::OrPtConfig & configuration() const
Gives the configuration of the state.
virtual void setGoal(const State &new_goal)
Set the state which is aimed.
const double & minRotAcc() const
Descriptive method, giving the minimum rotation acceleration (or maximum rotation deceleration)...
double distance
The distance already covered.
double moving_velocity
Translation velocity desired for the robot.
State state
The state of the robot.
const double & minTranslAcc() const
Descriptive method, giving the minimum translation acceleration (or maximum translation deceleration)...
void updateVelocities(double &trans_vel, double &rot_vel)
Update the velocities from the fields and send the update signal.
iSeeML::rob::FscPath path
The computed smooth path.
const MotionModel & motion_model
The model of the motion.
void applyAccelerations(double &trans_vel, double &rot_vel, const double &trans_acc, const double &rot_acc, const double &time_step) const
Modify translation and rotation given velocities, applying the given accelerations during the given t...
const double & translationVelocity() const
Gives the translation velocity of the state.
void pathChanged()
Update the display of the path.
const double & date() const
Gives the configuration of the state.
This class defines a state, i.e. a configuration and its (translation and rotation) velocities...
const double & maxTranslVel() const
Descriptive method, giving the maximum translation velocity.
double turning_velocity
Rotation velocity desired for the robot.
void chooseVelocities(double &trans_vel, double &rot_vel, std::ostream &)
Computes new velocities for ROS node.
double total_distance
The distance to cover.
const double & maxRotAcc() const
Descriptive method, giving the maximum rotation acceleration.