Function to Move Drone to Waypoint problems


#1

I seem to be having issues on this video, “Function to Move Drone to Waypoint”

Not really sure what is going on, but I’m having similar issues with the previous video too. QGroundcontrol will pop up, but “Waiting for Vehicle Connection” is constantly displayed, and soon after the code ends. I can’t proceed to the part at Lambeau Field.

I’ve attached my code. Any help is appreciated, thank you!


#2

No code attached?


#3

Is this screenshot photo of the code not showing?


#4

The output is shown, not your code, ie, script.


#5

My mistake. This should help. Sorry it’s in 3 separate images. Couldn’t fit it all into one screen.


#6

There is some slight overlap from me taking screenshots between photo 1 and 2, as well as between photo 2 and 3… for example print(“Look out: Virtual props are spinning!!”) is only on the code once on page 1…
same with “goto(wp1)” … which is only on the code once, not twice like it may appear.

Thanks!


#7

Hi there @Jspatafore49

I think this might be a pymavlink issue.

In your screenshots, it appears you are in the (dksitl) virtual env.

This virtual environment has an older pymavlink version that allows you to use dronekit-sitl, which you only need if you want to launch a SITL vehicle directly from a python script.

With our LaunchSitl bash script, we are launching a SITL instance outside of the python script, so we don’t need dronekit-sitl (which uses ArduCopter version 3.3.0). The SITL vehicle we’re launching in launchSitl is I believe using ArduCopter version 4.0.3. This version of ArduCopter needs a newer pymavlink version to operate correctly.

I think if you exit out of your (dksitl) virtual env and try the dronekit scripts in your main environment, your problems may go away because you’ll be using the newer pymavlink version.

And just a refresher, pymavlink is basically the python libraries that encodes MAVLink messages used to communicate with the ArduPilot firmware.

Hope this helps!


#8

Hi Caleb,

I did try outside of the virtual environment and I still seem to be getting errors. I even copied your code exactly for my “LaunchSitl” and “location_based_movement”, still seem to be getting errors. Qgroundcontrol will launch, but the drone never seems to connect… and therefore I cannot fly to Packer Pro Shop to get some cheese curds. Which isn’t totally a shame for me because I am a Steelers fan and haven’t forgotten about Super Bowl 45!!

Jk :slight_smile:

Appreciate your help as always.
Joe


#9

I thought the sitl bash scripts were simply executing what is otherwise done manually in a convenient form, but now it seems there is some other magic happening whereby it can execute more current versions of pymavlink, etc. so they all play nice together.

I’m still a student, but just for some clarification, could you run the version checks?
pip freeze | grep -i drone
pip freeze | grep -i mav
lsb_release -a
grep -rR “FIRMWARE_VERSION” ~/courseRoot/apm/ardupilot/ArduCopter/version.h

The last one is something I figured out. Not sure how else to determine the fm w/o opening a GCS.


#10

Hahah well I think I had in the code to not allow the drone to get cheese curds if the pilot is a Steelers fan :wink:

It looks like your first screenshot of the output of LaunchSitl was using ArduCopter 4.0.3, but with the old pymavlink.

In your latest picture, it looks like LaunchSitl now launched ArduCopter 3.3.0, but now with the new version of pymavlink. (You can see that because /home/joseph/.dronekit/sitl/copter-3.3/apm is below Ready To Boot)

For this reason I think the wrong version of pymavlink is still a good hypothesis for your issues.

It is puzzling me why the LaunchSitl script would launch the AC 3.3.0 (dronekit-sitl), because that should only be launching when an IP address isn’t supplied to the dronekit python script, but we are doing that in the LaunchSitl script:

@jax200 brings up a good thing to check.

When you are not in the (dksitl) virtual env, you should be on:

pymavlink 2.4.10
ArduCopter 4.0.3

I’m guessing you’re using the right pymavlink version, and we might be able to see why the dronekit-sitl AC 3.3.0 is launching after we take a peak at the LaunchSitl script.

Also I know this might sound dumb, but after a few years of working in IT, the ole’ restart is a magical solution wizard. You could also try restarting the virtual machine as well to see if there was any weird caching things going on that would launch the wrong AC version 3.3.0


#11

Hmm interesting. So it looks like my non-virtual environment runs:
MAVproxy==1.8.17
pymavlink==2.4.11
dronkeit==2.9.2
dronkeit-sitl==3.3.0

and my virtual environment runs:
MAVproxy==1.6.2
pymavlink==2.0.6
dronekit==2.9.1
dronekit-sitl==3.3.0

So I guess I just need to update my main environment’s APM and change pymavlink to 2.4.10?

Thank you.


#12

Actually those versions look like they should be fine, there shouldn’t be much difference with pymavlink 2.4.11 and 2.4.10

I think the main issue is the SITL vehicle that launched in your main environment was AC 3.3.0. That needs pymavlink 2.0.6, but your main environment is on 2.4.11

The expected behavior is the SITL vehicle in the main environment to be AC 4.0.3 that uses pymavlink 2.4.10 (and most likely 2.4.11).

I’m not sure why AC 3.3.0 launched in your main environment, since it looks like your LaunchSitl script launches AC 4.0.3. You could try uninstalling 3.3.0 with this command from your main environment

sudo pip uninstall dronekit-sitl

You might have to run that twice. I think once you’re launching SITL with arudcopter version 4.0.3 your issues will be gone


#13

Hello,

So I was able to get Pymavlink 2.4.10 instead of 2.4.11, and uninstall dronkit-sitl 3.3.0, but now I can’t seem to install version 4.0.3.

joseph@joseph-VirtualBox:~$ sudo pip install pymavlink==2.4.10
The directory ‘/home/joseph/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/home/joseph/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting pymavlink==2.4.10
Requirement already satisfied: future in /usr/local/lib/python2.7/dist-packages (from pymavlink==2.4.10)
Requirement already satisfied: lxml in /usr/lib/python2.7/dist-packages (from pymavlink==2.4.10)
Installing collected packages: pymavlink
Successfully installed pymavlink-2.4.10
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
joseph@joseph-VirtualBox:~$ cd courseRoot/env
joseph@joseph-VirtualBox:~/courseRoot/env$ pip freeze | grep -i drone
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
dronekit==2.9.2
joseph@joseph-VirtualBox:~/courseRoot/env$ pip freeze | grep -i mav
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
MAVProxy==1.8.17
pymavlink==2.4.10
joseph@joseph-VirtualBox:~/courseRoot/env$ sudo pip install dronekit-sitl==4.0.3The directory ‘/home/joseph/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/home/joseph/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting dronekit-sitl==4.0.3
Could not find a version that satisfies the requirement dronekit-sitl==4.0.3 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.3.0, 2.4.0, 2.4.1, 2.4.2, 3.0.0, 3.0.1, 3.1.0, 3.2.0, 3.3.0)
No matching distribution found for dronekit-sitl==4.0.3
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
joseph@joseph-VirtualBox:~/courseRoot/env$ pip install dronekit-sitl==4.0.3
Collecting dronekit-sitl==4.0.3
Could not find a version that satisfies the requirement dronekit-sitl==4.0.3 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.3.0, 2.4.0, 2.4.1, 2.4.2, 3.0.0, 3.0.1, 3.1.0, 3.2.0, 3.3.0)
No matching distribution found for dronekit-sitl==4.0.3
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
joseph@joseph-VirtualBox:~/courseRoot/env$ pip freeze | grep -i drone
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
dronekit==2.9.2
joseph@joseph-VirtualBox:~/courseRoot/env$


#14

I’m sorry I was being a bit confusing with my messages.

The ardupilot SITL drone you have under /home/dronedojo/courseRoot/apm/ardupilot/build/sitl/bin/arducopter should be running ArduCopter version 4.0.3

Alternatively, dronekit-sitl is simply a way to start an Arducopter SITL drone directly from a python script. The highest version of ArduCopter available for dronekit-sitl is ArduCopter 3.3.0, which is why you can’t install dronekit-sitl that uses ArduCopter SITL version 4.0.3

The ArduCopter version you need to be launching from launchSitl is the 4.0.3 version you have under ~/courseRoot/apm/ardupilot/…

Uninstalling dronekit-sitl in your main environment was a hypothesis to force your launchSitl script to use the right version of ArduCopter (4.0.3)

If you already had that set up in launchSitl, would you mind posting your ‘launchSitl’ script in this forum or shooting me an email with it?

Sorry this has been such a hassle!


#15

No problem! I just emailed it over, thanks for your help.


#16

I figured it out!

Look at the line where you are launching screen and mavproxy.

At the end you have “–out=127.0.0.1.5762”

But you should have a colon in between the IP address and the port number.

So it should read like “–out=127.0.0.1:5762”

I think it should work after this!


#17

Works like a charm! Thank you very much.


#19

Locking the thread.


closed #20