ImportError: 无法从 ‘nav2_msgs.action’ 导入 ‘NavigateThroughPoses’

huangapple go评论82阅读模式
英文:

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).

huangapple
  • 本文由 发表于 2023年2月19日 07:04:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75496930.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定