ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The key is the imports from the move_base_msgs.msg
A simple example
import actionlib import rospy from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal, MoveBaseFeedback, MoveBaseResult
rospy.init_node('send_client_goal')
client = actionlib.SimpleActionClient('/move_base', MoveBaseAction)
rospy.loginfo("Waiting for move base server")
client.wait_for_server()
goal = MoveBaseGoal()
goal.target_pose.header.frame_id = 'map'
goal.target_pose.pose.position.x = -0.063
goal.target_pose.pose.position.y = -9.035
goal.target_pose.pose.orientation.z = 0.727
goal.target_pose.pose.orientation.w = 0.686
client.send_goal(goal)
client.wait_for_result()
goal.target_pose.header.frame_id = 'map'
goal.target_pose.pose.position.x = new value
goal.target_pose.pose.position.y = new value
goal.target_pose.pose.orientation.z = new value
goal.target_pose.pose.orientation.w = new value
client.send_goal(goal)
and so on you can use a loop to make it move from goal to goal also.
There are two simple ways to get valid positions and orientations for the environment you're robots in:
You can also create a feedback callback and get the result with: client.wait_for_result()
result = client.get_result()
You can send any number of goals without creating multiple goals:
just place the client.wait_for_result() between calls
Hope this helps.
2 | No.2 Revision |
The key is the imports from the move_base_msgs.msg
A simple example
import actionlib
import rospy
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal, MoveBaseFeedback, rospy.init_node('send_client_goal')
client.wait_for_server()
goal = MoveBaseGoal()
client.send_goal(goal)
client.wait_for_result()
client.send_goal(goal)
and so on you can use a loop to make it move from goal to goal also.
There are two simple ways to get valid positions and orientations for the environment you're robots in:
You can also create a feedback callback and get the result with:
client.wait_for_result()
with:
client.wait_for_result()
result = client.get_result()client.get_result()
You can send any number of goals without creating multiple goals:
just place the client.wait_for_result() client.wait_for_result()
between calls
Hope this helps.