PRO
smiller29
USA
Asked
— Edited
Making My Robot Walk
DJ, when you mentioned the EZ-SDK's Auto Positioner, were you specifically referring to the Auto Position (Gait) skill, or is there something else involved? Additionally, what method or tools were you considering for implementing balance control feedback?
My current robot design is track-based, but my other design incorporates the use of legs, as illustrated above. I am very interested in finding a way to support these legs with Synthiam ARC as a solution. This support would be incredibly beneficial for other builders who are working with this kit, which we are developing as part of an open-source project.
Here is an AI animation for reference:
Related Hardware Arduino Due/Mega


The sdk is accessible when creating a robot skill.
as for balancing your biped with an inverted pendulum approach, it’s never done on a computer. The computer will instruct the position of the gait, but the balance is done in a very very tight loop on a microcontroller.
Essentially you can start by using the hip servos as the balance point that the pid microcontroller can control. You have the pid controller take the position input from the ezb and alter it slightly for balance with your imu. The rest of the servos don’t really need to be altered by the pid loop.
id jump onto a paid version of chat gpt 5o and get more info on the approach.
The approach is to have the two top hip servos on a tight pid loop that alters the set position from the ezb which is set from the auto positioned thats controlling the gait. You’re pid loop is altering the hip servos of the gait from the auto position.
you "kind of can" put the pid loop in the ezb firmware - but only if it’s usb connected. I wouldn’t feel comfortable with the wifi interrupts affecting pid timing. But, it might be fine, I just can’t be certain.
@athena explain more
Love this direction. You're basically adding a reflex layer under ARC so the robot stays upright even while walking. Let's build it so it doesn't break Auto Position. Continue this ChatGPT conversation here privately: https://chatgpt.com/share/69003715-ff84-800e-901b-9517c19eec33
I'll lay out an approach that works with ARC, EZ-B firmware on Arduino, and a little extra logic for balance. Then I'll give you firmware code you can drop onto an Arduino-class EZ-B with minimal changes and get the behavior you described: gait commands still come from ARC, but the two hip servos get "nudged" in real time to keep the torso vertical.
Concept
You're doing 2 things at once:
The problem is: ARC is blindly setting hip servos to whatever is in the frame. But you actually want the hip servos to land at:
hip_commanded_from_ARC + balance_correctionin real time, continuously.
So we add a "reflex layer" under ARC that:
Everything else (knees, ankles, etc.) still goes exactly where ARC told them to go. Only the hips get corrected.
That means:
Control loop
We'll do a basic PD loop (P + D). You don't need full PID for first pass.
Definitions:
targetAngle = 0(torso perfectly upright)measuredAngle= tilt angle from IMU (pitch and maybe roll)error = targetAngle - measuredAngleFor left/right sway, you usually correct the roll. For forward/backward lean, you correct the pitch. We'll implement for pitch first and leave roll expansion in comments.
Then:
correction = Kp * error + Kd * (error - prevError) / dtcorrectionto a sane range so you don't fight Auto Position too hard. Example: 8 servo "position units".Then:
finalHipPos = gaitHipPos + correctionWhere:
gaitHipPosis what ARC last told that hip servo to do for gait.finalHipPosis what we actually write to the PWM output.That gives you the "nudge" you asked for.
Architecture on Arduino
We'll do this on a single Arduino that's already acting as the EZ-B:
UART/Bluetooth/WiFi from ARC EZ-B protocol we parse servo position set commands
We store those requested positions in an array
gaitPos[NUM_SERVOS]We run a fast loop:
Important: We do not immediately
servo.write()inside the ARC packet handler; we just updategaitPos[]. The real servo writes happen in our control loop at a fixed rate (for stability timing).That gives us:
Assumptions
We'll assume:
getPitchDegrees().)You can adapt channel numbers and IMU read code later.
Now here's the full firmware skeleton with comments, timing, safety clamping, and the balance nudge logic. It follows your style rules:
How to tune it
Set the right channels
HIP_LEFT_CHandHIP_RIGHT_CHto match your actual hip servos that tilt the torso.servoPins[]so each channel maps to the Arduino pins you're using.Hook up the IMU
imuInit()andgetPitchDegrees().getPitchDegrees()to return positive when the robot is leaning forward.correctionDegor swap the on left/right hips until the correction tries to stand it back up, not push it further.Balance strength
KP= how hard it reacts to being tilted.KD= how hard it resists fast falling.KPorKD.KP.Offset clamp
BALANCE_MAX_OFFSET_DEGis super important.5.0f. If the robot can physically lean more without tripping, increase toward8.0for even10.0f.Roll axis
If you also want left/right stabilization (side-to-side sway), you can:
getRollDegrees().Why this works with ARC (and why it's clean)
That's exactly the inverted-pendulum trick you're aiming for, and it's the safest architecture because it won't break ARC's sequencing.
If you drop this on an Arduino and wire it in place of your current EZ-B-compatible board, you get nudged hip stabilization with no changes to your Auto Position skill logic.
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
Well this is the plan ChatGPT came up with:
Awesome project. Here’s a clean, working baseline you can build on: a PC-side Python gait engine (state machine + per-leg IK + IMU stabilization) that streams 12 hobby-servo targets to an Arduino at 50 Hz, and an Arduino sketch that: (1) runs smooth servo motion on 12 channels, (2) reads an MPU-6050 (or MPU-9250) and estimates pitch/roll with a complementary filter, and (3) speaks a tiny newline-delimited serial protocol.
The walk is a robust, quasi-static gait (keeps CoM over the support foot), with parameters for step length, step height, cadence, and lateral hip shift. The IK assumes 6-DoF per leg (Hip: yaw/roll/pitch; Knee: pitch; Ankle: pitch/roll). Feel free to prune joints you don’t have-everything is centralized in map_joint_order and the IK output.
How this fits together The Python process runs the gait state machine, synthesizes per-foot trajectories, solves per-leg IK, applies IMU stabilization, and streams 12 angle targets at 50 Hz. The Arduino performs safe, smooth actuation, and streams pitch/roll so the Python side can do closed-loop ankle/hip corrections. Keeping the controller split like this lets you iterate gait logic in Python without re-flashing the MCU.
there was a lot of code that needs to be tested but the plan is pretty good and the code looks promising. Now I just need to print a set legs to test it.
You should also look at Athena’s response above
DJ I like what she came up with but it is only balancing two servos for a front or back correction I also need a side to side correction as I have 4 servos in the joint. I also have 2 servos that control the leg for tow in and tow out.
I was able to get ChatGPT to modify your code for side to side corrections also. Not sure if there is a way it could have logic added to catch itself from falling or try to.
Added side-to-side (roll) balance using two additional hip servos, while keeping ARC Auto Position fully in charge of the gait. The firmware below adds a 2-axis PD stabilizer (pitch + roll) and a mixing matrix so each hip servo can get any combination of pitch/roll nudges with adjustable signs.
Key ideas:
gaitPos[].corrPitch,corrRoll.{pitchGain, rollGain}(1.0, 0.0, or scaled) to mix those into its final output.Below is a drop-in sketch (supersedes the previous one). Fill in pins and IMU reads and you’re good.
How to wire/tune quickly
HIP_PITCH_*and your two lateral hips onHIP_ROLL_*. If a slot isn’t used, set it to255.pitchGainsigns (e.g., make one 1 or both 1 depending on your linkage). * If tipping left, the left roll servo should push up/right. If it pushes the wrong way, flip therollGainsigns in thehips[]table.KP_PITCH=3.5/KD_PITCH=0.6andKP_ROLL=3.0/KD_ROLL=0.5. Raise Kp until it feels firm, add a bit of Kd to kill wobble. If it chatters, lower both slightly.PITCH_OFFSET_MAX,ROLL_OFFSET_MAX, andTOTAL_OFFSET_MAXto keep nudges small so ARC’s gait still reads clean.