Flying indoor with optitrack

I think creation of rigid body does not require, battery for the drone.

Hello @abdullahmohiuddin

I already managed to send the mocap data correctly to pixhawk. My drone gets the desired height (x = 0, y = 0 and z = 0.3 m)

video test: https://youtu.be/bCe2heEmP64

Thanks!

1 Like

That is great, I saw your video, how did you figure the problem, and why are you using tethered drone.

Hello! @abdullahmohiuddin

I am using tethered drone because I don’t have a raspberry, odroid or wifi module, I am sending mocap data of a ubuntu pc to pixhawk with usb cable.

My ubuntu pc has installed vrpn and mavros. I am using xbee usb adapter board (USB to TTL).

Hello @Mario1577

I’m working to get a very similar setup working except with the f450 instead of the 3dr iris. Do you happen to have any suggestions or sample launch files that you used to get this working?

Thanks,
Ken

Hello @k-chaney

What kind of suggetions Do you need?

HI @Mario1577 and @abdullahmohiuddin,
I am doing the same project what you did recently.
I am using crazyflie 2.0 and Optitrack and vrpn_client_node.
Also, I am using two computer to stream optitrack data from window pc to ubuntu pc via vrpn.

I followed all you mentioned…in not only in this page, but also other resources…
Crazyflie is using radio signal to communicate with ubuntu PC, so I cannot see any data of /mavros/local_position/pose…(but, I can see its data when I use USB connection.)
So I tried to relay optitrack data to /mavros/local_position/pose… also I did relay optitrack data to /mavros/mocap/pose, but I did see any successful flight… it failed…

I have some question.
Please answer if you are available.

1. Frames
When I calibrate and set ground with OptiTrack system, the ground plane has two axis; x-axis & z-axis.
So y-axis is for vertical direction.
Then does y-axis of OptiTrack turn to z-axis of ENU frames in MAVROS automatically when we use vrpn_client_node/?
That is the reason why we use “z=0.5” in offboard example code?

2.
How did you get the result of this video (https://youtu.be/bCe2heEmP64)?
What was the major changes to get the result of the above video?
My situation is exactly the same with yours as like in this video (https://youtu.be/XBbBbEaNlrc), but I do not understand when you said

as the answer for the abdullah’s question; [quote=“abdullahmohiuddin, post:23, topic:3782”]
how did you figure the problem
[/quote]

Could you please explain more about it?

Please help me to resolve these issues…

Thank you.

Hello! @netkimjh

Yes, Mavros have a plugin (mocap_pose_estimate). the plugin transforms the ENU (Optitrack) to NED (PX4) coordinates, therefore, when you make a trajectory you must use the z axis.

I solved my trouble doing the follow:

  • I changed the 1.6.3 to 1.6.5 PX4 Version ( the 1.6.3 version was not working)
  • I changed a parameter of Motive Sofware (DataStreaming Pane): Y up to Z up.

Regards!!

Thank you for your kind reply @Mario1577!

I have questions about data of “/mavros/local_position/pose”
I tried to check it with USB connection (not under the Optitrack, because my cable is short…) and wireless connection.

With USB connection, it showed the weird values…

In addition, with wireless connection, it did not show any message at all.
Do you have any idea to resolve this issue?
Do you think this data (/mavros/local_position/pose) is important to control quadrotors?

Actually, I relayed OptiTrack data to the /mavros/local_position/pose. But the quadrotor flew as like your first video…

Thank you!

Thank you.

Hello @netkimjh

What kind of wireless connection Do you use?

Yes, it is important to control quadrotors, you have to make sure that vrpn_client_node/tracker name/pose, mavros/mocap/pose and /mavros/local_position/pose topics have the same values.

you don’t have to send optitrack data to /mavros/local_position/pose, you have to send optitrack data to /mavros/mocap/pose topic.

Hi @Mario1577,

I am using Crazyflie 2, and CrazyRadio PA to communicate with PC and CF2.
(https://www.bitcraze.io/crazyradio-pa/)

Since I cannot see any data when I use wireless communication, not USB connection, I am relaying OptiTrack data to not only /mavros/mocap/pose, also /mavros/local_position/pose.

How do you think about relaying OptiTrack data to both topics?

One more question is that is “pose.pose.orientation.w = 1” correct in the offboard code?

I am testing now… I will show some results soon.

Thank you.

P.S. Thanks for giving me a tip about “UP Axis” option. After switching this option, the quadrotor is flying upward!!

Hello @netkimjh

Maybe you cannot see any data because CrazyRadio PA does not have enough baudrate, if you are sending optitrack data you have to have a baudrate of 921600. Actually I have a companion computer (Raspberry pi3) on my 3dr iris.

My windows pc with Motive Software is sending optitrack data to raspberry using wifi, the raspberry is connected to TELEM2 port of pixhawk using serial with 921600 baudrate.

The orientation.w is the real part of the quaternion The orientation is parameterized as a quaternion hence w, x, y, z

Why are you relaying to /mavros/local_position/pose?

Regards!!

Hi @Mario1577,
First, I would like to thank you for your instruction. I have followed all the steps and have my drone taken off nicely.
However, there is a remaining issue. Although I send NED of 0.0, 0.0, 0.5, my drone does not hover as stable as in your clip but goes back and forth, up and down in an area of about 1x1x1 meter. Do you have any suggestion to fix it?

Hi @Mario1577 and @Duy_Vu,
I followed the same procedure as you. I remapped the vrpn message to /mavros/mocap/pose , an tried to match it with /mavros/local_position/pose . But, my problem is that when I echo local_position topic, my x=0, y=0, and z changes between 0.3 to 1.1! Actually my pc is connected to pixhawk by usb and I just run the px4.launch os stable hexacopter (pixhawk4) without any position controller! Could you help me when and how can I see the published data on mavros/Local_position topic?