Integration of ArduPilot and VIO tracking camera (Part 4): non-ROS bridge to MAVLink in Python

Hi Thien,

Thanks for the detailed blog post.
After a few days of getting rid of compiling errors I’ve finally managed to get the T265 to work on our “brick” drone.

Arjan

2 Likes

Thank you for testing out this project! Glad you finally get it working.

Your platform looks very interesting! Is it your own design with the casing?

After a few days of getting rid of compiling errors I’ve finally managed to get the T265 to work on our “brick” drone.

If the compiling errors are related to the code, please let me know as I can make sure others can avoid them too.

The compiling errors mostly came from missing dependencies when installing the different packages in ubuntu 16.04 MATE, unfortunately I did not keep a record of the errors and their solutions.
The platform is not my personal design but it’s designed by the company I work for, we use it to make wallthickness measurements in storage tanks and other GPS denied environments, normally we’re flying in stabilize mode but we’re now looking for systems to make it more guided hence this test of the T265.

2 Likes

@ppoirier, Thank you for your introduction of your great job. My configuration is the same as yours. I also use jetson nano, pixhawk2 (cube) and T265. But I met some problems and please give me some advices. thanks in advance!!

  1. I could not establish the communication between jetson nano and pixhawk. I ran the script of LuckyBird: t265_to_mavlink.py, but the error message I got was:

WARNING :dronekit: link timeout, no heartbeat in last 5 seconds…

Uploading: Screenshot from 2020-04-29 20-58-53.png…

I used the USB to UART and only connected VCC GND TX RX. the USB conneted to Nano, and the TX RX VCC GND connected to TELEM2 of pixhawk.

I don’t know where to connect the CTS and RTS in TELEM2 on the pixhawk. Could you please introduce your connection mothod in detail?

  1. The version of px4 firmware I downloaded with QGC is 1.10.1. I did not find any parameter in the parameter page that can set the baud rate of TELEM2. How do you set it? and what is baud rate of the communication between nano and pixhawk? that is can you show your config in QGC in detail?

hope for your reply! thanks very much.

Hello,
Actually you dont need to connect CTS-RTS on the TELEM2
Just do a “dmesg” to confirm on what device the USB is attached to and use it as a --connect option or within the script directly.

TELEM2 is SERIAL2 so in Mission Planner just set as type 2 and whatever speed desire as long as it is the same as the USB dongle (Generally it is 115200 for dongles)

Regards

1 Like

Hi, @ppoirier, Thanks for your timely reply!
And many thanks to your advice, now I think they have estabilshed the communication basically, but there are still some problems here, which I think it may be due to the firmware (PX4-1.10.1) I used.

The firmware what I used is PX4 (-version 1.10.1). And the GCS is Qground. So when I run the t265_to_mavlink.py in my Nano ,the QGC can not received the data correctly, it gives the warning:
[pm] unknown param ID,
and the nano still feedback with
Link timeout, no heartbeat in last 5 seconds
Snipaste_2020-04-30_12-33-01

Do you think are there any extral setings within the t265_to_mavlink.py if I use the PX4 firmware and QGC?
Thanks very much!:slight_smile:

@Andrew5c since you are working with PX4, I would suggest the following:

  1. Establish a working connection test between Dronekit and PX4 according to the PX4 wiki: https://dev.px4.io/v1.9.0/en/robotics/dronekit.html
  2. Modify the vehicle_connect function in the script according to the connection test. Specifically, change the connection params: source_id and other params.
  3. Disable sending MAVLink message for confidence level update since the message is not supported by PX4: set the param to False.
  4. Follow the PX4 wiki page to use VIO data: https://dev.px4.io/v1.9.0/en/advanced/computer_vision.html

There are more to do than just these steps, but the PX4 wikis and forums should be your main references.

Hi, @LuckyBird, Thank you very much and Thank you for your sincere advice.
I test the adipilot firmware just now, and your script t265_to_mavlink.py works very good.
So I think my problem is that the parameters of px4 are not set correctly, I will follow your advice to learn that!
Best wishes.

1 Like

I think you can post questions on this repo: https://github.com/Auterion/VIO for suggestions. It seems to work out of the box for PX4-T265, but you need to learn ROS.

Yes, thanks, got it, that is a great project.
But I am not familiar with ROS for the moment , and I want to reproduce @ppoirier 's scheme. He realize the combine of T265 and Nano without ROS. (but the firmware he used is ArduPilot) .
I think this scheme (without ROS) is simply relatively.
Do yo think it is possible if I use px4 firmware but without ROS to realize the same functions? :smiley:

Hello, unfortunately this is ArduPilot forum , so as @LuckyBird wrote you will have to check on PX4 …or upload ArduPilot on your flight controller and join our community :slight_smile:

Hi, @LuckyBird, many thanks to your advice, now I change to the Ardupilot firmware in my pixhawk.
And I run your script in my Nano to get the data from T265 to get rid of the GPS.
Everything is ok until the warning Bad Gyro Health (just like the picture shown below)
bad

I have set the parameter COMPASS_USE, COMPASS_USE2 and COMPASS_USE3 in Ardupilot to 0, so I think the gyro data is coming from T265, is that means the data from T265 is bad?
and sometimes the logo of quadrotor in the map of MP will be disappear, just show it for a moment.
Can you give me a little more advices?
Thanks in advance!

@Andrew5c the data coming from the T265 to ArduPilot contains positions and angles data (with default settings in the script). The error with gyro most likely comes from the onboard IMU, and there are lots of related discussion on the forum.

As a quick check, you should verify that this error does not occur in normal flight with the same parameters (no T265, no script running, just fly in alt-hold and loiter mode with the same maneuver).

I would suggest that you read and follow the Wiki page about logging: https://ardupilot.org/copter/docs/common-logs.html, as it might be the best tool to troubleshoot your system in the future.

OK, thank you very much, I will read it and give a check on my quad.
Thanks again.

Hi, @LuckyBird, many thanks to your excellent work, now I can realize the quadrotor hover use T265 and without GPS.
But here is a question: I want to plot the position infor of my quadrotor in MP use the fly log, and I don’t know which parameter I should choose. Is that parameter in the picture below?

And another question is that , In the outdoor, if I let the quadrotor do large movements,the quad drift more serious. Is that mean I should adjust the parameter of EKF in MP?

Hope for your reply! Thanks in advance.

The VISP (and VISO) data are the input from T265. You should plot the LOCAL_POSITION_NED for the final position output from the EKF.

That might depend on both control (PID) params and positioning (EKF) params, or even something else. I can only say you need to do trial and error with params to see which part (control or position) would produce your desired result.

OK, got it. Thanks for your patient.
I will have a try and adjust my params.

Thanks again for your patient, @LuckyBird and anthor question :smiley:
After visual positioning of the drone, now I want to send the desired position data to the quadrotor directly, and wait until the quadrotor arrived that position. Then how can I plot the desired position curve and the actual position curve of the my drone?
Can you give me a general procedure? for example , which parameter can I choose to plot the desired position curve?
Thanks very much :slight_smile:

The MAVLink command message you should be sending is SET_POSITION_TARGET_LOCAL_NED. So you can plot this message along with POSITION_TARGET_LOCAL_NED or LOCAL_POSITION_NED for the vehicle’s actual position.
(Note: POSITION_TARGET_LOCAL_NED will return the vehicle’s current position https://github.com/ArduPilot/ardupilot/issues/13932)

OK, got it.
THANKS very much! You reallly help me a lot.
Thank you for making this community a better place.