I made a robot dog using Lewansoul LX-16a Smart Serial bus motors and a 3D printed body. I am using an Arduino Mega 2560 to control everything. I already have the inverse kinematics working. But for some reason, I can't get the robot to balance on 3 legs. I have tried to balance the weight, and tried to hard code other legs to move down to shift the CG. But that trick doesn't work when I am trying to make the gaits. I want the dog to balance dynamically as it walks. I want to use a gyroscope to do that, but I don't know where to start.