add new service

This commit is contained in:
0nhc 2024-10-13 01:04:35 -05:00
parent 82815304bd
commit 60e327b8fb

View File

@ -73,7 +73,7 @@ class BtSimNode:
SwitchController, SwitchController,
self.switch_controller, self.switch_controller,
) )
rospy.Service("get_target_seg_id", Trigger, self.get_target_seg_id) rospy.Service("get_target_seg_id", TargetID, self.get_target_seg_id)
def seed(self, req): def seed(self, req):
self.sim.seed(req.seed) self.sim.seed(req.seed)
@ -88,10 +88,10 @@ class BtSimNode:
self.activate_plugins() self.activate_plugins()
return ResetResponse(to_bbox_msg(bbox)) return ResetResponse(to_bbox_msg(bbox))
def seed(self, req): def get_target_seg_id(self, req):
self.sim.seed(req.seed) response = TargetIDResponse()
rospy.loginfo(f"Seeded the rng with {req.seed}.") response.id = self.sim.select_target()
return SeedResponse() return response
def switch_controller(self, req): def switch_controller(self, req):
for controller in req.stop_controllers: for controller in req.stop_controllers: