goPID.cpp
Go to the documentation of this file.
1 
10 #include <ctrl/goPID.hpp>
11 
12 
13 // Cf Controller::chooseVelocities(...)
14 void PIDreachCtrl::chooseVelocities(double& trans_vel, double& rot_vel,
15  std::ostream& log_str) {
16  // gets the goal
17  const State& goal = getGoal();
18  // estimate the distance and angle difference to goal's config,
19  // as well as its derivative and its integration
20  const iSeeML::rob::OrPtConfig& goal_config = goal.configuration(),
21  config = state.configuration();
22  const iSeeML::geom::Vector v
23  = goal_config.position() - config.position();
24  const double dist = v.length(), dir = v.orientation(),
25  // === Following formula may be changed ==========================
26  angle_diff = iSeeML::Object::mod2pi( dir + goal_config.orientation()
27  - config.orientation() ),
28  trans_vel_diff = goal.translationVelocity()
30  rot_vel_diff = goal.rotationVelocity()
32  // =================================================================
33  integr_dist += dist * time_step;
34  integr_angle_diff += angle_diff * time_step;
35  // computes the accelerations
36  const double trans_acc = trans_prop_coef * dist + trans_deriv_coef
37  * trans_vel_diff + trans_integ_coef * integr_dist,
38  rot_acc = rot_prop_coef * angle_diff + rot_deriv_coef
39  * rot_vel_diff + rot_integ_coef * integr_angle_diff;
40  // gets the goal's velocities
43  trans_acc, rot_acc, time_step);
44  // updates the parameters and send the update signal
45  updateVelocities(trans_vel, rot_vel);
46 } // end of void PIDreachCtrl::chooseVelocities(double&, ...) --------
double integr_dist
Integrated distance.
Definition: goPID.hpp:29
double trans_deriv_coef
Translation derivative coefficient.
Definition: goPID.hpp:24
const State & getGoal() const
Get the state which is aimed.
Definition: reach.hpp:62
const double & rotationVelocity() const
Gives the rotation velocity of the state.
Definition: state.hpp:81
const double time_step
The time step of the controller.
Definition: controller.hpp:39
double rot_integ_coef
Rotation integration coefficient.
Definition: goPID.hpp:26
const iSeeML::rob::OrPtConfig & configuration() const
Gives the configuration of the state.
Definition: state.hpp:67
double moving_velocity
Translation velocity desired for the robot.
Definition: controller.hpp:45
State state
The state of the robot.
Definition: reach.hpp:31
State goal
The state which is aimed.
Definition: reach.hpp:28
void updateVelocities(double &trans_vel, double &rot_vel)
Update the velocities from the fields and send the update signal.
Definition: controller.hpp:66
double rot_prop_coef
Rotation proportional coefficient.
Definition: goPID.hpp:25
const MotionModel & motion_model
The model of the motion.
Definition: controller.hpp:36
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...
Definition: motion.cpp:129
const double & translationVelocity() const
Gives the translation velocity of the state.
Definition: state.hpp:74
double trans_integ_coef
Translation integration coefficient.
Definition: goPID.hpp:23
This class defines a state, i.e. a configuration and its (translation and rotation) velocities...
Definition: state.hpp:22
double rot_deriv_coef
Rotation derivative coefficient.
Definition: goPID.hpp:27
double turning_velocity
Rotation velocity desired for the robot.
Definition: controller.hpp:47
PID controller reaching an oriented point.
void chooseVelocities(double &trans_vel, double &rot_vel, std::ostream &)
Computes new velocities for ROS node.
Definition: goPID.cpp:14
double trans_prop_coef
Translation proportional coefficient.
Definition: goPID.hpp:22
double integr_angle_diff
Integrated angle difference.
Definition: goPID.hpp:30


qt_ctrl
Author(s): Alexis Scheuer
autogenerated on Wed Dec 16 2020 15:51:32