Version 1 (modified by edison, 13 years ago) (diff)

--

BarrettHand BH8-280 RealTime Control

RealTime mode, also known as Loop-Control mode, is the second control method for the BarrettHand™. This control mode allows you to send control data and receive feedback data continuously, without waiting for the motors to stop moving. Any desired control law can be implemented within the host computer by calculating the desired motor control reference, sending the control block with the control reference to the hand, waiting for the requested feedback data, and then repeating this update process. The control bandwidth is a function of the amount of control data sent, the amount of feedback data requested, and how fast the communication is.

Control data from the host computer to the hand is grouped into control blocks; feedback data is grouped into feedback blocks. The structure of the control and feedback blocks is set by various finger and global properties. These are mostly Boolean flags but some are integer coefficients. The structure can only be changed in Supervisory mode; it cannot be changed while in RealTime mode. The BH8-280 hand operates similarly by setting a desired control reference and then sending a batch Get property for each feedback property that is to be received.

Overview of Serial Protocol

To enter RealTime mode, the host computer sends the Supervisory mode "LOOP" command, with an optional motor prefix specifying the motors to be controlled. The hand responds with an acknowledgment character ("*"), and then awaits control blocks, with or without control data. When a control block is received, if the control block requests a feedback block, then transmission of the feedback block is started. Once the complete control block is received it is acted upon, and then the hand waits for the next control block. The host should not send a second control block until the first one is acknowledged.

If the Hand software encounters an error, then the next time the Hand would send the "*" acknowledgment character to the host it instead sends "<CRLF>ERR" followed by the error value. It then returns to Supervisory mode.

To terminate RealTime mode, the host should send a single C character instead of the header character. This returns the Hand to Supervisory mode.

Control and Feedback Blocks

Control and feedback blocks consist of a header character, followed if desired by control data. If control data is included then it is sent for each motor selected for the LOOP command, in motor number order, followed by any global datum. For each motor, any of a set of data can be included. Whether or not a specific piece of data should be included is controlled by one of ten flag properties: "LCV", "LCPG", "LCT", "LFAIN", "LFBP", "LFV", "LFS", "LFAP", "LFDP" and "LFT." If a given property is true then its corresponding datum is included in the block; if not, then it is omitted. Four other properties, "LCVC", "LFVC", "LFDPC", and "LFDPD", modify specific data items.

Control Blocks

Control data from the host to the hand is grouped into control blocks. Each control block has a single byte header, optionally followed by a set of control data. The header specifies whether or not control data is to follow, and whether or not a feedback block is to be returned. The header can also terminate RealTime mode.

The possible header byte values are:

  • 'C' Control data follows; respond with a feedback block
  • 'c' Control data follows; respond with an acknowledgment character
  • 'A' No control data follows; respond with a feedback block
  • 'a' No control data follows; respond with an acknowledgment character
  • <C> Terminate RealTime mode

If the 'C' or 'c' header is used, then the header should be followed by control data. The user needs to choose the control mode themselves by setting LCV and LCPG flags to 1 or 0. If either of these are 1 then LCT must be 0 and if LCT is 1 then LCV and LCPG must be 0. Only one active control mode per motor is allowed. For each motor, the following different data values should be included in order if their corresponding flags are true:

  • LCV "Loop Control Velocity" Signed, 1 byte
  • LCPG "Loop Control Proportional Gain" Unsigned, 1 byte
  • LCT "Loop Control Torque" Signed, 2 bytes

The control data should be sent in a specific order: first all data for motor 1, then all for motor 2, then motor 3, and finally motor 4. Note that if a given motor was not specified in the initiating LOOP command, or if a specific value isn't enabled by the corresponding finger property, then the corresponding datum should not be transmitted.

If the LCV datum is included, then the hand will multiply it by the property LCVC before passing it on to the motor. Note: the hand treats an unscaled LCV datum as 4 bits of integer and 4 bits of fraction; this is different from an unscaled LFV datum, which is all integer.

Feedback Blocks

Data from the hand to the host is grouped into feedback blocks. Each feedback block has a single byte header ("*"), followed (if requested) by a set of feedback data. If the hand has encountered an error, then the header is replaced by "<CRLF>ERR ", followed by the error number; the hand then returns to supervisory command mode.

For each selected motor, six different data values are included in order if their corresponding finger properties are non-zero:

  • LFV "Loop Feedback Velocity" Signed, 1 byte
  • LFS "Loop Feedback Strain" Unsigned, 1 byte
  • LFAP "Loop Feedback Absolute Position" Unsigned, 2 bytes
  • LFDP "Loop Feedback Delta Position" Signed, 1 byte
  • LFBP "Loop Feedback Breakaway Position" Unsigned, 2 bytes
  • LFAIN "Loop Feedback Analog Input" Unsigned, 1 byte

In addition to the motor feedback data, there is a single global feedback datum, which is sent if its corresponding global property is non-zero:

  • LFT "Loop Feedback Temperature" Signed, 1 byte

The feedback data are sent in a specific order: first all data for motor 1, then all for motor 2, then motor 3, then motor 4, then any global datum. Note that if a given motor was not specified in the initiating LOOP command, or if a specific value isn't enabled by the corresponding finger or global property, then the corresponding datum is not transmitted.

If the LFV datum is included, then the hand will divide it by the property Loop LFVC before sending it to the host. Note: the hand treats an unscaled LFV datum as all integer; this is different from an unscaled LCV datum, which is treated as 4 bits of integer and 4 bits of fraction.

Loop Feedback Delta Position

The LFDP ("Loop Feedback Delta Position") datum is a special case. Each time a motor's position is queried using "FGET P", the reported position is remembered. In loop mode, if the LFDP property is non-zero then the present position is read and compared to the previously reported position. The difference is divided by the LFDPC ("Loop Feedback Delta Position Coefficient") property, clipped to a single signed byte, and then sent to the host. The host should then multiply the received value by LFDPC and then add it to the reported position.

The problem with using delta position is that the reported position can change at most by +127/-128 in each cycle. If the motor position changes more than this in a single cycle then the reported position will lag behind the actual position.

Example: say LFDPC is 2, the last reported position was 1500, and the position suddenly jumps to 2000. The first feedback block will include the delta position datum 127, which actually means 254; the hand will internally update the reported position to 1754. The next feedback block will include the delta position 123, which actually means 246; the reported position will be updated to 2000. Subsequent feedback blocks will include the delta position value 0 (until the next position change).

If desired, any unreported position change can be discarded by setting the LFDPD ("Loop Feedback Delta Position Discarded") global property to true. With this set, the above example would result in the single value 127 being sent to the host, followed by 0s.

Property Summary

Table 4 and Table 5 is a summary of the different motor and global properties, which affect RealTime mode. Most of the properties are flags, specifying whether a specific datum is to be present in a control or feedback block. The four remaining properties are coefficients or flags, which affect how the firmware interprets or generates a datum.

Table 4 - RealTime Finger Control Properties for the BH8-262

PropertyNameTypeFunctionSize in Block
LCVLoop Control VelocityFlagIf True, RealTime control block will contain control velocity1 signed byte
LCVCLoop Control Velocity CoefficientCoefficient (1 to 255)LCV is multiplied by LCVC to determine control velocityN/A
LCPGLoop Control Proportional GainFlagIf True, RealTime control block will contain Proportional Gain1 unsigned byte
LCT Loop Control TorqueFlagIf True, RealTime control block will contain control torque2 bytes, signed
LFAIN Loop Feedback Analog InputFlagIf True, RealTime feedback block will contain analog input value1 unsigned byte
LFBP Loop Feedback Breakaway PositionFlagIf True, RealTime feedback block will contain breakaway position2 unsigned bytes
LFVLoop Feedback VelocityFlagIf True, RealTime feedback block will contain feedback velocity1 signed byte
LFVCLoop Feedback Velocity CoefficientCoefficient (1 to 255)Actual velocity is divided by LFVC to get LFVN/A
LFSLoop Feedback StrainFlagIf True, RealTime feedback block will contain strain information1 unsigned byte
LFAPLoop Feedback Absolute PositionFlagIf True, RealTime feedback block will contain absolute position2 unsigned bytes
LFDPLoop Feedback Delta PositionFlagIf True, RealTime feedback block will contain delta position1 signed byte
LFDPCLoop Feedback Delta Position CoefficientCoefficient (1 to 255)The actual delta position is divided by this to get LFDPN/A
LFDPDLoop Feedback Delta Position DiscardFlagIf true, any delta position overflow is discardedN/A

Table 5 - RealTime Global Control Properties

PropertyNameTypeFunctionSize in Block
LFTLoop Feedback Temp.FlagIf True, RealTime feedback block will contain temperature1 unsigned byte

Example

This application uses fingers 1 and 2, and the spread. The fingers will receive velocity control information and report strain and delta position. The spread will just report delta position. The feedback block will also include the present hand temperature. All relevant coefficients will be set to 1.

To set this, use the following commands:

	12FSET LCV 1 LCVC 1 LCPG 0 LCT 0 LFV 0 LFS 1 LFAP 0 LFDP 1 LFDPC 1

	4FSET LCV 0 LCT 0 LCPG 0 LFV 0 LFS 0 LFAP 0 LFDP 1 LFDPC 1

	PSET LFT 1

	124LOOP

The hand will then send a single "*" and wait for control blocks. Each control block will consist of three bytes:

  • "C" [Control data follows; respond with feedback block]
  • 1 signed byte of velocity for motor 1
  • 1 signed byte of velocity for motor 2

Each feedback block will consist of seven bytes:

  • "*"
  • 1 unsigned byte of strain for motor 1
  • 1 signed byte of delta position for motor 1
  • 1 unsigned byte of strain for motor 2
  • 1 signed byte of delta position for motor 2
  • 1 signed byte of delta position for motor 4
  • 1 unsigned byte of temperature

Each control block from the host will stimulate a feedback block from the hand. When the host is finished, it will send the single character C (0x03); the hand will respond by printing a prompt and waiting for a new command.