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

Help with send_goal velocity control

asked 2021-11-17 19:33:46 -0500

adamt11 gravatar image

The code below was given in a separate question asked on this website, and it is used to send destination waypoints to a Husky robot in Gazebo. It works, but I am curious about part of its function. The Husky travels to the desired waypoints, but it doesn't seem possible to customize the velocity of the robot while traveling to its desired point. In most of the code doing this, the send_goal function is used. Is there a way to look more closely at what is going on in this and customize some aspects? I want to keep the ability to travel to waypoints and be able to control the velocity of the Husky robot to speed it up at some points.

#! /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.client.wait_for_server()
    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)
    self.client.send_goal(self.goal)
    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))
      rate.sleep()

if __name__ == "__main__":
  rospy.init_node("move_base_client")
  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 retag flag offensive close merge delete

Comments

I suggest to review the actionlib tutorials: http://wiki.ros.org/actionlib/Tutorials

Also you can control speed of the robot with /cmd_vel

osilva gravatar image osilva  ( 2021-11-17 20:21:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-11-18 08:09:47 -0500

fergs gravatar image

The move_base node (commonly called ROS Navigation) does not have a velocity interface in the action - you can however change the max velocity that the node will move by using the dynamic reconfigure interface of the Local Planner within move_base.

Note: Depending on the local planner used, there may be other parameters that also need to be tweaked in order to still get the performance you want (for instance, you may need to adjust both the angular and linear limits, or possibly change the sim_time parameter).

edit flag offensive delete link more

Comments

I want to know how the move_base node loads the velocity controller. What is the relationship between send_goal function in action_lib and how the robot executes its trajectory at the low level?

adamt11 gravatar image adamt11  ( 2021-11-21 14:38:16 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-11-17 19:33:46 -0500

Seen: 262 times

Last updated: Nov 18 '21