英文:
ImportError: cannot import name 'NavigateThroughPoses' from 'nav2_msgs.action'
问题
I am trying to follow https://github.com/SteveMacenski/nav2_rosdevday_2021/tree/main/nav2_rosdevday_2021
As I run robot_navigator.py, I am getting
ImportError: cannot import name 'NavigateThroughPoses' from 'nav2_msgs.action' (/opt/ros/foxy/lib/python3.8/site-packages/nav2_msgs/action/init.py)
The problem is in
from nav2_msgs.action import NavigateThroughPoses, NavigateToPose, FollowWaypoints, ComputePathToPose, ComputePathThroughPoses
It can not find NavigateThroughPoses and ComputePathThroughPoses (while finding the rest).
When I follow to init.py, I see:
from nav2_msgs.action._back_up import BackUp # noqa: F401
from nav2_msgs.action._compute_path_to_pose import ComputePathToPose # noqa: F401
from nav2_msgs.action._dummy_recovery import DummyRecovery # noqa: F401
from nav2_msgs.action._follow_path import FollowPath # noqa: F401
from nav2_msgs.action._follow_waypoints import FollowWaypoints # noqa: F401
from nav2_msgs.action._navigate_to_pose import NavigateToPose # noqa: F401
from nav2_msgs.action._spin import Spin # noqa: F401
from nav2_msgs.action._wait import Wait # noqa: F401
So NavigateThroughPoses and ComputePathThroughPoses are, indeed, not there.
Any idea what is wrong and how to fix it?
Thank you.
英文:
I am trying to follow https://github.com/SteveMacenski/nav2_rosdevday_2021/tree/main/nav2_rosdevday_2021
As I run robot_navigator.py, I am getting
ImportError: cannot import name 'NavigateThroughPoses' from 'nav2_msgs.action' (/opt/ros/foxy/lib/python3.8/site-packages/nav2_msgs/action/__init__.py)
The problem is in
from nav2_msgs.action import NavigateThroughPoses, NavigateToPose, FollowWaypoints, ComputePathToPose, ComputePathThroughPoses
It can not find NavigateThroughPoses and ComputePathThroughPoses (while finding the rest).
When I follow to init.py, I see:
from nav2_msgs.action._back_up import BackUp # noqa: F401
from nav2_msgs.action._compute_path_to_pose import ComputePathToPose # noqa: F401
from nav2_msgs.action._dummy_recovery import DummyRecovery # noqa: F401
from nav2_msgs.action._follow_path import FollowPath # noqa: F401
from nav2_msgs.action._follow_waypoints import FollowWaypoints # noqa: F401
from nav2_msgs.action._navigate_to_pose import NavigateToPose # noqa: F401
from nav2_msgs.action._spin import Spin # noqa: F401
from nav2_msgs.action._wait import Wait # noqa: F401
So NavigateThroughPoses and ComputePathThroughPoses are, indeed, not there.
Any idea what is wrong and how to fix it?
Thank you.
答案1
得分: 1
你无法在那里找到它们,因为它们对于ROS2 Foxy版本是不存在的,它们只从ROS2 Galactic版本开始提供。
这里 是ROS2 Navigation文档中提到的NavigateThroughPoses和ComputePathThroughPoses在ROS2 Galactic中特定添加的页面。
最好将系统从Foxy升级到Galactic,并尝试您的代码,而不是试图将较新的代码适应Foxy中运行(即使可能性很小)。
英文:
You are unable to find them there because they do not exist for ROS2 Foxy and have only been made available from ROS2 Galactic onwards.
Here is the page on the ROS2 Navigation documentation that mentions the specific addition of NavigateThroughPoses and ComputePathThroughPoses in ROS2 Galactic.
Would be best to move from Foxy to Galactic and try your code instead of breaking one's head trying to adapt the newer code to run in Foxy (if even possible).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论