ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Restart move_base node programatically or control a launch file programatically.

asked 2019-08-20 23:18:32 -0600

spiritninja gravatar image

updated 2019-08-22 01:55:43 -0600

I have a publisher which publishes an occupancy grid map. For navigation, through a launch file I run the map_server AMCL and Move_base which enables me to view the costmap for the map published and also to navigat within the map.

Secondly, the service with respect to the old map is shutdown and the publisher publishes a different map. The AMCL launched initially can be used here again for navigation, but the move_base node will not update it's parameters for the new map that is loaded as i haven't restarted it.

Is there a way through which I could restart move_base programatically so it can load parameters for the new map published? I wouldn't want to shutdown the launch file through which move base was luanched initially.

Or moreover, is there a way to re-initialize costmaps?

Thank you.

edit retag flag offensive close merge delete

Comments

which costmap parameters do you want to change on the relaunch?

pavel92 gravatar image pavel92  ( 2019-08-21 03:33:13 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-08-22 01:54:49 -0600

spiritninja gravatar image

figured out an approach through which I could shutdown and launch move_base depending on map transitions.

Although i wanted to relaod costmaps for a new map published, this does the same. Used the ROS launch API and restructured the usage for my requirement with a move_base launch.

I'll post a basic overlay of usage here.

import roslaunch
import rospy

rospy.init_node('en_Mapping', anonymous=True)
uuid = roslaunch.rlutil.get_or_generate_uuid(None, False)
roslaunch.configure_logging(uuid)
launch = roslaunch.parent.ROSLaunchParent(uuid, ["/home/haier/catkin_ws/src/testapi/launch/test_node.launch"])
launch.start()
rospy.loginfo("started")

rospy.sleep(3)
# 3 seconds later
launch.shutdown()

The uuid can't be used again once launch.shutdown() is initiated. So for a procedural relaunch, this has to be adjusted.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-08-20 23:18:32 -0600

Seen: 1,056 times

Last updated: Aug 22 '19