thien94 / vision_to_mavros

A collection of ROS and non-ROS (Python) code that converts data from vision-based system (external localization system like fiducial tags, VIO, SLAM, or depth image) to corresponding mavros topics or MAVLink messages that can be consumed by a flight control stack (with working and tested examples for ArduPilot).
https://ardupilot.org/dev/docs/ros-vio-tracking-camera.html
GNU General Public License v3.0
242 stars 146 forks source link

Move to pymavlink in place of dronekit-python #30

Closed peterbarker closed 3 years ago

peterbarker commented 3 years ago

... also use sys.stderr for progress messages

peterbarker commented 3 years ago

Chief advantage of this PR is that you don't need to wait for dronekit-python to be "ready" - which is mostly parameter-downloads, which this script doesn't need. The vehicle abstraction which dronekit-python provides isn't necessary or useful in this script - and the extra verbiage required to send messages is pretty silly.

Second major advantage here is the stderr change - it means when started from systemd the logs get the error messages in good order.

thien94 commented 3 years ago

Thank you very much for the insightful comments and suggestions. I guess the dronekit-python related parts are not necessary for now.

I will try it out on my system before merging.

rishabsingh3003 commented 3 years ago

@thien94 while you are on this, there is another small issue that I have found... it would be great if you could verify it as well. When you enable debugging options in your script and diplay the output image... I belive the green line is at the wrong location? https://youtu.be/VjnAIbJb-Ks - Here is video of this problem, you'd see no data is detected when my hand is over the green line and its actually much below the line where the data is being sent. I have it fixed here: https://github.com/peterbarker/vision_to_mavros/pull/1/commits/3f0e4799a0176b6ad29e791feed01489312af3e6

But it would be great if you could confirm this once.. it's mostly a resizing issue. Thanks!

thien94 commented 3 years ago

@rishabsingh3003 I can't seem to replicate the problem with the current code on master. What settings did you use for the experiment? Did the issue happen before or after the changes in this PR?

rishabsingh3003 commented 3 years ago

@thien94 this experiment is on your master, with no changes at all except - I limited the Range to [0.1,0.5] so that it only sees my hand skips the rest of the depth data, which can be seen in the video. I am also using d435i Everything else is on default. I.e I simply run - python3 d4xx_to_mavlink.py --debug_enable 1

thien94 commented 3 years ago

Thank you @peterbarker. It works well on my system, merging now.

@rmackay9 I will try to apply the relevant changes in this PR into the t265_to_mavlink.py script as well.

@rishabsingh3003 Thank you for the info. I will add your fix in the next commit.

rmackay9 commented 3 years ago

@thien94, great, thanks very much! really happy the changes will go into the t265 script as well ('cuz this is actually what I use most)!