I have an older version of SQ3 quad (non symmetric one). I have managed to implement statically stable walking gait by solving IK equations. My implementation moves the legs stops and moves the body and completes the movement cycle in two phases.
You can check the video of the implementation here.
I want to improve the walking and need some further input. I want to make gait cycle to be completed in four phases. Similar to one here. However haven’t succeeded yet. The closest one that I did is here. You can clearly see that how I’m shifting the weight from left-to-right, right-to-left while walking which doesn’t look good.
Do you guys think that I need some dynamics to achieve walking sequence which moves the body constantly in a straight line? If so could you please point me to the correct resources? If not can you please provide me some input to fix the balance of the robot? I’m kind of stuck at the moment.
I’m using following method to calculate IK values for each leg and body.
// a1 = length of first link
// a2 = length of second link
// a3 = length of third link
θ1 = arctan2(z, x)
A = -y
B = a1-(xCos(θ1)+zSin(θ1))
D = (2a1(xCos(θ1)+zSin(θ1))+a3a3-a2a2-a1a1-yy-(xCos(θ1)+zSin(θ1))(xCos(θ1)+zSin(θ1)))/(2a2)
θ2 = -arctan2(B,A) + arctan2(D, ±sqrt(AA+BB-DD)
θ3 = arctan2(y-a2Sin(θ2), xCos(θ1)+zSin(θ1)-a2Cos(θ2)-a1)-θ2
During the walk cycle I’m changing the coordinates of body and legs to have it walk. Here is the high level pseudo code for this sequence. I’am using right handed coord system. Negative Z is from robot head to forward, positive Y is from robot to up, positive Z is from robot to right. Units are in inches.
Reset position
**Body.position.x -= 1.0f; // shift body left
**Wait until move completes
// Phase 1
RearRightLeg.position.y += 2.0f; // raise leg
Wait until move completes
RearRightLeg.position.z -= 4.5f; // move leg to forward
Body.position.z -= 1.5f; // shift body forward
Wait until move completes
RearRightLeg.position.y -= 2.0f; // lower leg
// Phase 2
FrontRightLeg.position.y += 2.0f; // raise leg
Wait until move completes
FrontRightLeg.position.z -= 4.5f; // move leg to forward
Body.position.z -= 1.5f; // shift body forward
Wait until move completes
FrontRightLeg.position.y -= 2.0f; // lower leg
**Body.position.x += 2.0f; // shift body right
**Wait until move completes
// Phase 3
RearLeftLeg.position.y += 2.0f; // raise leg
Wait until move completes
RearLeftLeg.position.z -= 4.5f; // move leg to forward
Body.position.z -= 1.5f; // shift body forward
Wait until move completes
RearLeftLeg.position.y -= 2.0f; // lower leg
// Phase 4
FrontLeftLeg.position.y += 2.0f; // raise leg
Wait until move completes
FrontLeftLeg.position.z -= 4.5f; // move leg to forward
Body.position.z -= 1.5f; // shift body forward
Wait until move completes
FrontLeftLeg.position.y -= 2.0f; // lower leg
**Body.position.x -= 1.0f; // shift body left to center it
**Wait until move completes
If I remove the lines which I marked with “**” robot loses its stability and falls.
At this time we don’t have any specific walking algorithms on which to base your code, but hope to develop some and release them later.
The current Phoenix code for the SQ3 requires a BotBoarduino and/or SSC-32 (with FlowBotics Studio): lynxmotion.com/images/html/sq3u-assembly.htm
Do you have a video which shows the Phoenix code in action (for 4 legged robots)? No worries, I can read and convert any type of software from one to another. Before doing that I want to make sure that it is what I need. Are you also sure that it is software related? Could it be something else that I might be missing?
The quadruped walking is a subset of the hexapod gait. Quite a few hexapod examples here: youtube.com/user/robots7
The issue really does seem to relate to the code / programming since the robot can support its own weight and seems to have enough power.
Currently no specific suggestions other than contacting the creator. We have a few experts here on walking gaits, so hopefully they might provide some input.
Ideally the person who uploaded the video (painrose) would be the creator of that robot. It does not use Lynxmotion parts, so we don’t have any relationship with that robot.
The gait in the video is not identital to that used in the Lynxmotion SQ3, and unfortunately the SQ3 walking gait is not easily modified since it is coordinate based.
If you want to try to use the SQ3 code, you will need either the BotBoarduino + SSC-32U+PS2v4 or SSC-32U+Bluetooth+FlowBotics Studio.
Not quite - the leg positions within the code are dictated by actual angles (sorry if the term coordinates was confusing - the angles were based on kinematics of course and foot positions), not equations.
The gait would look like this (but four legs rather than six): youtube.com/watch?v=kFhvghX3LY0
Thanks for the feedback. I made some progress with here (with body shifting) and here (without body shifting).
To make it better, I checked the code to see how it is implemented. I wish you had better quality code. Really difficult to follow it . Never mind, here is my question:
It defines two methods BalCalcOneLeg and BalanceBody. Can you please explain what exactly these functions do for QUAD mode? Which calculations taking into account when these functions called?
Unfortunately, learning how the Phoenix code is setup will require you to go through most of it. As you may have noticed, the Phoenix library includes support for multiple drivers, gaits and platforms all in one package.
This adds complexity as all of this code is doubled/tripled in most places (using #defines) to ensure proper functioning. We recommend that you check the code in the quad libraries (you can get them here: github.com/Lynxmotion/Quadrupeds ).
The two functions you mention seem to be responsible for adjusting the leg/body relative positions every “loop”. The functions use pre-set values from the IK and robot sizes that is programmed into the EEPROM of the chip. These are based on calculations that are not in the code (unlike the formulas you are using).
The best solution would be to contact the people who created/adapted the Phoenix code (they are mentioned in the source code comments at the top).