I said about the pixhawk port (TELEM2) because I read that many people have a companion computer on top of the drone, so they using wifi receive mocap data on the companion computer and with an usb2ttl connect the companion computer to the pixhawk using the telemetry port (TELEM2) with a baudrate of 921600.
I do not have a companion computer, I am sending the data optitrack mocap with a long USB cable to the pixhawk using the usb port of the pixhawk.
This is what I said , exactly. If you have a companion computer, that computer talks to px4 via MAVLINK.
MAVROS, is the software that connects ROS to MAVLINK. So, we need a package in the companion computer that can publish the optitrack data to the mavros topic so that it can be sent to the px4 via MAVLINK.
So if we use that package which is the mocap package, this package does the transformation for us. I think, in your case you will have to do it manually via optitrack software.
We are also working with the similar project (flying the drone indoor with Optitrack cameras).
We are using Intel Aero RTF drone (including an Intel Aero FC and a computation board) and 6 Optitrack cameras. Because we have no idea with ROS but only Dronekit. Is it possible for us to send the local position to the FCU via Mavlink message ATT_POS_MOCAP?
Thank you for your quick reply.
Have you successfully flown your drone indoor?
We are sending the ATT_POS_MOCAP message to our FCU and can get the local position by listening to the LOCAL_POSITION_NED message. The position from vision and drone match each other, but we have another problem with takeoff. Our procedure is:
set the drone to POSCTL mode
arm the motors
continuously send SET_POSITION_TARGET_LOCAL_NED message with type_mask = 0b0001111011000000, x = 0, y = 0, z = -0.5, vx = 0, vy = 0, vz = 0.1, coordinate_frame = MAV_FRAME_LOCAL_OFFSET_NED
4. on reaching the target altitude, we continuously send another NED message with type_mask = 0b0011111011111000, x = 0, y = 0, z = 0.
However, our drone still tries to jet to the higher altitude after reaching the target one. We have not figured out what wrong with it. Do you have any suggestion?
I still get the same results, my drone does not get the desired height (0.5m) and stay at that point with optitrack position data, before I sent the mocap data to the usb port of the pixhak but now I’m sending them to the TELEM2 port of the pixhaw But I still get the same results.
my pixhawk setup:
I am using LPE with companion computer (TELEM2) with 921600 baudrate
ATT_EXT_HDG_M = 2
am I missing something else?
Will the pixhawk be receiving the mocap data?
I am getting my mocap data with vrpn, but many people use the mocap_optitrack package, will it be the cause of my problem?
@abdullahmohiuddin Before creating the rigid body, when I align the arrow of the pixhawk to the axis x of the motive optitrack, the pixhawk has to be with the battery connected? orDo I first have to align the arrow of the pixhak with the x-axis optitrack then I create the rigid body and finally connect the battery of the drone?
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.
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?
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…
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?
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?