GIT上的nav2_gps_waypoint_follower_demo是基于ros-iron编写的,其中followGpsWaypoints(wps) service只能在Iron上使用。
解决方法:
第一步:将interactive_waypoint_follower.py修改为如下代码:
import rclpy
from rclpy.node import Node
from nav2_simple_commander.robot_navigator import BasicNavigator
from geometry_msgs.msg import PointStamped
from nav2_gps_waypoint_follower_demo.utils.gps_utils import latLonYaw2Geopose
from nav2_msgs.action import FollowWaypoints
from geometry_msgs.msg import PoseStamped
from robot_localization.srv import FromLL
class InteractiveGpsWpCommander(Node):
"""
ROS2 node to send gps waypoints to nav2 received from mapviz's point click publisher
"""
def __init__(self):
super().__init__(node_name="gps_wp_commander")
self.navigator = BasicNavigator("basic_navigator")
self.mapviz_wp_sub = self