Fix typos in sport client constants and channel factory
This commit is contained in:
Benathen 2024-05-13 21:18:12 -05:00
parent 9ca77a1dc5
commit a46a95092c
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
import cv2
import numpy as np
@ -7,9 +7,9 @@ import sys
if __name__ == "__main__":
if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1])
ChannelFactoryInitialize(0, sys.argv[1])
else:
ChannelFactortyInitialize(0)
ChannelFactoryInitialize(0)
client = VideoClient() # Create a video client
client.SetTimeout(3.0)

View File

@ -2,14 +2,14 @@ import time
import os
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
if __name__ == "__main__":
if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1])
ChannelFactoryInitialize(0, sys.argv[1])
else:
ChannelFactortyInitialize(0)
ChannelFactoryInitialize(0)
client = VideoClient()
client.SetTimeout(3.0)

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import time
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.unitree_go.msg.dds_ import SportModeState_
@ -15,7 +15,7 @@ def HighStateHandler(msg: SportModeState_):
if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp3s0")
ChannelFactoryInitialize(0, "enp3s0")
sub = ChannelSubscriber("rt/sportmodestate", SportModeState_)
sub.Init(HighStateHandler, 10)

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import time
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.unitree_go.msg.dds_ import LowState_
@ -17,9 +17,9 @@ def LowStateHandler(msg: LowState_):
if __name__ == "__main__":
if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1])
ChannelFactoryInitialize(0, sys.argv[1])
else:
ChannelFactortyInitialize(0)
ChannelFactoryInitialize(0)
sub = ChannelSubscriber("rt/lowstate", LowState_)
sub.Init(LowStateHandler, 10)

View File

@ -1,14 +1,14 @@
import time
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
if __name__ == "__main__":
if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1])
ChannelFactoryInitialize(0, sys.argv[1])
else:
ChannelFactortyInitialize(0)
ChannelFactoryInitialize(0)
client = ObstaclesAvoidClient()
client.SetTimeout(3.0)

View File

@ -1,14 +1,14 @@
import time
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
if __name__ == "__main__":
if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1])
ChannelFactoryInitialize(0, sys.argv[1])
else:
ChannelFactortyInitialize(0)
ChannelFactoryInitialize(0)
client = VuiClient()
client.SetTimeout(3.0)

View File

@ -1,6 +1,6 @@
import time
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.unitree_go.msg.dds_ import WirelessController_
@ -44,9 +44,9 @@ def WirelessControllerHandler(msg: WirelessController_):
if __name__ == "__main__":
if len(sys.argv)>1:
ChannelFactortyInitialize(0, sys.argv[1])
ChannelFactoryInitialize(0, sys.argv[1])
else:
ChannelFactortyInitialize(0)
ChannelFactoryInitialize(0)
sub = ChannelSubscriber("rt/wirelesscontroller", WirelessController_)
sub.Init(WirelessControllerHandler, 10)

View File

@ -282,9 +282,9 @@ class ChannelSubscriber:
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()
if not factory.Init(id, networkInterface):
raise Exception("channel factory init error.")

View File

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

View File

@ -1,11 +1,11 @@
import time
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
if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp3s0")
ChannelFactoryInitialize(0, "enp3s0")
client = ObstaclesAvoidClient()
client.SetTimeout(3.0)

View File

@ -1,9 +1,9 @@
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
if __name__ == "__main__":
ChannelFactortyInitialize(0, "enx000ec6768747")
ChannelFactoryInitialize(0, "enx000ec6768747")
rsc = RobotStateClient()
rsc.SetTimeout(3.0)
rsc.Init()

View File

@ -1,9 +1,9 @@
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
if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp2s0")
ChannelFactoryInitialize(0, "enp2s0")
client = SportClient()
client.SetTimeout(10.0)
client.Init()

View File

@ -1,11 +1,11 @@
import time
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
if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp2s0")
ChannelFactoryInitialize(0, "enp2s0")
client = VideoClient()
client.SetTimeout(3.0)

View File

@ -1,11 +1,11 @@
import time
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
if __name__ == "__main__":
ChannelFactortyInitialize(0, "enp2s0")
ChannelFactoryInitialize(0, "enp2s0")
client = VuiClient()
client.SetTimeout(3.0)

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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.unitree_go.msg.dds_ import LowState_
@ -16,7 +16,7 @@ def LowStateHandler(msg: LowState_):
if __name__ == "__main__":
# Modify "enp2s0" to the actual network interface
ChannelFactortyInitialize(0, "enp2s0")
ChannelFactoryInitialize(0, "enp2s0")
sub = ChannelSubscriber("rt/lowstate", LowState_)
sub.Init(LowStateHandler, 10)

View File

@ -1,5 +1,5 @@
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.unitree_go.msg.dds_ import LowState_
@ -7,7 +7,7 @@ def LowStateHandler(msg: LowState_):
print(msg.motor_state)
ChannelFactortyInitialize(0, "enp2s0")
ChannelFactoryInitialize(0, "enp2s0")
sub = ChannelSubscriber("rt/lowstate", LowState_)
sub.Init(LowStateHandler, 10)

View File

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

View File

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