oplet write - abdullin/Dexter GitHub Wiki

The Write (w) oplet writes low level values to the FPGA / Gateware and in some cases also sets variables in the firmware. This is the lower case 'w'; the upper case 'W' is Write to Robot. The second parameter (the value) is written to the address of the FPGA specified by the first parameter. e.g. w 42 64 writes the value 64 into the address 42 in the FPGA. Some addresses are also "tracked" by the C firmware (DexRun) for example, w 5 6516872 writes a new value to FPGA register #5, ACCELERATION_MAXSPEED but the maxSpeed and coupledAcceleration variables in DexRun will also be updated. For higher level settings in the Firmware, see the 'S' oplet

Note: This represents the "virtual" address list as used by the 'w' command. The actual FPGA addresses have been changed since 2018.05.29 to use a "keyhole window" to reduce the number of mapped addresses used by the FPGA. In the keyhole system, one address in a block will select what the next address actually changes. DexRun.c still interprets 'w' commands with the original addresses when the function has not been converted to a keyhole system via the array "OldMemMapInderection". Items which have been struck out below are not available via 'w' and must be set via other commands which are linked here.

Addr Name Description
0 BASE_POSITION_AT J1 Motor position index
1 END_POSITION_AT J2 ...where the joint has been
2 PIVOT_POSITION_AT J3 ...commanded to go to
3 ANGLE_POSITION_AT J4 ...Use the "a" oplet
4 ROT_POSITION_AT J5
5 ACCELERATION_MAXSPEED Acceleration [20:31] and max speed [0:19] (shared register). Use the oplet S AngularAcceleration and Use oplet S AngularSpeed
6 BASE_SIN_CENTER J1 DC bias parameters
7 BASE_COS_CENTER J1 ...Use the "W" or write-to-robot oplet
8 END_SIN_CENTER J2 to write the AdcCenters.txt file.
9 END_COS_CENTER J2
10 PIVOT_SIN_CENTER J3
11 PIVOT_COS_CENTER J3
12 ANGLE_SIN_CENTER J4
13 ANGLE_COS_CENTER J4
14 ROT_SIN_CENTER J5
15 ROT_COS_CENTER J5
16 PID_DELTATNOT delta t not. Inverse of Delta t. 100,000KHz
17 PID_DELTAT delta t. float * 0.0001 seconds
18 PID_D PID Differential Term
19 PID_I PID Integral Term
20 PID_P PID Proportional Term in Floating point. Use SetParameter oplet S J#PID_P
21 PID_ADDRESS Sets the joint number for the above PID_ settings to be written into. Multiple sets are available for PID_SCHEDULE_INDEX
22 BOUNDRY_BASE Maximum position past which the force position override will be reduced for each joint.
23 BOUNDRY_END Injects a negative force opposing the external force to limit the amount the joint will move to avoid external forces.
24 BOUNDRY_PIVOT The low boundary is [0:15] and the high boundary is [16:31]
25 BOUNDRY_ANGLE Changed along with TDInt branch via a keyhole to make low and high boundary +-18 bits (19 bits total) each.
26 BOUNDRY_ROT " Use B oplet to set all joint boundaries or SetParameter oplet: S J#Boundry[High|Low]
27 SPEED_FACTORA Multiplier (coefficient / master gain) for the force calculator. Allows quick adjustments.
28 SPEED_FACTORB BETA_XYZ Was SPEED_FACTORB, now BETA_XYZ: Reactivity of the boundary for Joints 1-3. Resistance to movement will be like a marshmallow vs brick wall. See also DIFF_FORCE_BETA
29 FRICTION_BASE Coefficient to scale the position error. Can be negative.
30 FRICTION_END Feels like friction. Used in most modes, very important in follow mode.
31 FRICTION_PIVOT " Use SetParameter oplet: S J#Friction
32 FRICTION_ANGLE "
33 FRICTION_ROT "
34 MOVE_TRHESHOLD Maximum force before joint 1,2,3 position starts changing. See follow mode.
35 F_FACTOR Like SPEED_FACTORA, but for PID controller. Affects all joints at once.
36 MAX_ERROR Speed limit for PID controller. Clips the velocity of the step signals going to the motor. eg. w, 36, (2000 ^ (PID_max_speed_degrees * 312))
37 FORCE_BIAS_BASE Adds to the force (position error) on each joint. Useful for removing the force of gravity.
38 FORCE_BIAS_END Also used to provide haptic force feedback in teleoperation or VR systems.
39 FORCE_BIAS_PIVOT " Use SetParameter oplet: S J#Force
40 FORCE_BIAS_ANGLE "
41 FORCE_BIAS_ROT "
42 COMMAND_REG control state register. Bits:
0 CMD_CAPCAL_BASE 1
1 CMD_CAPCAL_END 2
2 CMD_CAPCAL_PIVOT 4
3 CMD_MOVEEN 8
4 CMD_MOVEGO 16
5 CMD_ENABLE_LOOP 32
6 CMD_CLEAR_LOOP 64
7 CMD_CALIBRATE_RUN 128
8 CMD_RESET_POSITION 256
9 CMD_RESET_FORCE 512
10 CMD_CAPCAL_ANGLE 1024
11 CMD_CAPCAL_ROT 2048
12 CMD_ANGLE_ENABLE 4096
13 CMD_ROT_ENABLE 8196
see cmd calc
43 DMA_CONTROL Used to read and write tables and other large data objects. Bits:
0 DMA_WRITE_ENQUEUE 1
1 DMA_WRITE_INITIATE 2
2 DMA_READ_DEQUEUE 4
3 DMA_READ_BLOCK 8
4 DMA_RESET_ALL 16
44 DMA_WRITE_DATA
45 DMA_WRITE_PARAMS
46 DMA_WRITE_ADDRESS
47 DMA_READ_PARAMS
48 DMA_READ_ADDRESS
49 REC_PLAY_CMD Bits:
0 CMD_RESET_RECORD 1
1 CMD_RECORD 2
2 CMD_RESET_PLAY 4
3 CMD_PLAYBACK 8
4 CMD_RESET_PLAY_POSITION
50 REC_PLAY_TIMEBASE
51 DIFF_FORCE_TIMEBASE (Now MAXSPEED_XYZ) Timebase for PID and Force calculators. Depreciated
52 DIFF_FORCE_BETA Reactivity of the boundary for the differential. Resistance to movement will be like a marshmallow vs brick wall. See also XYZ_BETA
53 DIFF_FORCE_MOVE_THRESHOLD Maximum force before joint 4, 5 position starts changing. See follow mode.
54 DIFF_FORCE_MAX_SPEED Maximum speed the force calculator can generate. Like MAX_ERROR (but for force, not PID)
55 DIFF_FORCE_SPEED_FACTOR_ANGLE Multiplier (coefficient / master gain) for the force calculator on J4. Like SPEED_FACTORA
56 DIFF_FORCE_SPEED_FACTOR_ROT Multiplier (coefficient / master gain) for the force calculator on J5. Like SPEED_FACTORA
57 DIFF_FORCE_ANGLE_COMPENSATE (Now EXTRUDER_CONTROL) Unused. Since 2019: Drive the extra stepper driver output labeled "external" on the green board
make_ins("w", 57, 300001) //Spin backwards at speed 300000
make_ins("w", 57, 300000) //Spin forward at speed 300000
make_ins("w", 57, 0) //Stops
A good range is 50000 (slow) to 500000 (fast). Odd speeds are backwards, even are forwards. It spins until speed is set to 0 so position based control is not supported. Coordinated with other joints, so a move all joints (a) command is required after.
58 FINE_ADJUST_BASE Position offset to commanded joint angle into the PID.
59 FINE_ADJUST_END Has the same effect as offsetting the error signal.
60 FINE_ADJUST_PIVOT Allows moves to be made by the PID only vs the coupled acceleration calculator + PID
61 FINE_ADJUST_ANGLE " See PID_MOVE. Use the "P" oplet
62 FINE_ADJUST_ROT "
63 RECORD_LENGTH Length of the recording to be played back
64 END_EFFECTOR_IO Controls the configuration of the bits that go to the end effector. See End-Effectors, Issue 73
65 SERVO_SETPOINT_A PWM value in PWM mode on end effector pins.
66 SERVO_SETPOINT_B " See Issue 73
67 BASE_FORCE_DECAY How hard the joint tries to return to the commanded position when the position.
68 END_FORCE_DECAY has been changed to avoid exceeding the maximum force.
69 PIVOT_FORCE_DECAY Subtracts out the offset introduced by the force controller.
70 ANGLE_FORCE_DECAY See Protect mode
71 ROTATE_FORCE_DECAY "
72 PID_SCHEDULE_INDEX Gain scheduling. Changes the offset to the PID parameters. Multiplies PID_ADDRESS. To quickly change settings.
73 GRIPPER_MOTOR_CONTROL PWM output from 7 pin SIL connector on the side (near bottom) of the motor board. Just the first bit is used to enable / disable.
74 GRIPPER_MOTOR_OFF_WIDTH " Use oplet S GripperMotor
75 GRIPPER_MOTOR_ON_WIDTH " See Issue 73
76 START_SPEED Starting speed into this move. Use oplet S AngularSpeedStartAndEnd
77 ANGLE_END_RATIO Difference in the transmission ratios for the differential joint.
78 RESET_PID_AND_FLUSH_QUEUE bit 0 resets PID_DELTA. Bit 1 is E_STOP? Set to all zero for normal operation.
79 XYZ_FORCE_TIMEBASE Timebase Divisor
80 DIFFERENTIAL_FORCE_TIMEBASE Timebase Divisor
81 PID_TIMEBASE Timebase Divisor
⚠️ **GitHub.com Fallback** ⚠️