Data communication in Pacer - PositronicsLab/Pacer GitHub Wiki

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.variable below
  • 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, and acceleration_goal has been assigned, perception values: position, velocity, acceleration, load become read-only. Likewise, once a controller value: load_goal has been assigned, planner values become read only. This flow control is reset at the start of every control loop iteration.

An example of the data passing system at work: each of the following processes is run in order:

  1. SENSORS:

Writes: generalized_value(Robot::position), generalized_value(Robot::velocity), generalized_value(Robot::acceleration), generalized_value(Robot::load).

  1. center-of-mass component plugin:

Reads: generalized_value(Robot::position).

Writes: Center of mass position state.center-of-mass.x

  1. waypoint component 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

  1. gait-planner component 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)

  1. end-effector component plugin:

Reads: generalized_value(Robot::position), generalized_value(Robot::velocity)

Writes: foot_value(Robot::position), foot_value(Robot::velocity)

  1. eef-PID-controller end-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)

  1. 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

⚠️ **GitHub.com Fallback** ⚠️