How to connect to roscore with roslibpy and without a full ROS installation?

asked 2023-03-03 09:46:43 -0600

stockh0lm gravatar image

I need to query roscore (from Linux and/or windows) and get the path (getpath). I found https://answers.ros.org/question/3306... this question/answer, which would do exactly what I need.

For a couple of reasons, it is hard to do a full ROS install. But I did manage to install roslibpy and would like to use it to talk to roscoare to get the path.

What is the surrounding glue code to connect with roslibpy to roscore from locahost or elsewhere and submit this message (and get the answer):

get_plan = rospy.ServiceProxy('/move_base/make_plan', nav_msgs.GetPlan)
req = nav_msgs.GetPlan()
req.start = start
req.goal = Goal
req.tolerance = .5
resp = get_plan(req.start, req.goal, req.tolerance)
print(resp)
edit retag flag offensive close merge delete

Comments

1

Whenever I see Python, ROS and "I don't want to / can't install ROS", I tend to suggest rospypi/simple.

It's exactly rospy, but without a "ROS install". Works on all OS with a Python interpreter (have tested Linux, Windows and macOS). Uses the exact same messages, same API, same config, etc.

gvdhoorn gravatar image gvdhoorn  ( 2023-03-05 10:53:48 -0600 )edit