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
+9 -9
View File
@@ -347,16 +347,16 @@ if __name__ == "__main__":
) )
# reset legs and start locomotion thread # reset legs and start locomotion thread
groot_controller.reset_robot()
groot_controller.start_locomotion_thread()
# log status
logger.info("Robot initialized with GR00T locomotion policies")
logger.info("Locomotion controller running in background thread")
logger.info("Press Ctrl+C to stop")
# keep robot alive
try: try:
groot_controller.reset_robot()
groot_controller.start_locomotion_thread()
# log status
logger.info("Robot initialized with GR00T locomotion policies")
logger.info("Locomotion controller running in background thread")
logger.info("Press Ctrl+C to stop")
# keep robot alive
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()
@@ -37,10 +37,10 @@ class ChannelPublisher: # send action to robot
self.topic = topic self.topic = topic
self.msg_type = msg_type self.msg_type = msg_type
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)))
@@ -49,9 +49,9 @@ class ChannelSubscriber: # read observation from robot
self.topic = topic self.topic = topic
self.msg_type = msg_type self.msg_type = msg_type
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