• Diff for "PR2 Manual/Chapter7"
Differences between revisions 15 and 16
Revision 15 as of 2011-03-28 20:14:21
Size: 4325
Editor: MeloneeWise
Comment:
Revision 16 as of 2012-10-05 18:18:18
Size: 4325
Editor: MeloneeWise
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
#pragma section-numbers 7 #pragma section-numbers 2

PR2 Motion Control

PR2 motion control describes the electrical and mechanical hardware in combination with software to produce the desired joint effort, position, or velocity control. Figure 7.1 shows the hardware and software layer interaction, as well as the realtime and non-realtime processes that occur in the motion control loop.

The PR2 motion control layout.

Figure 7.1: The PR2 motion control layout.

1. Motor Controller Boards

Each motor/encoder on the PR2 has its dedicated Motor Controller Board (MCB). The MCB detects and counts transitions in the encoder signal, measures the motor current, and commands the voltage going to the motor. Each MCB runs a PI-control loop to control the motor current to a desired value, by commanding the motor voltage. This control loop is closed at 100kHz on an FPGA on the MCB. A shared EtherCAT realtime Ethernet link with the first computer allows all MCBs in the PR2 to communicate with the main computers with deterministic timing.

Each MCB has the following inputs and outputs:

  • Encoder Input

    • Each MCB can read quadrature incremental encoder input. In proper operation, this should never skip or drift.
  • Power Input

    • Each MCB is connected to the raw battery-power bus, and using the circuit breakers there can be a switch between "enabled", which provides 44-80VDC to the MCB and allows it to drive the motor, "standby", which provides 18 VDC to the MCB and allows it to continue to communicate and read sensors but does not allow driving the motors, and "disabled", which turns off power to the MCB altogether.
  • Digital Input

    • Each MCB has a digital input which is used for detecting the flags at the calibration positions on power-up. The MCB internally latches the encoder counts at the time that the digital input transitions from high to low and from low to high, which accurate detection of calibration flag positions.
  • Digital Output

    • Each MCB has a digital output. On the gripper, this is used to control the LED mounted in the hand. Elsewhere in the robot, this is used to generate synchronization pulses which allows synchronizing the cameras, the projector, and the motion control systems together.
  • Motor Output

    • Each MCB can drive a single brushed DC motor. The MCB drives the output with an H-bridge and uses a current-measurement to do closed-loop current control on the motor.
  • SPI

    • There are two SPI ports which are only available on the gripper MCB's and which are used to connect to the fingertip sensors.

2. Realtime Loop

The realtime loop for the PR2 is a single process, which can be found in the pr2_ethercat package. At runtime, the node is called the realtime loop.

This process uses the RT PREEMPT extensions to the Linux kernel to run as a hard realtime process, with a cycle time of 1ms, and performs both controller update computations and communication over EtherCAT with the MCBs. Non-real-time threads within the same process are used to communicate over ROS to publish diagnostics, configure controllers, and otherwise control the behavior of the PR2's motion-control system.

3. Controller Manager

Within the realtime loop, the controller update is dealt with by a ROS component which contains both realtime and non-realtime functionality, called the controller manager, see the pr2_controller_manager for more information. Controller manager has an update step which is called by the realtime loop at 1khz which receives measured motor torques and positions and sends desired motor torques for the next cycle.

The controller manager includes the joint-limit safety code that enforces position, velocity, and torque limits which are necessary to keep the PR2 from damaging its hardware. In addition, it has a dynamic plugin loading mechanism that allows shared libraries containing realtime controllers to be loaded and executed inside the 1kHz realtime loop.

PR2Wiki: PR2 Manual/Chapter7 (last edited 2012-10-05 18:18:18 by MeloneeWise)