Restart move_base node programatically or control a launch file programatically.
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.
Asked by spiritninja on 2019-08-20 23:18:32 UTC
Answers
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.
Asked by spiritninja on 2019-08-22 01:54:49 UTC
Comments
which costmap parameters do you want to change on the relaunch?
Asked by pavel92 on 2019-08-21 03:33:13 UTC