linter pt4

This commit is contained in:
Martino Russi
2025-11-27 13:09:11 +01:00
parent 0213011fec
commit fad06afe9b
4 changed files with 20 additions and 18 deletions
+1 -1
View File
@@ -347,6 +347,7 @@ if __name__ == "__main__":
) )
# reset legs and start locomotion thread # reset legs and start locomotion thread
try:
groot_controller.reset_robot() groot_controller.reset_robot()
groot_controller.start_locomotion_thread() groot_controller.start_locomotion_thread()
@@ -356,7 +357,6 @@ if __name__ == "__main__":
logger.info("Press Ctrl+C to stop") logger.info("Press Ctrl+C to stop")
# keep robot alive # keep robot alive
try:
while True: while True:
time.sleep(1.0) time.sleep(1.0)
except KeyboardInterrupt: except KeyboardInterrupt:
@@ -11,8 +11,9 @@ from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowCmd_ as hg_LowCmd, LowStat
from unitree_sdk2py.utils.crc import CRC from unitree_sdk2py.utils.crc import CRC
# DDS topic names follow Unitree SDK naming conventions # DDS topic names follow Unitree SDK naming conventions
kTopicLowCommand_Debug = "rt/lowcmd" # action to robot # ruff: noqa: N816 # ruff: noqa: N816
kTopicLowState = "rt/lowstate" # observation from robot # ruff: noqa: N816 kTopicLowCommand_Debug = "rt/lowcmd" # action to robot
kTopicLowState = "rt/lowstate" # observation from robot
LOWCMD_PORT = 6000 LOWCMD_PORT = 6000
LOWSTATE_PORT = 6001 LOWSTATE_PORT = 6001
+3 -2
View File
@@ -43,8 +43,9 @@ from .config_unitree_g1 import UnitreeG1Config
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# DDS topic names follow Unitree SDK naming conventions # DDS topic names follow Unitree SDK naming conventions
kTopicLowCommand_Debug = "rt/lowcmd" # ruff: noqa: N816 # ruff: noqa: N816
kTopicLowState = "rt/lowstate" # ruff: noqa: N816 kTopicLowCommand_Debug = "rt/lowcmd"
kTopicLowState = "rt/lowstate"
G1_29_Num_Motors = 35 G1_29_Num_Motors = 35
G1_23_Num_Motors = 35 G1_23_Num_Motors = 35
@@ -12,7 +12,7 @@ LOWCMD_PORT = 6000
LOWSTATE_PORT = 6001 LOWSTATE_PORT = 6001
def ChannelFactoryInitialize(*args, **kwargs): # DDS to socket bridge #noqa : N802 def ChannelFactoryInitialize(*args, **kwargs): # noqa: N802
global _ctx, _lowcmd_sock, _lowstate_sock global _ctx, _lowcmd_sock, _lowstate_sock
# read socket config # read socket config
config = UnitreeG1Config() config = UnitreeG1Config()
@@ -40,7 +40,7 @@ class ChannelPublisher: # send action to robot
def Init(self): # noqa: N802 def Init(self): # noqa: N802
pass pass
def Write(self, msg): def Write(self, msg): # noqa: N802
_lowcmd_sock.send(pickle.dumps((self.topic, msg))) _lowcmd_sock.send(pickle.dumps((self.topic, msg)))
@@ -52,6 +52,6 @@ class ChannelSubscriber: # read observation from robot
def Init(self): # noqa: N802 def Init(self): # noqa: N802
pass pass
def Read(self): def Read(self): # noqa: N802
topic, msg = pickle.loads(_lowstate_sock.recv()) topic, msg = pickle.loads(_lowstate_sock.recv())
return msg return msg