I have a simulation in gazebo with two husky robots husky1 and husky2. What I want to do is make husky2 approach husky1 which will be controlled by keyboard. I tried using husky's move_base_mapless_demo.launch when there's only one husky in the world and send simple goal with code. Husky moved to the right spot.
However, when there are two huskies in the world and I do the same thing and try moving husky2 to any point, it would make a turn and then drive to infinity. How can I make it drive to correct point when there are two huskies in the world?
Here's my code for sending simple goal
#!/usr/bin/env python
# license removed for brevity
import rospy
import actionlib
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
def movebase_client():
client = actionlib.SimpleActionClient('husky2/move_base',MoveBaseAction)
client.wait_for_server()
# sub_husky1 = rospy.Subscriber("/husky1_odom", Odometry, husky1Odom)
goal = MoveBaseGoal()
goal.target_pose.header.frame_id = "map"
goal.target_pose.header.stamp = rospy.Time.now()
goal.target_pose.pose.position.x = 5
goal.target_pose.pose.position.y = 5
goal.target_pose.pose.orientation.w = 1.0
client.send_goal(goal)
wait = client.wait_for_result()
if not wait:
rospy.logerr("Action server not available!")
rospy.signal_shutdown("Action server not available!")
else:
return client.get_result()
if __name__ == '__main__':
try:
rospy.init_node('movebase_client_py')
result = movebase_client()
if result:
rospy.loginfo("Goal execution done!")
except rospy.ROSInterruptException:
rospy.loginfo("Navigation test finished.")
and here is my move_base.launch file
↧