I’m using a ZED 2i to send VIO data to the Pixhawk Cube Orange, I am successfully sending it in the ENU frame to /mavros/vision_pose/pose_cov, with manual static covariances set, which the Cube is receiving and I can see this in QGroundcontrol when I go to the MAVLink console and type “listener vehicle_visual_odometry”, which I can confirm, MAVROS transforms this into the NED frame, from bench tests of moving the drone in each direction etc to confirm movements.
My problem is that the drone is not holding position when in flight in POSITION flight mode, does anyone have any suggestions as to why this might be?
odometry might be received, but then need to check if it’s actually used by the ECL.
next things to check would be, in uorb topics:
estimator_aid_src_ev_pos
listener estimator_status_flags (cs_ev_pos flag)
estimator_event_flags (reset_pos_to_vision)
estimator_innovation_test_ratios
estimator_innovations
might also check if
CONFIG_EKF2_EXTERNAL_VISION
is defined in the board config
Hi, thank you for your reply. I have checked each of these in the MAVLink console using listener before each. I tested before publishing the ROS code and then after.
As expected, when ROS is not initiated, listener vehicle_visual_odometry, estimator_aid_src_ev_pos are “never published”, within the rest, cs_ev_pos_flag is false, reset_pos_to_vision is false, and the rest have the positioning from ev set to 0.
When the ROS nodes are run, to publish the VIO data to the Pixhawk, listener vehicle_visual_odometry, estimator_aid_src_ev_pos publish data accordingly, cs_ev_pos_flag and reset_pos_to_vision are set to true, and the two remaining estimator_innovation/s have ev data present, see attached the link to the results copied for full set of data received: EV results.
For the CONFIG_EKF2_EXTERNAL_VISION do you mean the parameter set for the fimrware PX4 in QGC? Being EKF2_EV_CTRL? Which I have set to 9, so just for Horizontal position and yaw ticked.
If all this data is being published as it should be,what could be the issue? I’m not sure at this point how to troubleshoot it as I have been working endlessly as it and gotten nowhere.
Can you provide a log file? Would be the easiest way to quickly have a look and ask further questions.
Yes, I just did a quick bench test, here is a log file of going into POSITION mode using the VIO data: bench_test_log_file.
Is this enough or do you need one from in flight?
Here is another flight log from in flight a while back: in-flight log.
Also to note, I am not sending any vision velocity data, just the positioning and only using the horizontal position data on the PX4, setting the EKF2_EV_CTRL to use only horizontal positon and yaw, not vertical position and 3D velocity.
Have you had a chance to look at this yet?
Sorry, I forgot about it.
Can you create a log with SDLOG_PROFILE set to 3 (+EKF2) or 19 (+High rate). Then you also log topics which are really useful to debug potential estimation issues.
No worries. Yes, I have done, I performed a flight test inside with no props, just me lifting it, and holding POSITION and then performing an OFFBOARD flight mode mission I have coded to fly a square path (with yaws included) and then in POSITION mode again at the end, I held for sufficient time to hopefully give enough data.
I performed with the SDLOG_PROFILE set to 3 and 19:
Hopefully you can find the issue in these, thank you for your help.
Hi Marco, have you had a chance to look at my log files yet?
Have you looked at these log files yet?
Sorry.
How much drift are you talking about when hovering? In your handheld logs I can only see that the fusion seems to work just fine, but I can’t tell if the resulting estimation is correct since I dont know how you moved the drone…
It just seems to drift in any direction every time POSITION mode is selected, it’s always the same direction following startup, so following another startup, the drift direction could be different. I would say it drifts about a metre every 2 seconds.
Okay so the fusion then from ROS seems to be correct, but maybe the onboard estimations are not?
What could I provide you with in order to fix this problem?
The problem is that the drone is not recovering position when in POSITION mode, I have checked the flight controller with a GPS and it does recover when using that, but when GPS is disabled and relying on the VIO data then, yet it does go into POSITION flight mode, it does not correct position.
What could the issues be with this and how can I address them? If the C++ data is successfully published to the Pixhawk Cube, in the correct frames, and allows the drone to enter POSITION flight mode?
Since we did not hear about any other similar issues lately I can only expect that the VIO output of the external system is not correct and causing the drift. Are you sure the external estimation gives a correct output?
I have cross checked it through holding it manually, and guiding the drone around a room, even using setpoint_position/local commands to command the drone to fly in a 1m square, with two yaws included and where the next waypoint does not iterate until the subsequent waypoint is met.
I am publishing the data in the ENU frame to MAVROS, which then is transformed to the NED frame for use on the PX4, which I can confirm is correct when I view the MAVROS node that publishes to /mavros/local_position/pose and the /mavros/vision_pose/pose. I have viewed the change is X, Y, and Z when moving the drone accordingly and observed the correct movements where X is positive forward, Y is positive to the right, and Z is positive downwards, both on the MAVROS nodes and on QGroundControl, either through the Odometry or through the MAVLink console using “listener vehicle_visual_odometry”.
This is where I am confused where if everything seems to be in order with VIO publication and how it is acting onboard the drone through PX4 and accepcting the data seemingly, then why is there drift and no recovery of position from using it?
What else can I troubleshoot to see what the problem is as I am out of ideas with it following everything mentioned above.
Any advice on how I can proceed with this? I have been trying this for over a year now and no luck, so I feel like there is nothing more I can do without expert advice
Any advice on how I can proceed with this? I have been trying this for over a year now and no luck, so I feel like there is nothing more I can do without expert advice
Could it be a flag that is stopping the Pixhawk from fixing its position with the data in POSITION flight mode or a MAVROS node or something not being sent any data that is required in order for it to use it?