Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Cartographer's final pose graph optimized trajectory #965

Closed
SubMishMar opened this issue Aug 1, 2018 · 9 comments
Closed

Getting Cartographer's final pose graph optimized trajectory #965

SubMishMar opened this issue Aug 1, 2018 · 9 comments

Comments

@SubMishMar
Copy link

SubMishMar commented Aug 1, 2018

I want to get the final optimized trajectory generated by cartographer in some sort of text or json file and I went through some of the issues which suggested that on running rosservice call /finishtrajectory 0 a protobuf file will be generated inside ./ros but no such file was generated in my case. FYI, I am not using the offline node.

Is there anyway to fix this?

Thanks.

@ojura
Copy link
Contributor

ojura commented Aug 1, 2018

You also have to call the service for saving the state.

@SubMishMar
Copy link
Author

SubMishMar commented Aug 1, 2018

@ojura thanks for your reponse, is it /write_state ?

@SubMishMar
Copy link
Author

SubMishMar commented Aug 1, 2018

@ojura so I rosservice called /write_state and a binary file was generated inside .ros folder. How to read this file?
Thanks.

@ojura
Copy link
Contributor

ojura commented Aug 1, 2018

Have a look here: #460

@SubMishMar
Copy link
Author

SubMishMar commented Aug 1, 2018

Thanks!
I suppose that the discussion in the above mentioned issue asks me to run cartographer_pbstream_map_publisher -pbstream_filename <output_filename> and running it prompts the following output in the command line:

.ros$ cartographer_pbstream_map_publisher -pbstream_filename output
I0801 10:29:45.845443 16013 pbstream_map_publisher_main.cc:56] Loading submap slices from serialized data.
[ INFO] [1533144585.845735264]: I0801 10:29:45.000000 16013 pbstream_map_publisher_main.cc:56] Loading submap slices from serialized data.
I0801 10:29:45.942812 16013 pbstream_map_publisher_main.cc:76] Generating combined map image from submap slices.
[ INFO] [1533144585.942857743]: I0801 10:29:45.000000 16013 pbstream_map_publisher_main.cc:76] Generating combined map image from submap slices.
I0801 10:29:45.950736 16013 pbstream_map_publisher_main.cc:92] Publishing occupancy grid topic map (frame_id: map, resolution:0.050000).
[ INFO] [1533144585.950760768]: I0801 10:29:45.000000 16013 pbstream_map_publisher_main.cc:92] Publishing occupancy grid topic map (frame_id: map, resolution:0.050000).

But the process remains frozen here and nothing else happens.

@ojura
Copy link
Contributor

ojura commented Aug 1, 2018

That tool publishes a map from a .pbstream. You can open rviz and visualize it there. It‘s not frozen, it‘s just continuing to publish the map to other nodes („spinning“ in ROS lingo).

@SubMishMar
Copy link
Author

Yes I can see the map in rviz, thanks. But I want the trajectory node list not the map.

@ojura
Copy link
Contributor

ojura commented Aug 1, 2018

There isn't a tool for that, but you could easily write one yourself, like this:
https://gist.github.com/ojura/85507cd6c8be419357305b30d9bb949d

@SubMishMar
Copy link
Author

Thanks @ojura I was able to compile it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants