Ask Your Question

python rosmsg/rospack in ROS2

asked 2019-04-14 06:03:38 -0500

federico.ferri gravatar image

I have some python code using rosmsg and rospkg, i.e.

rospack = rospkg.RosPack()
lines = rosmsg.get_msg_text(msg_name, False, rospack)

how to do the same in ROS2 with rclpy?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-04-16 01:38:39 -0500

William gravatar image

Right now, you can use the public API for ros2 msg, which can locate the file for you:

But then you'll need to open the file and read the contents for yourself.

Additionally, there should be a Python API which will parse the file for you and give you a Python object representation of it, part of rosidl_adapter.parser:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-04-14 06:03:38 -0500

Seen: 92 times

Last updated: Apr 16