ethz-asl / terrain-navigation

Repository for Safe Low Altitude Navigation in steep terrain for fixed-wing Aerial Vehicles
https://ieeexplore.ieee.org/abstract/document/10443502
BSD 3-Clause "New" or "Revised" License
104 stars 13 forks source link

cannot import name 'Mode' from 'ardupilot_msgs.msg #70

Open waqaszaidi opened 2 weeks ago

waqaszaidi commented 2 weeks ago

Whenever I tried to run mavros_dds_bridge.py. It gives error from ardupilot_msgs.msg import Mode ImportError: cannot import name 'Mode' from 'ardupilot_msgs.msg' (/home/waqas/ros2_ws/install/ardupilot_msgs/local/lib/python3.10/dist-packages/ardupilot_msgs/msg/init.py)

Jaeyoung-Lim commented 2 weeks ago

@waqaszaidi Please provide more details on your setup. Are you running ros2? ros1? which autopilot are you running?

Since I am not so familiar with Ardupilot, do you have any insights @Ryanf55 @srmainwaring ?

srmainwaring commented 2 weeks ago

@waqaszaidi - looks like mavros_dds_bridge.py is out of date. The service is ardupilot_msgs.srv.ModeSwitch

Assuming that ardupilot_msgs has been built in a workspace:

$ python
Python 3.12.4 (main, Jun  6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ardupilot_msgs.srv import ModeSwitch
>>> help(ModeSwitch)

class ModeSwitch(builtins.object)
 |  Methods defined here:
 |
 |  __init__(self)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  Event = <class 'ardupilot_msgs.srv._mode_switch.ModeSwitch_Event'>
 |      Message class 'ModeSwitch_Event'.
 |
 |
 |  Request = <class 'ardupilot_msgs.srv._mode_switch.ModeSwitch_Request'>
 |      Message class 'ModeSwitch_Request'.
 |
 |
 |  Response = <class 'ardupilot_msgs.srv._mode_switch.ModeSwitch_Response...
 |      Message class 'ModeSwitch_Response'.
waqaszaidi commented 2 weeks ago

b51acf9e-3227-4910-9c75-5e3ebde0ec10) Thankyou very much for quick response @Jaeyoung-Lim @srmainwaring

I am little new, I want to run the planner with ardupilot, so i am having some basic question Does it needs modification. Since I am following guide which is present in https://discuss.ardupilot.org/t/offboard-terrain-navigation-for-plane-with-ros-2-ap-dds/114418.

First I setup according to https://ardupilot.org/dev/docs/ros2-sitl.html and I was able to get ardupilot_dds node Then I switched to https://github.com/srmainwaring/ardupilot/tree/wips/wip-terrain-nav and rebuild workspace, now I am not getting any node in ros2 node list. Arduplane is working fine in sitl with mavproxy

Next according to guide I need to run the mavros_dds_bridge.py but It is giving me error

ardupilot_msgs.msg import Mode ImportError: cannot import name 'Mode' from 'ardupilot_msgs.msg' (/home/waqas/ros2_ws/install/ardupilot_msgs/local/lib/python3.10/dist-packages/ardupilot_msgs/msg/init.py)

[terrain_planner_node-1] Requesting global origin messages [terrain_planner_node-1] [WARN] [1725444728.768731029] [terrain_planner]: Service [/mavros/cmd/command] not available. Screenshot from 2024-09-04 15-12-21

Ryanf55 commented 1 week ago

I can put together a patch.

waqaszaidi commented 1 week ago

Hello @Ryanf55 @srmainwaring. I just want to ask why the arduplane not follow the path made by the planner. It just revolve around the path and keeps on decreasing the height and unable to reach the Goal State?