aerostack2 / project_mavlink

BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Can not start GPS mission #3

Closed Cristian-wp closed 2 days ago

Cristian-wp commented 2 days ago

Hello, I am trying to launch the GPS mission example with 1 drone named: drone0 ./launch_as2.bash -n drone0 I had launch my PX4 simulation without docker and I can see all mavros topic.

Then I launch the web guy: "python3 as2_interface.py --uav_list drone0 --sim_mode true --use_sim_time true And all goes well, until the get origin phase, because I get from the GUI window this output:

Initializing Aerostack UI logger: 1
Message recived: {"message": {"from": 0, "to": 1, "type": "basic", "header": "handshake", "status": "response", "payload": {"response": "success", "id": 1}}}
[INFO] [1728381474.783576072] [drone0.drone0_interface]: Starting drone0
[INFO] [1728381475.294579330] [drone0.drone0_interface]: drone0 interface initialized
[WARN] [1728381505.376917796] [drone0.drone0_interface]: Origin services not ready
Running info publisher

If I try to launch the gps mission with: python3 mission_gps.py -n drone0 I get the following output:

Start mission
Arm
Arm success: True
Offboard
Offboard success: True
Take Off
Take Off success: True
Run mission
Go to with keep yaw [40.4405287, -3.6898277, 5.0]
[ERROR] [1728382046.990914959] [drone0.drone0_interface]: Trying to get origin: service not available
Traceback (most recent call last):
  File "/home/ctrazzi/aerostack2_ws/src/project_mavlink/mission_gps.py", line 173, in <module>
    success = drone_run(uav)
  File "/home/ctrazzi/aerostack2_ws/src/project_mavlink/mission_gps.py", line 98, in drone_run
    success = drone_interface.go_to.go_to_gps_point(goal, speed=SPEED)
  File "/home/ctrazzi/aerostack2_ws/install/as2_python_api/lib/python3.10/site-packages/as2_python_api/modules/go_to_gps_module.py", line 182, in go_to_gps_point
    return self.__go_to(waypoint[0], waypoint[1], waypoint[2],
  File "/home/ctrazzi/aerostack2_ws/install/as2_python_api/lib/python3.10/site-packages/as2_python_api/modules/go_to_gps_module.py", line 110, in __go_to
    return self.start(pose=msg, speed=speed, yaw_mode=yaw_mode,
  File "/home/ctrazzi/aerostack2_ws/install/as2_python_api/lib/python3.10/site-packages/as2_python_api/behavior_actions/go_to_behavior.py", line 66, in start
    pose_stamped = self.__get_pose(pose)
  File "/home/ctrazzi/aerostack2_ws/install/as2_python_api/lib/python3.10/site-packages/as2_python_api/behavior_actions/go_to_behavior.py", line 111, in __get_pose
    return self.__get_pose(geopose)
  File "/home/ctrazzi/aerostack2_ws/install/as2_python_api/lib/python3.10/site-packages/as2_python_api/behavior_actions/go_to_behavior.py", line 113, in __get_pose
    lat0, lon0, h0 = self.__drone.gps.origin
TypeError: cannot unpack non-iterable NoneType object

And this is the Gazebo window: image

How can i make the get origin service avaiable? I had already try to change the waiting time from 3s to 30s (in case was a latency problem) but nothing has changed

RPS98 commented 2 days ago

Hi @Cristian-wp,

The GPS was disabled by default. Please check this commit, which should enable it: https://github.com/aerostack2/project_mavlink/commit/5a6a46ee537e8954a11343f224022a3a669850ef

If this doesn't solve the issue, you can verify if the service is available by running ros2 service list and checking for the state estimator services.

Cristian-wp commented 2 days ago

Yes I had figured out few miutes before your answer, thank you!