Skip to content

Commit 986f39d

Browse files
committed
add g1 Squat2StandUp、StandUp2Squat、Lie2StandUp api
1 parent aee4390 commit 986f39d

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

example/g1/high_level/g1_loco_client_example.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class TestOption:
1414

1515
option_list = [
1616
TestOption(name="damp", id=0),
17-
TestOption(name="stand_up", id=1),
18-
TestOption(name="sit", id=2),
17+
TestOption(name="Squat2StandUp", id=1),
18+
TestOption(name="StandUp2Squat", id=2),
1919
TestOption(name="move forward", id=3),
2020
TestOption(name="move lateral", id=4),
2121
TestOption(name="move rotate", id=5),
@@ -25,6 +25,7 @@ class TestOption:
2525
TestOption(name="wave hand1", id=9), # wave hand without turning around
2626
TestOption(name="wave hand2", id=10), # wave hand and trun around
2727
TestOption(name="shake hand", id=11),
28+
TestOption(name="Lie2StandUp", id=12),
2829
]
2930

3031
class UserInterface:
@@ -83,9 +84,11 @@ def terminal_handle(self):
8384
if test_option.id == 0:
8485
sport_client.Damp()
8586
elif test_option.id == 1:
86-
sport_client.StandUp()
87+
sport_client.Damp()
88+
time.sleep(0.5)
89+
sport_client.Squat2StandUp()
8790
elif test_option.id == 2:
88-
sport_client.Sit()
91+
sport_client.StandUp2Squat()
8992
elif test_option.id == 3:
9093
sport_client.Move(0.3,0,0)
9194
elif test_option.id == 4:
@@ -106,5 +109,9 @@ def terminal_handle(self):
106109
sport_client.ShakeHand()
107110
time.sleep(3)
108111
sport_client.ShakeHand()
112+
elif test_option.id == 12:
113+
sport_client.Damp()
114+
time.sleep(0.5)
115+
sport_client.Lie2StandUp() # When using the Lie2StandUp function, ensure that the robot faces up and the ground is hard, flat and rough.
109116

110117
time.sleep(1)

unitree_sdk2py/g1/loco/g1_loco_client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,17 @@ def Damp(self):
7878
def Start(self):
7979
self.SetFsmId(200)
8080

81-
def Squat(self):
82-
self.SetFsmId(2)
81+
def Squat2StandUp(self):
82+
self.SetFsmId(706)
83+
84+
def Lie2StandUp(self):
85+
self.SetFsmId(702)
8386

8487
def Sit(self):
8588
self.SetFsmId(3)
8689

87-
def StandUp(self):
88-
self.SetFsmId(4)
90+
def StandUp2Squat(self):
91+
self.SetFsmId(706)
8992

9093
def ZeroTorque(self):
9194
self.SetFsmId(0)

0 commit comments

Comments
 (0)