How Can I create ROS Multiwaypoints?[I tried some ways in addition but it didn't work]

58 Views Asked by At

I want to create multi-waypoints and moove robot according to them. I wrote the code below there but when i run the code with Gazebo and RVIZ i take an error (image) enter image description here

#!/usr/bin/env python
import rospy
import actionlib
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal

def get_user_input():
    x = float(input("X koordinatını girin: "))
    y = float(input("Y koordinatını girin: "))
    orientation = float(input("Yönü (radyan cinsinden) girin: "))
    return x, y, orientation

def move_to_waypoint(x, y, orientation):
    client = actionlib.SimpleActionClient('move_base', MoveBaseAction)
    client.wait_for_server()

    goal = MoveBaseGoal()
    goal.target_pose.header.frame_id = 'map'
    goal.target_pose.pose.position.x = x
    goal.target_pose.pose.position.y = y
    goal.target_pose.pose.orientation.z = orientation
    goal.target_pose.pose.orientation.w = 1.0

    client.send_goal(goal)
    client.wait_for_result()

if __name__ == '__main__':
    try:
        rospy.init_node('waypoint_navigation', anonymous=True)

        while True:
            x, y, orientation = get_user_input()
            move_to_waypoint(x, y, orientation)

    except rospy.ROSInterruptException:
        pass

I tried 2d pose estimate from rviz and give the robot different goals but again i have that error

0

There are 0 best solutions below