Changes between Initial Version and Version 1 of Hand/280/Realtime


Ignore:
Timestamp:
May 17, 2011, 8:42:46 PM (13 years ago)
Author:
edison
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Hand/280/Realtime

    v1 v1  
     1= BarrettHand BH8-280 !RealTime Control =
     2
     3!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.
     4
     5Control 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.
     6
     7== Overview of Serial Protocol ==
     8
     9To 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.
     10
     11If 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.
     12
     13To terminate !RealTime mode, the host should send a single ^C character instead of the header character.  This returns the Hand to Supervisory mode.
     14
     15== Control and Feedback Blocks ==
     16
     17Control 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.
     18
     19=== Control Blocks ===
     20
     21Control 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.
     22
     23The possible header byte values are:
     24
     25        * 'C'   Control data follows; respond with a feedback block
     26        * 'c'   Control data follows; respond with an acknowledgment character
     27        * 'A'   No control data follows; respond with a feedback block
     28        * 'a'   No control data follows; respond with an acknowledgment character
     29        * <^C>  Terminate !RealTime mode
     30
     31If 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:
     32
     33        * LCV   "Loop Control Velocity" Signed, 1 byte
     34        * LCPG  "Loop Control Proportional Gain"        Unsigned, 1 byte
     35        * LCT           "Loop Control Torque"   Signed, 2 bytes
     36
     37The 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.
     38
     39If 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.
     40
     41=== Feedback Blocks ===
     42
     43Data 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.
     44
     45For each selected motor, six different data values are included in order if their corresponding finger properties are non-zero:
     46
     47        * LFV   "Loop Feedback Velocity"        Signed, 1 byte
     48        * LFS   "Loop Feedback Strain"  Unsigned, 1 byte
     49        * LFAP  "Loop Feedback Absolute Position"       Unsigned, 2 bytes
     50        * LFDP  "Loop Feedback Delta Position"  Signed, 1 byte
     51        * LFBP  "Loop Feedback Breakaway Position"      Unsigned, 2 bytes
     52        * LFAIN         "Loop Feedback Analog Input"    Unsigned, 1 byte
     53
     54In addition to the motor feedback data, there is a single global feedback datum, which is sent if its corresponding global property is non-zero:
     55
     56        * LFT   "Loop Feedback Temperature"     Signed, 1 byte
     57
     58The 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.
     59
     60If 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.
     61
     62=== Loop Feedback Delta Position ===
     63
     64The 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.
     65
     66The 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.
     67
     68Example: 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).
     69
     70If 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.
     71
     72== Property Summary ==
     73Table 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.
     74
     75Table 4 - !RealTime Finger Control Properties for the BH8-262
     76||Property||Name||Type||Function||Size in Block||
     77||LCV||Loop Control Velocity||Flag||If True, !RealTime control block will contain control velocity||1 signed byte||
     78||LCVC||Loop Control Velocity Coefficient||Coefficient (1 to 255)||LCV is multiplied by LCVC to determine control velocity||N/A||
     79||LCPG||Loop Control Proportional Gain||Flag||If True, !RealTime control block will contain Proportional Gain||1 unsigned byte||
     80||LCT ||Loop Control Torque||Flag||If True, !RealTime control block will contain control torque||2 bytes, signed||
     81||LFAIN  ||Loop Feedback Analog Input||Flag||If True, !RealTime feedback block will contain analog input value||1 unsigned byte||
     82||LFBP ||Loop Feedback Breakaway Position||Flag||If True, !RealTime feedback block will contain breakaway position||2 unsigned bytes||
     83||LFV||Loop Feedback Velocity||Flag||If True, !RealTime feedback block will contain feedback velocity||1 signed byte||
     84||LFVC||Loop Feedback Velocity Coefficient||Coefficient (1 to 255)||Actual velocity is divided by LFVC to get LFV||N/A||
     85||LFS||Loop Feedback Strain||Flag||If True, !RealTime feedback block will contain strain information||1 unsigned byte||
     86||LFAP||Loop Feedback Absolute Position||Flag||If True, !RealTime feedback block will contain absolute position||2 unsigned bytes||
     87||LFDP||Loop Feedback Delta Position||Flag||If True, !RealTime feedback block will contain delta position||1 signed byte||
     88||LFDPC||Loop Feedback Delta Position Coefficient||Coefficient (1 to 255)||The actual delta position is divided by this to get LFDP||N/A||
     89||LFDPD||Loop Feedback Delta Position Discard||Flag||If true, any delta position overflow is discarded||N/A||
     90
     91Table 5 - !RealTime Global Control Properties
     92||Property||Name||Type||Function||Size in Block||
     93||LFT||Loop Feedback Temp.||Flag||If True, !RealTime feedback block will contain temperature||1 unsigned byte||
     94
     95
     96== Example ==
     97
     98This 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.
     99
     100To set this, use the following commands:
     101{{{
     102        12FSET LCV 1 LCVC 1 LCPG 0 LCT 0 LFV 0 LFS 1 LFAP 0 LFDP 1 LFDPC 1
     103
     104        4FSET LCV 0 LCT 0 LCPG 0 LFV 0 LFS 0 LFAP 0 LFDP 1 LFDPC 1
     105
     106        PSET LFT 1
     107
     108        124LOOP
     109}}}
     110The hand will then send a single "*" and wait for control blocks.  Each control block will consist of three bytes:
     111
     112        * "C" [Control data follows; respond with feedback block]
     113        * 1 signed byte of velocity for motor 1
     114        * 1 signed byte of velocity for motor 2
     115Each feedback block will consist of seven bytes:
     116        * "*"
     117        * 1 unsigned byte of strain for motor 1
     118        * 1 signed byte of delta position for motor 1
     119        * 1 unsigned byte of strain for motor 2
     120        * 1 signed byte of delta position for motor 2
     121        * 1 signed byte of delta position for motor 4
     122        * 1 unsigned byte of temperature
     123
     124Each 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.