Demo: Sequencer - Toby-eaaa/Mini_Pupper_eaaa GitHub Wiki
Here
Demo:The sequencer will imitate the joystick (joystick.py) and send messages via UDP to run_robot.py.
run_robot.py will then decide what to do based on these messages.
Every message contains a set with all button conditions:
msg = {
"ly": 0,
"lx": 0,
"rx": 0,
"ry": 0,
"L2": 0,
"R2": 0,
"R1": 0,
"L1": 0,
"dpady": 0,
"dpadx": 0,
"x": 0,
"square": 0,
"circle": 0,
"triangle": 0,
"message_rate": MESSAGE_RATE,
}
A joystick can move from -1 to 1. So half speed would be 0.5.
All buttons can be 1 (pressed) and 0 (released).
A cycle_counter is used to keep track of the messages send. On line 13 it is set to 0. In the while True loop it it used to tell when to push a button. Like on line 53 and 54:
if cycle_counter == 50:
msg['rx'] = 0.3
Here it will keep moving right (30% speed) until line 55 and 56:
if cycle_counter == 70:
msg['rx'] = 0
So for 20 cycles it will keep looking more and more right.
REMEMBER TO STOP THE MOTION AGAIN! IT DOESN'T KNOW WHEN TO STOP BY ITSELF AND CAN OVERLOAD THE SERVOS!!!
The demo program will go through all the movements the Pupper can do. This will make it easier to find the movement needed.
To run this demo:
-
Open 2 terminals
-
Terminal 1:
cd /Robotics/QuadrupedRobot/StanfordQuadruped/ sudo systemctl stop joystick sudo systemctl stop robot sudo python3 run_robot.py
-
Terminal 2:
cd /Robotics/QuadrupedRobot/EAAA folder) python3 sequencer.py