ARGoS  3
A parallel, multi-engine simulator for swarm robotics
dynamics2d_differentialsteering_control.cpp
Go to the documentation of this file.
1 
8 
9 namespace argos {
10 
11  /****************************************/
12  /****************************************/
13 
15  Real f_max_force,
16  Real f_max_torque,
17  Real f_interwheel_distance) :
18  CDynamics2DVelocityControl(c_engine, f_max_force, f_max_torque),
19  m_fInterwheelDistance(f_interwheel_distance) {}
20 
21  /****************************************/
22  /****************************************/
23 
25  Real f_right_wheel) {
26  /*
27  * THE DIFFERENTIAL STEERING SYSTEM
28  *
29  * check http://rossum.sourceforge.net/papers/DiffSteer/
30  * for details
31  *
32  * Equations:
33  *
34  * w = (Vr - Vl) / b
35  * v = [ ((Vr + Vl) / 2) cos(a),
36  * ((Vr + Vl) / 2) sin(a) ]
37  *
38  * where:
39  * a = body orientation
40  * w = body angular velocity
41  * v = body center linear velocity
42  * Vr = right wheel velocity
43  * Vl = left wheel velocity
44  * b = length of wheel axis
45  */
46  SetAngularVelocity((f_right_wheel - f_left_wheel) / m_fInterwheelDistance);
47  Real fVelocity = (f_right_wheel + f_left_wheel) * 0.5f;
48  CVector2 cVelocity(fVelocity * ::cos(m_ptControlledBody->a),
49  fVelocity * ::sin(m_ptControlledBody->a));
50  SetLinearVelocity(cVelocity);
51  }
52 
53  /****************************************/
54  /****************************************/
55 
56 }
argos::CDynamics2DDifferentialSteeringControl::CDynamics2DDifferentialSteeringControl
CDynamics2DDifferentialSteeringControl(CDynamics2DEngine &c_engine, Real f_max_force, Real f_max_torque, Real f_interwheel_distance)
Definition: dynamics2d_differentialsteering_control.cpp:14
argos
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
argos::CDynamics2DEngine
Definition: dynamics2d_engine.h:42
argos::CDynamics2DVelocityControl
Definition: dynamics2d_velocity_control.h:19
argos::CDynamics2DVelocityControl::SetLinearVelocity
void SetLinearVelocity(const CVector2 &c_velocity)
Definition: dynamics2d_velocity_control.cpp:101
argos::CDynamics2DVelocityControl::m_ptControlledBody
cpBody * m_ptControlledBody
Definition: dynamics2d_velocity_control.h:57
argos::CVector2
A 2D vector class.
Definition: vector2.h:25
dynamics2d_differentialsteering_control.h
argos::CDynamics2DVelocityControl::SetAngularVelocity
void SetAngularVelocity(Real f_velocity)
Definition: dynamics2d_velocity_control.cpp:116
Real
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
argos::CDynamics2DDifferentialSteeringControl::SetWheelVelocity
void SetWheelVelocity(Real f_left_wheel, Real f_right_wheel)
Definition: dynamics2d_differentialsteering_control.cpp:24