-
Notifications
You must be signed in to change notification settings - Fork 8
Data communication in Pacer
Component plugins do not pass messages (data) to each other. Instead, each Component stores data centrally in Pacer. Components communicate through this medium by being run sequentially (Two-way talk is not allowed). There are two types of data:
- Generic data is saved in a map as a key (string), value pair. Denoted as
name.of.variablebelow - Specific robot data is stored more efficiently, these include:
- functions:
-
joint_value(unit)uses type:map< string , vector<double> >pairing Joint name with each degree of freedom's joint value. -
generalized_joint_value()uses type:vector<double>a vector of values for all joint degrees of freedom. This vector coincides with Pacer's virtual robot's generalized vector. -
base_value()uses type:vector<double>a vector of values for all floating base degrees of freedom (7 dof for position: (linear {x,y,z} , quaternion: {w,x,y,z}); 6 dof for velocity/acceleration (linear {x,y,z} , angular: {x-axis,y-axis,z-axis})). -
generalized_value()uses type:vector<double>a vector of values for all joint degrees of freedom concatenated with a vector of values for all floating base degrees of freedom. ([generalized_joint_value(),base_value()]) This vector coincides with Pacer's virtual robot's generalized vectors. -
foot_value(unit)uses type:map< string , vector<double> >pairing Foot link name with a vector of values for the 3 linear degrees of freedom of each foot link's origin. (NOTE: This may be extended to include orientation in the future)
-
- rules:
- all data stored using these functions are limited to the following units (enumerated in
Robot::unit_e):Robot::position,Robot::velocity,Robot::acceleration,Robot::load,Robot::position_goal,Robot::velocity_goal,Robot::acceleration_goal,Robot::load_goal - assignment of these values are flow controlled. Once a planner value:
position_goal,velocity_goal, andacceleration_goalhas been assigned, perception values:position,velocity,acceleration,loadbecome read-only. Likewise, once a controller value:load_goalhas been assigned, planner values become read only. This flow control is reset at the start of every control loop iteration.
- all data stored using these functions are limited to the following units (enumerated in
- functions:
An example of the data passing system at work: each of the following processes is run in order:
- SENSORS:
Writes: generalized_value(Robot::position), generalized_value(Robot::velocity), generalized_value(Robot::acceleration), generalized_value(Robot::load).
-
center-of-masscomponent plugin:
Reads: generalized_value(Robot::position).
Writes: Center of mass position state.center-of-mass.x
-
waypointcomponent plugin:
Reads: Center of mass position state.center-of-mass.x, Desired position waypoint.waypoint
Writes: Desired Planar (SE2) velocity (x,y,theta) SE2_command
-
gait-plannercomponent plugin:
Reads: Desired Planar (SE2) velocity (x,y,theta) SE2_command & gait parameters gait-planner.*
Writes: foot_value(Robot::position_goal), foot_value(Robot::velocity_goal), foot_value(Robot::acceleration_goal)
-
end-effectorcomponent plugin:
Reads: generalized_value(Robot::position), generalized_value(Robot::velocity)
Writes: foot_value(Robot::position), foot_value(Robot::velocity)
-
eef-PID-controllerend-effector Error Feedback (PID) controller component plugin:
Reads: foot_value(Robot::position), foot_value(Robot::velocity), foot_value(Robot::position_goal), foot_value(Robot::velocity_goal)
Writes: generalized_joint_value(Robot::load_goal)
- Apply commands to SIMULATION:
Reads: generalized_value(Robot::load_goal).
All data is stored by name in a map structure in Pacer. Use the get_data / set_data functions