open-rmf / fleet_adapter_mir

RMF/RoMi-H fleet adapter for the MiR API
Apache License 2.0
15 stars 15 forks source link

rmf not getting current position response from API. #22

Closed sajidmohd717 closed 1 year ago

sajidmohd717 commented 2 years ago

Hello, we are testing RMF with mir 100, we are able to obtain movements when giving loop tasks to adjacent points (like when there is a loop from point_1 to point_2).

However, when points are not adjacent (as in..., there is many points in between 2 of the beginning and end points), such as start point being point_1 and end point being point_5 and inbetween point_1 and point_5 is point 2,3 and 4.

After the robot goes from point_1 to point_2, our fleet adapter dies with an error, as can be seen on the image here:

image

What i think is going on:

It seems that, when a task (start point_1 and end point_5 is given) robot goes to point_1 to go to point_2, then rmf asks mir for what position it is in currently and mir is not sending back a response to the request that rmf core is sending.

We believe it is an API payload issue where data exchange is being done in wrong format.

Do you have any input on potentially solving this issue.

aaronchongth commented 2 years ago

Please use a code block for sharing snippets, and gist for longer logs, this will help us see the entirety of the issue and help with searching for key words, while a screenshot is not very helpful.

In this case a full terminal log in a gist would be the most helpful.

Hello @sajidmohd717! Sorry to hear that you are having this issue. Could you please share with me more information about your setup?

Like you surmised, I have a strong suspicion that this is due to an incompatible version of firmware or API.

Edit: using postman to verify the format of the response would be a good start. Or modifying the fleet adapter and printing out the response

sajidmohd717 commented 1 year ago

It seems that our API response from status_get() would show an error_code as being "service unavailable". How we solved it is by re-prompting for a response until the error code is not service unavailable anymore. And after prompting for the second time the error code is not given as service_unavailable anymore.

This is the code we added in into the update_position function.

        while api_response.get("error_code") == "service_unavailable" and counter < 5:
            api_response = self.mir_api.status_get()
            print("Current count", counter)   
            counter += 1 
            time.sleep(0.5)