Merge pull request #1 from bentheperson1/fix-typos

Typos
This commit is contained in:
WuYangNing 2024-05-23 10:59:43 +08:00 committed by GitHub
commit bd24b5be05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 166 additions and 166 deletions

View File

@ -1,4 +1,4 @@
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.video.video_client import VideoClient from unitree_sdk2py.go2.video.video_client import VideoClient
import cv2 import cv2
import numpy as np import numpy as np
@ -7,9 +7,9 @@ import sys
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv)>1: if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1]) ChannelFactoryInitialize(0, sys.argv[1])
else: else:
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
client = VideoClient() # Create a video client client = VideoClient() # Create a video client
client.SetTimeout(3.0) client.SetTimeout(3.0)

View File

@ -2,14 +2,14 @@ import time
import os import os
import sys import sys
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.video.video_client import VideoClient from unitree_sdk2py.go2.video.video_client import VideoClient
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv)>1: if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1]) ChannelFactoryInitialize(0, sys.argv[1])
else: else:
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
client = VideoClient() client = VideoClient()
client.SetTimeout(3.0) client.SetTimeout(3.0)

View File

@ -1,11 +1,11 @@
import time import time
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
from user_data import * from user_data import *
if __name__ == "__main__": if __name__ == "__main__":
ChannelFactortyInitialize() ChannelFactoryInitialize()
# Create a publisher to publish the data defined in UserData class # Create a publisher to publish the data defined in UserData class
pub = ChannelPublisher("topic", UserData) pub = ChannelPublisher("topic", UserData)

View File

@ -1,11 +1,11 @@
import time import time
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from user_data import * from user_data import *
if __name__ == "__main__": if __name__ == "__main__":
ChannelFactortyInitialize() ChannelFactoryInitialize()
# Create a subscriber to subscribe the data defined in UserData class # Create a subscriber to subscribe the data defined in UserData class
sub = ChannelSubscriber("topic", UserData) sub = ChannelSubscriber("topic", UserData)
sub.Init() sub.Init()

View File

@ -1,6 +1,6 @@
import time import time
import sys import sys
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from unitree_sdk2py.idl.default import unitree_go_msg_dds__SportModeState_ from unitree_sdk2py.idl.default import unitree_go_msg_dds__SportModeState_
from unitree_sdk2py.idl.unitree_go.msg.dds_ import SportModeState_ from unitree_sdk2py.idl.unitree_go.msg.dds_ import SportModeState_
@ -15,7 +15,7 @@ def HighStateHandler(msg: SportModeState_):
if __name__ == "__main__": if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp3s0") ChannelFactoryInitialize(0, "enp3s0")
sub = ChannelSubscriber("rt/sportmodestate", SportModeState_) sub = ChannelSubscriber("rt/sportmodestate", SportModeState_)
sub.Init(HighStateHandler, 10) sub.Init(HighStateHandler, 10)

View File

@ -1,6 +1,6 @@
import time import time
import sys import sys
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from unitree_sdk2py.idl.default import unitree_go_msg_dds__SportModeState_ from unitree_sdk2py.idl.default import unitree_go_msg_dds__SportModeState_
from unitree_sdk2py.idl.unitree_go.msg.dds_ import SportModeState_ from unitree_sdk2py.idl.unitree_go.msg.dds_ import SportModeState_
from unitree_sdk2py.go2.sport.sport_client import ( from unitree_sdk2py.go2.sport.sport_client import (
@ -120,9 +120,9 @@ def HighStateHandler(msg: SportModeState_):
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv)>1: if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1]) ChannelFactoryInitialize(0, sys.argv[1])
else: else:
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
sub = ChannelSubscriber("rt/sportmodestate", SportModeState_) sub = ChannelSubscriber("rt/sportmodestate", SportModeState_)
sub.Init(HighStateHandler, 10) sub.Init(HighStateHandler, 10)

View File

@ -1,8 +1,8 @@
import time import time
import sys import sys
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_ from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_ from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_
from unitree_sdk2py.utils.crc import CRC from unitree_sdk2py.utils.crc import CRC
@ -14,9 +14,9 @@ crc = CRC()
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv)>1: if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1]) ChannelFactoryInitialize(0, sys.argv[1])
else: else:
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
# Create a publisher to publish the data defined in UserData class # Create a publisher to publish the data defined in UserData class
pub = ChannelPublisher("rt/lowcmd", LowCmd_) pub = ChannelPublisher("rt/lowcmd", LowCmd_)
pub.Init() pub.Init()

View File

@ -1,6 +1,6 @@
import time import time
import sys import sys
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_ from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_ from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
@ -17,9 +17,9 @@ def LowStateHandler(msg: LowState_):
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv)>1: if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1]) ChannelFactoryInitialize(0, sys.argv[1])
else: else:
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
sub = ChannelSubscriber("rt/lowstate", LowState_) sub = ChannelSubscriber("rt/lowstate", LowState_)
sub.Init(LowStateHandler, 10) sub.Init(LowStateHandler, 10)

View File

@ -1,14 +1,14 @@
import time import time
import sys import sys
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.obstacles_avoid.obstacles_avoid_client import ObstaclesAvoidClient from unitree_sdk2py.go2.obstacles_avoid.obstacles_avoid_client import ObstaclesAvoidClient
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv)>1: if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1]) ChannelFactoryInitialize(0, sys.argv[1])
else: else:
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
client = ObstaclesAvoidClient() client = ObstaclesAvoidClient()
client.SetTimeout(3.0) client.SetTimeout(3.0)

View File

@ -1,14 +1,14 @@
import time import time
import sys import sys
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.vui.vui_client import VuiClient from unitree_sdk2py.go2.vui.vui_client import VuiClient
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv)>1: if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1]) ChannelFactoryInitialize(0, sys.argv[1])
else: else:
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
client = VuiClient() client = VuiClient()
client.SetTimeout(3.0) client.SetTimeout(3.0)

View File

@ -1,6 +1,6 @@
import time import time
import sys import sys
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from unitree_sdk2py.idl.default import unitree_go_msg_dds__WirelessController_ from unitree_sdk2py.idl.default import unitree_go_msg_dds__WirelessController_
from unitree_sdk2py.idl.unitree_go.msg.dds_ import WirelessController_ from unitree_sdk2py.idl.unitree_go.msg.dds_ import WirelessController_
@ -44,9 +44,9 @@ def WirelessControllerHandler(msg: WirelessController_):
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv)>1: if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1]) ChannelFactoryInitialize(0, sys.argv[1])
else: else:
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
sub = ChannelSubscriber("rt/wirelesscontroller", WirelessController_) sub = ChannelSubscriber("rt/wirelesscontroller", WirelessController_)
sub.Init(WirelessControllerHandler, 10) sub.Init(WirelessControllerHandler, 10)

View File

@ -282,9 +282,9 @@ class ChannelSubscriber:
return self.__channel.Read(timeout) return self.__channel.Read(timeout)
""" """
" function ChannelFactortyInitialize. used to intialize channel everenment. " function ChannelFactoryInitialize. used to intialize channel everenment.
""" """
def ChannelFactortyInitialize(id: int = 0, networkInterface: str = None): def ChannelFactoryInitialize(id: int = 0, networkInterface: str = None):
factory = ChannelFactory() factory = ChannelFactory()
if not factory.Init(id, networkInterface): if not factory.Init(id, networkInterface):
raise Exception("channel factory init error.") raise Exception("channel factory init error.")

View File

@ -13,42 +13,42 @@ SPORT_API_VERSION = "1.0.0.1"
""" """
" api id " api id
""" """
SPROT_API_ID_DAMP = 1001 SPORT_API_ID_DAMP = 1001
SPROT_API_ID_BALANCESTAND = 1002 SPORT_API_ID_BALANCESTAND = 1002
SPROT_API_ID_STOPMOVE = 1003 SPORT_API_ID_STOPMOVE = 1003
SPROT_API_ID_STANDUP = 1004 SPORT_API_ID_STANDUP = 1004
SPROT_API_ID_STANDDOWN = 1005 SPORT_API_ID_STANDDOWN = 1005
SPROT_API_ID_RECOVERYSTAND = 1006 SPORT_API_ID_RECOVERYSTAND = 1006
SPROT_API_ID_EULER = 1007 SPORT_API_ID_EULER = 1007
SPROT_API_ID_MOVE = 1008 SPORT_API_ID_MOVE = 1008
SPROT_API_ID_SIT = 1009 SPORT_API_ID_SIT = 1009
SPROT_API_ID_RISESIT = 1010 SPORT_API_ID_RISESIT = 1010
SPROT_API_ID_SWITCHGAIT = 1011 SPORT_API_ID_SWITCHGAIT = 1011
SPROT_API_ID_TRIGGER = 1012 SPORT_API_ID_TRIGGER = 1012
SPROT_API_ID_BODYHEIGHT = 1013 SPORT_API_ID_BODYHEIGHT = 1013
SPROT_API_ID_FOOTRAISEHEIGHT = 1014 SPORT_API_ID_FOOTRAISEHEIGHT = 1014
SPROT_API_ID_SPEEDLEVEL = 1015 SPORT_API_ID_SPEEDLEVEL = 1015
SPROT_API_ID_HELLO = 1016 SPORT_API_ID_HELLO = 1016
SPROT_API_ID_STRETCH = 1017 SPORT_API_ID_STRETCH = 1017
SPROT_API_ID_TRAJECTORYFOLLOW = 1018 SPORT_API_ID_TRAJECTORYFOLLOW = 1018
SPROT_API_ID_CONTINUOUSGAIT = 1019 SPORT_API_ID_CONTINUOUSGAIT = 1019
SPROT_API_ID_CONTENT = 1020 SPORT_API_ID_CONTENT = 1020
SPROT_API_ID_WALLOW = 1021 SPORT_API_ID_WALLOW = 1021
SPROT_API_ID_DANCE1 = 1022 SPORT_API_ID_DANCE1 = 1022
SPROT_API_ID_DANCE2 = 1023 SPORT_API_ID_DANCE2 = 1023
SPROT_API_ID_GETBODYHEIGHT = 1024 SPORT_API_ID_GETBODYHEIGHT = 1024
SPROT_API_ID_GETFOOTRAISEHEIGHT = 1025 SPORT_API_ID_GETFOOTRAISEHEIGHT = 1025
SPROT_API_ID_GETSPEEDLEVEL = 1026 SPORT_API_ID_GETSPEEDLEVEL = 1026
SPROT_API_ID_SWITCHJOYSTICK = 1027 SPORT_API_ID_SWITCHJOYSTICK = 1027
SPROT_API_ID_POSE = 1028 SPORT_API_ID_POSE = 1028
SPROT_API_ID_SCRAPE = 1029 SPORT_API_ID_SCRAPE = 1029
SPROT_API_ID_FRONTFLIP = 1030 SPORT_API_ID_FRONTFLIP = 1030
SPROT_API_ID_FRONTJUMP = 1031 SPORT_API_ID_FRONTJUMP = 1031
SPROT_API_ID_FRONTPOUNCE = 1032 SPORT_API_ID_FRONTPOUNCE = 1032
SPROT_API_ID_WIGGLEHIPS = 1033 SPORT_API_ID_WIGGLEHIPS = 1033
SPROT_API_ID_GETSTATE = 1034 SPORT_API_ID_GETSTATE = 1034
SPROT_API_ID_ECONOMICGAIT = 1035 SPORT_API_ID_ECONOMICGAIT = 1035
SPROT_API_ID_HEART = 1036 SPORT_API_ID_HEART = 1036
""" """
@ -58,4 +58,4 @@ SPROT_API_ID_HEART = 1036
SPORT_ERR_CLIENT_POINT_PATH = 4101 SPORT_ERR_CLIENT_POINT_PATH = 4101
# server side # server side
SPORT_ERR_SERVER_OVERTIME = 4201 SPORT_ERR_SERVER_OVERTIME = 4201
SPROT_ERR_SERVER_NOT_INIT = 4202 SPORT_ERR_SERVER_NOT_INIT = 4202

View File

@ -36,83 +36,83 @@ class SportClient(Client):
self._SetApiVerson(SPORT_API_VERSION) self._SetApiVerson(SPORT_API_VERSION)
# regist api # regist api
self._RegistApi(SPROT_API_ID_DAMP, 0) self._RegistApi(SPORT_API_ID_DAMP, 0)
self._RegistApi(SPROT_API_ID_BALANCESTAND, 0) self._RegistApi(SPORT_API_ID_BALANCESTAND, 0)
self._RegistApi(SPROT_API_ID_STOPMOVE, 0) self._RegistApi(SPORT_API_ID_STOPMOVE, 0)
self._RegistApi(SPROT_API_ID_STANDUP, 0) self._RegistApi(SPORT_API_ID_STANDUP, 0)
self._RegistApi(SPROT_API_ID_STANDDOWN, 0) self._RegistApi(SPORT_API_ID_STANDDOWN, 0)
self._RegistApi(SPROT_API_ID_RECOVERYSTAND, 0) self._RegistApi(SPORT_API_ID_RECOVERYSTAND, 0)
self._RegistApi(SPROT_API_ID_EULER, 0) self._RegistApi(SPORT_API_ID_EULER, 0)
self._RegistApi(SPROT_API_ID_MOVE, 0) self._RegistApi(SPORT_API_ID_MOVE, 0)
self._RegistApi(SPROT_API_ID_SIT, 0) self._RegistApi(SPORT_API_ID_SIT, 0)
self._RegistApi(SPROT_API_ID_RISESIT, 0) self._RegistApi(SPORT_API_ID_RISESIT, 0)
self._RegistApi(SPROT_API_ID_SWITCHGAIT, 0) self._RegistApi(SPORT_API_ID_SWITCHGAIT, 0)
self._RegistApi(SPROT_API_ID_TRIGGER, 0) self._RegistApi(SPORT_API_ID_TRIGGER, 0)
self._RegistApi(SPROT_API_ID_BODYHEIGHT, 0) self._RegistApi(SPORT_API_ID_BODYHEIGHT, 0)
self._RegistApi(SPROT_API_ID_FOOTRAISEHEIGHT, 0) self._RegistApi(SPORT_API_ID_FOOTRAISEHEIGHT, 0)
self._RegistApi(SPROT_API_ID_SPEEDLEVEL, 0) self._RegistApi(SPORT_API_ID_SPEEDLEVEL, 0)
self._RegistApi(SPROT_API_ID_HELLO, 0) self._RegistApi(SPORT_API_ID_HELLO, 0)
self._RegistApi(SPROT_API_ID_STRETCH, 0) self._RegistApi(SPORT_API_ID_STRETCH, 0)
self._RegistApi(SPROT_API_ID_TRAJECTORYFOLLOW, 0) self._RegistApi(SPORT_API_ID_TRAJECTORYFOLLOW, 0)
self._RegistApi(SPROT_API_ID_CONTINUOUSGAIT, 0) self._RegistApi(SPORT_API_ID_CONTINUOUSGAIT, 0)
# self._RegistApi(SPROT_API_ID_CONTENT, 0) # self._RegistApi(SPORT_API_ID_CONTENT, 0)
self._RegistApi(SPROT_API_ID_WALLOW, 0) self._RegistApi(SPORT_API_ID_WALLOW, 0)
self._RegistApi(SPROT_API_ID_DANCE1, 0) self._RegistApi(SPORT_API_ID_DANCE1, 0)
self._RegistApi(SPROT_API_ID_DANCE2, 0) self._RegistApi(SPORT_API_ID_DANCE2, 0)
# self._RegistApi(SPROT_API_ID_GETBODYHEIGHT, 0) # self._RegistApi(SPORT_API_ID_GETBODYHEIGHT, 0)
# self._RegistApi(SPROT_API_ID_GETFOOTRAISEHEIGHT, 0) # self._RegistApi(SPORT_API_ID_GETFOOTRAISEHEIGHT, 0)
# self._RegistApi(SPROT_API_ID_GETSPEEDLEVEL, 0) # self._RegistApi(SPORT_API_ID_GETSPEEDLEVEL, 0)
self._RegistApi(SPROT_API_ID_SWITCHJOYSTICK, 0) self._RegistApi(SPORT_API_ID_SWITCHJOYSTICK, 0)
self._RegistApi(SPROT_API_ID_POSE, 0) self._RegistApi(SPORT_API_ID_POSE, 0)
self._RegistApi(SPROT_API_ID_SCRAPE, 0) self._RegistApi(SPORT_API_ID_SCRAPE, 0)
self._RegistApi(SPROT_API_ID_FRONTFLIP, 0) self._RegistApi(SPORT_API_ID_FRONTFLIP, 0)
self._RegistApi(SPROT_API_ID_FRONTJUMP, 0) self._RegistApi(SPORT_API_ID_FRONTJUMP, 0)
self._RegistApi(SPROT_API_ID_FRONTPOUNCE, 0) self._RegistApi(SPORT_API_ID_FRONTPOUNCE, 0)
self._RegistApi(SPROT_API_ID_WIGGLEHIPS, 0) self._RegistApi(SPORT_API_ID_WIGGLEHIPS, 0)
self._RegistApi(SPROT_API_ID_GETSTATE, 0) self._RegistApi(SPORT_API_ID_GETSTATE, 0)
self._RegistApi(SPROT_API_ID_ECONOMICGAIT, 0) self._RegistApi(SPORT_API_ID_ECONOMICGAIT, 0)
self._RegistApi(SPROT_API_ID_HEART, 0) self._RegistApi(SPORT_API_ID_HEART, 0)
# 1001 # 1001
def Damp(self): def Damp(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_DAMP, parameter) code, data = self._Call(SPORT_API_ID_DAMP, parameter)
return code return code
# 1002 # 1002
def BalanceStand(self): def BalanceStand(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_BALANCESTAND, parameter) code, data = self._Call(SPORT_API_ID_BALANCESTAND, parameter)
return code return code
# 1003 # 1003
def StopMove(self): def StopMove(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_STOPMOVE, parameter) code, data = self._Call(SPORT_API_ID_STOPMOVE, parameter)
return code return code
# 1004 # 1004
def StandUp(self): def StandUp(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_STANDUP, parameter) code, data = self._Call(SPORT_API_ID_STANDUP, parameter)
return code return code
# 1005 # 1005
def StandDown(self): def StandDown(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_STANDDOWN, parameter) code, data = self._Call(SPORT_API_ID_STANDDOWN, parameter)
return code return code
# 1006 # 1006
def RecoveryStand(self): def RecoveryStand(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_RECOVERYSTAND, parameter) code, data = self._Call(SPORT_API_ID_RECOVERYSTAND, parameter)
return code return code
# 1007 # 1007
@ -122,7 +122,7 @@ class SportClient(Client):
p["y"] = pitch p["y"] = pitch
p["z"] = yaw p["z"] = yaw
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_EULER, parameter) code, data = self._Call(SPORT_API_ID_EULER, parameter)
return code return code
# 1008 # 1008
@ -132,21 +132,21 @@ class SportClient(Client):
p["y"] = vy p["y"] = vy
p["z"] = vyaw p["z"] = vyaw
parameter = json.dumps(p) parameter = json.dumps(p)
code = self._CallNoReply(SPROT_API_ID_MOVE, parameter) code = self._CallNoReply(SPORT_API_ID_MOVE, parameter)
return code return code
# 1009 # 1009
def Sit(self): def Sit(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_SIT, parameter) code, data = self._Call(SPORT_API_ID_SIT, parameter)
return code return code
#1010 #1010
def RiseSit(self): def RiseSit(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_RISESIT, parameter) code, data = self._Call(SPORT_API_ID_RISESIT, parameter)
return code return code
# 1011 # 1011
@ -154,14 +154,14 @@ class SportClient(Client):
p = {} p = {}
p["data"] = t p["data"] = t
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_SWITCHGAIT, parameter) code, data = self._Call(SPORT_API_ID_SWITCHGAIT, parameter)
return code return code
# 1012 # 1012
def Trigger(self): def Trigger(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_TRIGGER, parameter) code, data = self._Call(SPORT_API_ID_TRIGGER, parameter)
return code return code
# 1013 # 1013
@ -169,7 +169,7 @@ class SportClient(Client):
p = {} p = {}
p["data"] = height p["data"] = height
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_BODYHEIGHT, parameter) code, data = self._Call(SPORT_API_ID_BODYHEIGHT, parameter)
return code return code
# 1014 # 1014
@ -177,7 +177,7 @@ class SportClient(Client):
p = {} p = {}
p["data"] = height p["data"] = height
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_FOOTRAISEHEIGHT, parameter) code, data = self._Call(SPORT_API_ID_FOOTRAISEHEIGHT, parameter)
return code return code
# 1015 # 1015
@ -185,21 +185,21 @@ class SportClient(Client):
p = {} p = {}
p["data"] = level p["data"] = level
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_SPEEDLEVEL, parameter) code, data = self._Call(SPORT_API_ID_SPEEDLEVEL, parameter)
return code return code
# 1016 # 1016
def Hello(self): def Hello(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_HELLO, parameter) code, data = self._Call(SPORT_API_ID_HELLO, parameter)
return code return code
# 1017 # 1017
def Stretch(self): def Stretch(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_STRETCH, parameter) code, data = self._Call(SPORT_API_ID_STRETCH, parameter)
return code return code
# 1018 # 1018
@ -222,7 +222,7 @@ class SportClient(Client):
path_p.append(p) path_p.append(p)
parameter = json.dumps(path_p) parameter = json.dumps(path_p)
code = self._CallNoReply(SPROT_API_ID_TRAJECTORYFOLLOW, parameter) code = self._CallNoReply(SPORT_API_ID_TRAJECTORYFOLLOW, parameter)
return code return code
# 1019 # 1019
@ -230,35 +230,35 @@ class SportClient(Client):
p = {} p = {}
p["data"] = flag p["data"] = flag
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_CONTINUOUSGAIT, parameter) code, data = self._Call(SPORT_API_ID_CONTINUOUSGAIT, parameter)
return code return code
# # 1020 # # 1020
# def Content(self): # def Content(self):
# p = {} # p = {}
# parameter = json.dumps(p) # parameter = json.dumps(p)
# code, data = self._Call(SPROT_API_ID_CONTENT, parameter) # code, data = self._Call(SPORT_API_ID_CONTENT, parameter)
# return code # return code
# 1021 # 1021
def Wallow(self): def Wallow(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_WALLOW, parameter) code, data = self._Call(SPORT_API_ID_WALLOW, parameter)
return code return code
# 1022 # 1022
def Dance1(self): def Dance1(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_DANCE1, parameter) code, data = self._Call(SPORT_API_ID_DANCE1, parameter)
return code return code
# 1023 # 1023
def Dance2(self): def Dance2(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_DANCE2, parameter) code, data = self._Call(SPORT_API_ID_DANCE2, parameter)
return code return code
# 1025 # 1025
@ -266,7 +266,7 @@ class SportClient(Client):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_GETFOOTRAISEHEIGHT, parameter) code, data = self._Call(SPORT_API_ID_GETFOOTRAISEHEIGHT, parameter)
if code == 0: if code == 0:
d = json.loads(data) d = json.loads(data)
@ -280,7 +280,7 @@ class SportClient(Client):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_GETSPEEDLEVEL, parameter) code, data = self._Call(SPORT_API_ID_GETSPEEDLEVEL, parameter)
if code == 0: if code == 0:
d = json.loads(data) d = json.loads(data)
@ -293,7 +293,7 @@ class SportClient(Client):
p = {} p = {}
p["data"] = on p["data"] = on
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_SWITCHJOYSTICK, parameter) code, data = self._Call(SPORT_API_ID_SWITCHJOYSTICK, parameter)
return code return code
# 1028 # 1028
@ -301,48 +301,48 @@ class SportClient(Client):
p = {} p = {}
p["data"] = flag p["data"] = flag
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_POSE, parameter) code, data = self._Call(SPORT_API_ID_POSE, parameter)
return code return code
# 1029 # 1029
def Scrape(self): def Scrape(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_SCRAPE, parameter) code, data = self._Call(SPORT_API_ID_SCRAPE, parameter)
return code return code
# 1030 # 1030
def FrontFlip(self): def FrontFlip(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_FRONTFLIP, parameter) code, data = self._Call(SPORT_API_ID_FRONTFLIP, parameter)
return code return code
# 1031 # 1031
def FrontJump(self): def FrontJump(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_FRONTJUMP, parameter) code, data = self._Call(SPORT_API_ID_FRONTJUMP, parameter)
return code return code
# 1032 # 1032
def FrontPounce(self): def FrontPounce(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_FRONTPOUNCE, parameter) code, data = self._Call(SPORT_API_ID_FRONTPOUNCE, parameter)
return code return code
# 1033 # 1033
def WiggleHips(self): def WiggleHips(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_WIGGLEHIPS, parameter) code, data = self._Call(SPORT_API_ID_WIGGLEHIPS, parameter)
return code return code
# 1034 # 1034
def GetState(self, keys: list): def GetState(self, keys: list):
parameter = json.dumps(keys) parameter = json.dumps(keys)
code, data = self._Call(SPROT_API_ID_GETSTATE, parameter) code, data = self._Call(SPORT_API_ID_GETSTATE, parameter)
if code == 0: if code == 0:
return code, json.loads(data) return code, json.loads(data)
else: else:
@ -353,12 +353,12 @@ class SportClient(Client):
p = {} p = {}
p["data"] = flag p["data"] = flag
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_ECONOMICGAIT, parameter) code, data = self._Call(SPORT_API_ID_ECONOMICGAIT, parameter)
return code return code
# 1036 # 1036
def Heart(self): def Heart(self):
p = {} p = {}
parameter = json.dumps(p) parameter = json.dumps(p)
code, data = self._Call(SPROT_API_ID_HEART, parameter) code, data = self._Call(SPORT_API_ID_HEART, parameter)
return code return code

View File

@ -1,11 +1,11 @@
import time import time
import os import os
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.obstacles_avoid.obstacles_avoid_client import ObstaclesAvoidClient from unitree_sdk2py.go2.obstacles_avoid.obstacles_avoid_client import ObstaclesAvoidClient
if __name__ == "__main__": if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp3s0") ChannelFactoryInitialize(0, "enp3s0")
client = ObstaclesAvoidClient() client = ObstaclesAvoidClient()
client.SetTimeout(3.0) client.SetTimeout(3.0)

View File

@ -1,9 +1,9 @@
import time import time
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.robot_state.robot_state_client import RobotStateClient from unitree_sdk2py.go2.robot_state.robot_state_client import RobotStateClient
if __name__ == "__main__": if __name__ == "__main__":
ChannelFactortyInitialize(0, "enx000ec6768747") ChannelFactoryInitialize(0, "enx000ec6768747")
rsc = RobotStateClient() rsc = RobotStateClient()
rsc.SetTimeout(3.0) rsc.SetTimeout(3.0)
rsc.Init() rsc.Init()

View File

@ -1,9 +1,9 @@
import time import time
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.sport.sport_client import SportClient, PathPoint, SPORT_PATH_POINT_SIZE from unitree_sdk2py.go2.sport.sport_client import SportClient, PathPoint, SPORT_PATH_POINT_SIZE
if __name__ == "__main__": if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp2s0") ChannelFactoryInitialize(0, "enp2s0")
client = SportClient() client = SportClient()
client.SetTimeout(10.0) client.SetTimeout(10.0)
client.Init() client.Init()

View File

@ -1,11 +1,11 @@
import time import time
import os import os
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.video.video_client import VideoClient from unitree_sdk2py.go2.video.video_client import VideoClient
if __name__ == "__main__": if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp2s0") ChannelFactoryInitialize(0, "enp2s0")
client = VideoClient() client = VideoClient()
client.SetTimeout(3.0) client.SetTimeout(3.0)

View File

@ -1,11 +1,11 @@
import time import time
import os import os
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.go2.vui.vui_client import VuiClient from unitree_sdk2py.go2.vui.vui_client import VuiClient
if __name__ == "__main__": if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp2s0") ChannelFactoryInitialize(0, "enp2s0")
client = VuiClient() client = VuiClient()
client.SetTimeout(3.0) client.SetTimeout(3.0)

View File

@ -1,9 +1,9 @@
import time import time
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
from helloworld import HelloWorld from helloworld import HelloWorld
ChannelFactortyInitialize() ChannelFactoryInitialize()
pub = ChannelPublisher("topic", HelloWorld) pub = ChannelPublisher("topic", HelloWorld)
pub.Init() pub.Init()

View File

@ -1,9 +1,9 @@
import time import time
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from helloworld import HelloWorld from helloworld import HelloWorld
ChannelFactortyInitialize() ChannelFactoryInitialize()
sub = ChannelSubscriber("topic", HelloWorld) sub = ChannelSubscriber("topic", HelloWorld)
sub.Init() sub.Init()

View File

@ -1,7 +1,7 @@
import time import time
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_ from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_ from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_
from unitree_sdk2py.utils.crc import CRC from unitree_sdk2py.utils.crc import CRC
@ -13,7 +13,7 @@ lowCmdThreadPtr=Thread()
if __name__ == '__main__': if __name__ == '__main__':
ChannelFactortyInitialize(1, "enp2s0") ChannelFactoryInitialize(1, "enp2s0")
# Create a publisher to publish the data defined in UserData class # Create a publisher to publish the data defined in UserData class
pub = ChannelPublisher("lowcmd", LowCmd_) pub = ChannelPublisher("lowcmd", LowCmd_)
pub.Init() pub.Init()

View File

@ -1,5 +1,5 @@
import time import time
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_ from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_ from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
@ -16,7 +16,7 @@ def LowStateHandler(msg: LowState_):
if __name__ == "__main__": if __name__ == "__main__":
# Modify "enp2s0" to the actual network interface # Modify "enp2s0" to the actual network interface
ChannelFactortyInitialize(0, "enp2s0") ChannelFactoryInitialize(0, "enp2s0")
sub = ChannelSubscriber("rt/lowstate", LowState_) sub = ChannelSubscriber("rt/lowstate", LowState_)
sub.Init(LowStateHandler, 10) sub.Init(LowStateHandler, 10)

View File

@ -1,5 +1,5 @@
import time import time
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_ from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_ from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
@ -7,7 +7,7 @@ def LowStateHandler(msg: LowState_):
print(msg.motor_state) print(msg.motor_state)
ChannelFactortyInitialize(0, "enp2s0") ChannelFactoryInitialize(0, "enp2s0")
sub = ChannelSubscriber("rt/lowstate", LowState_) sub = ChannelSubscriber("rt/lowstate", LowState_)
sub.Init(LowStateHandler, 10) sub.Init(LowStateHandler, 10)

View File

@ -1,7 +1,7 @@
import time import time
import json import json
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.rpc.client import Client from unitree_sdk2py.rpc.client import Client
from test_api import * from test_api import *
@ -37,7 +37,7 @@ class TestClient(Client):
if __name__ == "__main__": if __name__ == "__main__":
# initialize channel factory. # initialize channel factory.
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
# create client # create client
client = TestClient(True) client = TestClient(True)

View File

@ -1,7 +1,7 @@
import time import time
import json import json
from unitree_sdk2py.core.channel import ChannelFactortyInitialize from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from unitree_sdk2py.rpc.server import Server from unitree_sdk2py.rpc.server import Server
from test_api import * from test_api import *
@ -33,7 +33,7 @@ class TestServer(Server):
if __name__ == "__main__": if __name__ == "__main__":
# initialize channel factory. # initialize channel factory.
ChannelFactortyInitialize(0) ChannelFactoryInitialize(0)
# create server # create server
server = TestServer() server = TestServer()