# MAVSDK Python Example Hanging

Source: https://forum.modalai.com/topic/179/mavsdk-python-example-hanging
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2021-04-02 22:12:05 UTC by kiprock
Replies: 6 · Views: 1962

## kiprock · 2021-04-02 22:12:05 UTC

Hello! I tried the MAVSDK python example this afternoon and it looks like it's hanging while waiting for global position estimate:

```
root@apq8096:/home# python3 takeoff_and_land2.py
Waiting for mavsdk_server to be ready...
Connected to mavsdk_server!
Waiting for drone to connect...
Drone discovered with UUID: 3762846593019032885
Waiting for drone to have a global position estimate...
```
Suggestions for debugging?

## Reply by modaltb (ModalAI staff) · 2021-04-02 23:05:47 UTC

Hey Kip,

I'm guessing you have GPS lock right?  You can see this if you have QGC connected, there's a little satellite icon on the top bar.

To be honest I think it could be commented out, this was a copy/pasta from the MAVSDK examples.

For your use case we discussed, here's another example that should be in the container as well, showing how to set the "waypoints" using VIO:

https://gitlab.com/voxl-public/voxl-docker-images/voxl-docker-mavsdk-python/-/blob/master/offboard_position_ned2.py#L21

Here's the video for that one as reference (NOTE: the April Tag in the video isn't being used.  BUT, this is a good example of how you could configure april tags on the ground and program their locations.  Then during this flight, the m500 could do a course correction if needed for higher accuracy).  https://www.youtube.com/watch?v=V3vVs8fEOZs

## Reply by kiprock · 2021-04-02 23:13:30 UTC

QGC says "No GPS Lock for Vehicle" and gps status is set to 0.

I'm having another strange problem that might be related... when trying to run voxl-vision-px4 the system is crashing entirely. 

```
~ # voxl-vision-px4 --debug_fixed_frame
loading config file
=================================================================
Parameters as loaded from config file:
qgc_ip:                     192.168.0.218
en_localhost_mavlink_udp    1
en_secondary_qgc:           0
secondary_qgc_ip:           192.168.1.214
en_vio:                     1
en_voa:                     0
en_send_vio_to_qgc:         0
en_send_voa_to_qgc:         0
en_adsb:                    0
adsb_uart_bus:              7
adsb_uart_baudrate:         57600
px4_uart_bus:               5
px4_uart_baudrate:          921600
offboard_mode:              off
R_imu_to_body:
 0.0000   1.0000   0.0000
 1.0000   0.0000   0.0000
 0.0000   0.0000  -1.0000
T_imu_wrt_body:
 0.0680  -0.0150  -0.0080
height_body_above_ground_m:  0.050
land_on_tag_id:             0
follow_tag_id:              0
en_apriltag_fixed_frame:    1
en_transform_mavlink_pos_setpoints_from_fixed_frame:1
n_fixed_apriltags:          1
Fixed apriltag #0:
    tag id: 0
    R_tag_to_fixed:
 0.0000  -1.0000   0.0000
 1.0000   0.0000   0.0000
 0.0000   0.0000   1.0000
    T_tag_wrt_fixed:
 0.0000   0.0000   0.0000

T_stereo_wrt_body:
 0.1000  -0.0400   0.0000
en_fixed_frame_pipe:        0
fixed_frame_filter_len:     5
=================================================================
WARNING, exising instance of voxl-vision-px4 found, attempting to stop it
starting geometry module
starting uart mavlink
```

## Reply by kiprock · 2021-04-03 00:00:21 UTC

The flight computer doesn't seem to be getting any positional data for some reason. Is this normal? (see the last line below)
```
~ # systemctl restart voxl-vision-px4
~ #
~ #
~ # systemctl status voxl-vision-px4
● voxl-vision-px4.service - voxl-vision-px4
   Loaded: loaded (/usr/bin/voxl-vision-px4; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2021-04-03 00:11:47 UTC; 5s ago
 Main PID: 4007 (voxl-vision-px4)
   CGroup: /system.slice/voxl-vision-px4.service
           └─4007 /usr/bin/voxl-vision-px4

Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: LNX_8074 supported? 1
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: LNX_8096 supported? 1
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: LNX_IA64 supported? 1
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: WINDOWS supported? 0
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: FASTCV: fcvAvailableHardware Linux
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: FASTCV: fcvAvailableHardware Linux
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: [146.135049] SNAV INFO: CameraManager is finished initializing.
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: [146.135099] SNAV INFO: Starting camera image streaming...
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: [146.146347] SNAV ERROR: Error starting camera streaming. Exiting.
Apr 03 00:11:47 apq8096 voxl-vision-px4[4007]: ERROR: failed to start modalai vision lib
```

## Reply by modaltb (ModalAI staff) · 2021-04-05 15:03:07 UTC

Hey @kiprock ,

Checking in with ya, we had a side email going and I believe getting the camera configuration setup got voxl-vision-px4 going.

Were you able to get a GPS signal going?  Depending on the reception, we sometimes need to move outside of our building to pickup satellites.

Thanks!

## Reply by kiprock · 2021-04-05 17:11:29 UTC

I was able to resolve. I had been following the [ModalAI Vision Lib documentation](https://docs.modalai.com/modalai-vision-lib/) and selected the wrong camera configuration, which causes failures and problems with the core voxl-vision software. The default is #1, but the m500 is #3 (hires + stereo + tracking). Problem solved. Thanks!

## Reply by Chad Sweet (ModalAI staff) · 2021-04-05 17:23:18 UTC

Good news. We will get that updated to be a little more clear.
