I ran into some issues with the T-Hex 4DOF code and setup. I will work on my version of a work around, but thought I would mention it here and then later on the public beta thread…
With the 4DOF legs, we first go through and first find the servo offsets and then we move two of the servos by 1 click (15 degrees). When Zenta did this originally he simply added some offsets into his code to compensate for it. If he was using the servo offsets, which are limited to less than 15 degrees, he then added some code to the T-Hex 4DOF code that compensated for these 15 degree changes. In particular:
In the config file:
;--------------------------------------------------------------------
;[Joint offsets]
;First calibrate the servos in the 0 deg position using the SSC-32 reg offsets, then:
cFemurHornOffset con 150 ;Snap out the horn one click upward
cTarsHornOffset con 150 ;Snap out the horn one click inward
And in the main code he changed:
;IKFemurAngle
FemurAngle1(LegIKLegNr) = -(IKA14 + IKA24) * 180 / 3141 + 900 + cFemurHornOffset
...
TarsAngle1(LegIKLegNr) = (TarsToGroundAngle1 + FemurAngle1(LegIKLegNr) - TibiaAngle1(LegIKLegNr))
To make this more table driven, to allow per leg configuration, I changed our current 2.1 code, to make it Table driven…
That is I added to my config file:
[code];--------------------------------------------------------------------
;[Joint offsets]
;First calibrate the servos in the 0 deg position using the SSC-32 reg offsets, then:
cXXFemurHornOffset con 150 ;Snap out the horn one click upward
cXXTarsHornOffset con 150 ;Snap out the horn one click inward
; Set up to have per leg offsets…
cRRFemurHornOffset1 con 0 ;cXXFemurHornOffset
cRRTarsHornOffset1 con 0 ;cXXTarsHornOffset
cRMFemurHornOffset1 con cXXFemurHornOffset
cRMTarsHornOffset1 con cXXTarsHornOffset
cRFFemurHornOffset1 con cXXFemurHornOffset
cRFTarsHornOffset1 con cXXTarsHornOffset
cLRFemurHornOffset1 con 0; cXXFemurHornOffset
cLRTarsHornOffset1 con 0; cXXTarsHornOffset
cLMFemurHornOffset1 con cXXFemurHornOffset
cLMTarsHornOffset1 con cXXTarsHornOffset
cLFFemurHornOffset1 con cXXFemurHornOffset
cLFTarsHornOffset1 con cXXTarsHornOffset
[/code]
Note: I hacked on my version here to set 2 legs to zero as they do not have any offset… Still old leg…
I then defined the cFemurHornOffset as a swordtable and then changed the code like above except use LegIndex…
; Servo Offset Table
ccFemurHornOffset1 swordTable cRRFemurHornOffset1, cRMFemurHornOffset1, cRFFemurHornOffset1, cLRFemurHornOffset1, cLMFemurHornOffset1, cLFFemurHornOffset1
#ifdef c4DOF
ccTarsHornOffset1 swordTable cRRTarsHornOffset1, cRMTarsHornOffset1, cRFTarsHornOffset1, cLRTarsHornOffset1, cLMTarsHornOffset1, cLFTarsHornOffset1
#endif
Now I have a couple of options here. Example could change the swordtable above something like:
; Servo Offset Table
#ifdef cRRFemurHornOffset1 ; Per leg definitions...
ccFemurHornOffset1 swordTable cRRFemurHornOffset1, cRMFemurHornOffset1, cRFFemurHornOffset1, cLRFemurHornOffset1, cLMFemurHornOffset1, cLFFemurHornOffset1
#else
ccFemurHornOffset1 swordtable 0, 0, 0, 0, 0, 0
#endif
Note: this change is helping the CHR with T-HEx 4 legs walk better… Note: I have not check out T-Hex 3 to see if it needs something like this as well.
Suggestions?
Kurt