Posted by @DDDWY:
I’m developing a demo using easy_fleet_adapter, and the scenario I’m currently testing involves crossing floors. For example, I move from “charge1” on L1 to “l2_bay_99” on L2. However, “l2_bay_99” is not set as “is_parking_spot=true.” When I reach the destination, I notice that the task remains in the standby state. Below is the data retrieved from the task state API call (http://localhost:8000/tasks/direct_c9b8e8e7-a082-427c-8f1b-a0c450d754b1/state):
{ "booking": { "id": "direct_c9b8e8e7-a082-427c-8f1b-a0c450d754b1", "unix_millis_earliest_start_time": 1718888721084, "unix_millis_request_time": null, "priority": null, "labels": null, "requester": null }, "category": "go_to_place", "detail": {}, "unix_millis_start_time": 1718888722648, "unix_millis_finish_time": 1718888988345, "original_estimate_millis": 0, "estimate_millis": 0, "assigned_to": { "group": "tinyRobot", "name": "c595d399-f240-460f-8bd1-7119c1dad025" }, "status": "standby", "dispatch": null, "phases": { "1": { "id": 1, "category": "Go to [place:l2_bay_99]", "detail": "Moving the robot from [place:charge1] to [place:l2_bay_99]", "unix_millis_start_time": 1718888722633, "unix_millis_finish_time": 1718888988344, "original_estimate_millis": 47626, "estimate_millis": 309, "final_event_id": 0, "events": { "0": { "id": 0, "status": "standby", "name": "Go to [place:l2_bay_99]", "detail": "Moving the robot from [place:charge1] to [place:l2_bay_99]", "deps": [ 26, 27, 25, 33 ] }, "1": { "id": 1, "status": "standby", "name": "Take [lift:Lift1] to [floor:L2]", "detail": {}, "deps": [ 7, 8, 9, 10, 11 ] }, "2": { "id": 2, "status": "completed", "name": "Move to [place:test_4] < 13.8932 -22.4329 0.662802> through 5 points", "detail": {}, "deps": [] }, "3": { "id": 3, "status": "underway", "name": "Lock mutex groups ", "detail": "Waiting for the mutex groups to be locked", "deps": [] }, "4": { "id": 4, "status": "standby", "name": "Move to [place:test_19] <19.3671 -18.16 0.37482> through 3 points", "detail": {}, "deps": [] }, "5": { "id": 5, "status": "standby", "name": "Lock mutex groups ", "detail": "Waiting for the mutex groups to be locked", "deps": [] }, "6": { "id": 6, "status": "standby", "name": "Move to [place:test_20] < 20.5493 -17.6949 0.661105> through 3 points", "detail": {}, "deps": [] }, "7": { "id": 7, "status": "standby", "name": "Requesting lift \"\" to \"\"", "detail": {}, "deps": [] }, "8": { "id": 8, "status": "standby", "name": "Move to [graph-wp:5] < 21.4737 -16.9758 0.661105> through 2 points", "detail": {}, "deps": [] }, "9": { "id": 9, "status": "standby", "name": "Requesting lift \"\" to \"\"", "detail": {}, "deps": [] }, "10": { "id": 10, "status": "standby", "name": "Move to [place:l2_bay_98] < 20.583 -15.9205 2.27179> through 2 points", "detail": {}, "deps": [] }, "11": { "id": 11, "status": "standby", "name": "End session with lift [Lift1]", "detail": {}, "deps": [] }, "12": { "id": 12, "status": "standby", "name": "Move to [place:l2_bay_99] < 19.6793 -16.5028 -2.56915> through 3 points", "detail": {}, "deps": [] }, "13": { "id": 13, "status": "underway", "name": "Take [lift:Lift1] to [floor:L2]", "detail": {}, "deps": [ 19, 20, 21, 22, 23 ] }, "14": { "id": 14, "status": "completed", "name": "Move to [place:test_4] < 13.8932 -22.4329 0.662802> through 3 points", "detail": {}, "deps": [] }, "15": { "id": 15, "status": "completed", "name": "Lock mutex groups ", "detail": "Waiting for the mutex groups to be locked", "deps": [] }, "16": { "id": 16, "status": "completed", "name": "Move to [place:test_19] <19.3671 -18.16 0.37482> through 3 points", "detail": {}, "deps": [] }, "17": { "id": 17, "status": "completed", "name": "Lock mutex groups ", "detail": "Waiting for the mutex groups to be locked", "deps": [] }, "18": { "id": 18, "status": "completed", "name": "Move to [place:test_20] < 20.5493 -17.6949 0.661105> through 3 points", "detail": {}, "deps": [] }, "19": { "id": 19, "status": "underway", "name": "Requesting lift \"\" to \"\"", "detail": {}, "deps": [] }, "20": { "id": 20, "status": "standby", "name": "Move to [graph-wp:5] < 21.4737 -16.9758 0.661105> through 2 points", "detail": {}, "deps": [] }, "21": { "id": 21, "status": "standby", "name": "Requesting lift \"\" to \"\"", "detail": {}, "deps": [] }, "22": { "id": 22, "status": "standby", "name": "Move to [place:l2_bay_98] < 20.583 -15.9205 2.27179> through 2 points", "detail": {}, "deps": [] }, "23": { "id": 23, "status": "standby", "name": "End session with lift [Lift1]", "detail": {}, "deps": [] }, "24": { "id": 24, "status": "standby", "name": "Move to [place:l2_bay_99] < 19.6793 -16.5028 -2.56915> through 3 points", "detail": {}, "deps": [] }, "25": { "id": 25, "status": "standby", "name": "Take [lift:Lift1] to [floor:L2]", "detail": {}, "deps": [ 28, 29, 30, 31, 32 ] }, "26": { "id": 26, "status": "completed", "name": "Lock mutex groups ", "detail": "Waiting for the mutex groups to be locked", "deps": [] }, "27": { "id": 27, "status": "completed", "name": "Move to [place:test_20] < 20.5493 -17.6949 0.661105> through 2 points", "detail": {}, "deps": [] }, "28": { "id": 28, "status": "standby", "name": "Requesting lift \"\" to \"\"", "detail": {}, "deps": [] }, "29": { "id": 29, "status": "completed", "name": "Move to [graph-wp:5] < 21.4737 -16.9758 0.661105> through 2 points", "detail": {}, "deps": [] }, "30": { "id": 30, "status": "completed", "name": "Requesting lift \"\" to \"\"", "detail": {}, "deps": [] }, "31": { "id": 31, "status": "completed", "name": "Move to [place:l2_bay_98] < 20.583 -15.9205 2.27179> through 2 points", "detail": {}, "deps": [] }, "32": { "id": 32, "status": "completed", "name": "End session with lift [Lift1]", "detail": {}, "deps": [] }, "33": { "id": 33, "status": "completed", "name": "Move to [place:l2_bay_99] < 19.6793 -16.5028 -2.56915> through 3 points", "detail": {}, "deps": [] } }, "skip_requests": null } }, "completed": [ 1 ], "active": 1, "pending": [], "interruptions": null, "cancellation": null, "killed": null }
I noticed that when the destination is a point with “is_parking_spot=true”, and the elevator is used to reach the destination, the task can be completed successfully. I’m wondering if this behavior is by design or if there might be an issue with my code. I’ve implemented the lift_adapter and localize methods, and I would appreciate it if you could take a look at my code. This issue has been troubling me for several days now.
class RobotAdapter:
def __init__(
self,
name: str,
configuration,
node,
api: RobotAPI,
fleet_handle,
localization_pub
):
self.localization_pub = localization_pub
self.name = name
self.execution = None
self.update_handle = None
self.configuration = configuration
self.node = node
self.api = api
self.fleet_handle = fleet_handle
self.cmd_id = None
self.state = None
def update(self, state):
activity_identifier = None
self.state = state
if self.execution:
complete = self.api.is_command_completed(self.cmd_id)
if complete:
self.node.get_logger().info(
f' robot: {self.name} execution move {self.cmd_id} complete {complete}')
self.execution.finished()
self.execution = None
self.cmd_id = None
else:
activity_identifier = self.execution.identifier
self.update_handle.update(state, activity_identifier)
def make_callbacks(self):
callbacks = rmf_easy.RobotCallbacks(
lambda destination, execution: self.navigate(
destination, execution
),
lambda activity: self.stop(activity),
lambda category, description, execution: self.execute_action(
category, description, execution
)
)
callbacks.localize = lambda estimate, execution: self.localize(
estimate, execution
)
return callbacks
def localize(self, estimate, execution):
self.execution = execution
self.node.get_logger().info(
f' localize insideLift {estimate.inside_lift} 机器人: {self.name} 当前地图 {estimate.map} 所在位置 {estimate.position}')
cmd_id = self.api.localize(self.name, estimate.position, estimate.map)
self.cmd_id = cmd_id
self.node.get_logger().info(
f' cmd_id {self.cmd_id}')
def navigate(self, destination, execution):
self.execution = execution
self.node.get_logger().info(
f'Commanding [{self.name}] to navigate to {destination.position} '
f'on map [{destination.map}]'
)
response = self.api.navigate(
self.name,
destination.position,
destination.map,
destination.yaw
)
self.node.get_logger().info(f"创建移动指令 生成指令id:: {response['cmd_id']}")
self.cmd_id = response['cmd_id']
def stop(self, activity):
if self.execution is not None:
if self.execution.identifier.is_same(activity):
self.execution = None
self.api.stop(self.name)
It’s important to note that currently, my robot takes about one minute to execute the command for switching maps. Could this delay in the process be causing the task not to complete?