reorg a bit

This commit is contained in:
yjinzero 2025-02-13 22:01:39 +09:00
parent a81f4fc4a4
commit fa299cc83f
1 changed files with 4 additions and 3 deletions

View File

@ -11,14 +11,12 @@ import yaml
class StatePublisher(Node): class StatePublisher(Node):
def __init__(self): def __init__(self):
rclpy.init()
super().__init__('state_publisher') super().__init__('state_publisher')
qos_profile = QoSProfile(depth=10) qos_profile = QoSProfile(depth=10)
with open('./configs/ik.yaml', 'r') as fp: with open('./configs/ik.yaml', 'r') as fp:
self.joint_names = yaml.safe_load(fp)['motor_joint'] self.joint_names = yaml.safe_load(fp)['motor_joint']
self.low_state = LowStateHG() self.low_state = LowStateHG()
self.low_state_subscriber = self.create_subscription(LowStateHG, self.low_state_subscriber = self.create_subscription(LowStateHG,
'lowstate', self.on_low_state, 10) 'lowstate', self.on_low_state, 10)
@ -62,8 +60,11 @@ class StatePublisher(Node):
def main(): def main():
rclpy.init()
node = StatePublisher() node = StatePublisher()
node.run() rclpy.spin(node)
node.destroy_node()
rclpy.shutdown()
if __name__ == '__main__': if __name__ == '__main__':
main() main()