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

Sending Goals to the Navigation Stack Help

asked 2021-11-15 16:16:51 -0500

adamt11 gravatar image


I am new to ROS and want to use the functionality described here to move my robot to a desired waypoint:

I am using ROS Melodic on Ubuntu 18.04. I am using a Husky simulated robot in Gazebo, and want to use code to move it to a desired waypoint. Once I reach this step: rostopic list | grep move_base/goal The tutorial says that something should show up, but when I enter this command nothing happens. There is no error, it just does nothing. The tutorial says to check the name of the action and make sure it is "move_base", and to my knowledge it is the same for the Husky robot.

Please help me get this tutorial working for my robot, or if there is something else that achieves the same goal that could also be useful.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-11-15 17:03:42 -0500

osilva gravatar image

The following code is in Python but it shows you how to use Waypoints with Husky, currently is an infinite loop, but you can modify accordingly:

Launch the following in separate terminals:

$ roslaunch husky_gazebo husky_empty_world
$ roslaunch husky_viz view_robot.launch
$ roslaunch husky_navigation move_base_mapless_demo.launch

Run the following python program:

#! /usr/bin/env python3

import rospy
import actionlib
from move_base_msgs.msg import MoveBaseAction, MoveBaseResult, MoveBaseGoal

class MoveHusky(object):
  def __init__(self):
    self.client = actionlib.SimpleActionClient('/move_base', MoveBaseAction)
    self.goal = MoveBaseGoal()

  def moveToDest(self, x, y):
    self.goal.target_pose.header.frame_id = "odom"
    self.goal.target_pose.pose.position.x = x
    self.goal.target_pose.pose.position.y = y
    self.goal.target_pose.pose.orientation.z = 0.7071
    self.goal.target_pose.pose.orientation.w = 0.7071
    rate = rospy.Rate(10)
    result = self.client.get_result()
    while result == None:
      result = self.client.get_result()
      status = self.client.get_state()
      rospy.loginfo("Status: {}".format(status))
      rospy.loginfo("Result: {}".format(result))

if __name__ == "__main__":
  moveHusky = MoveHusky()

  while not rospy.is_shutdown():
    moveHusky.moveToDest(-4.0, 0.0)
    moveHusky.moveToDest(-4.0, -2.0)
    moveHusky.moveToDest(0.0, 0.0)
edit flag offensive delete link more


One of the particular thing with Husky, is that the header frame is odom, in the example the Navigation tutorial base_link is used instead.

osilva gravatar image osilva  ( 2021-11-15 17:21:04 -0500 )edit

Thanks, that python code ran successfully. Why does move_base_mapless_demo need to be launched? I'm not sure exactly what this does.

adamt11 gravatar image adamt11  ( 2021-11-16 10:25:31 -0500 )edit

It starts the navigation node by calling move_base.launch:


  <!--- Run Move Base -->  
  <include file="$(find husky_navigation)/launch/move_base.launch">
    <arg name="no_static_map" value="true"/>


And to see what is move_base.launch refer to:

osilva gravatar image osilva  ( 2021-11-16 10:42:32 -0500 )edit

Question Tools

1 follower


Asked: 2021-11-15 16:16:51 -0500

Seen: 232 times

Last updated: Nov 15 '21