Error in local positioning of Pixhawk4 using ViCON data

Hello @JulianOes @TSC21 @nikhilprakash99 @mhkabir,

I went to another lab equipped with VICON cameras and tested the localization over there and interestingly everything worked perfectly including offboard control. I used the same Pixhawk, same FTDI cable, same onboard computer and same c++ code to stream the data to the pixhawk. The only difference was local network and VICON system.

Firstly, I wanted to test the network, for that, I returned to my lab and used a wired connection between the onboard computer and VICON computer to stream the position data. The issue of resetting to 0,0 was reproduced again within a minute which means that it is not the network.

Secondly, I then tested the VICON data (each 100 data points in every second) and it was a perfect data stream recorded on on-board computer. So it’s not the issue with VICON system as well!

I guess we are only left with internal sensors inside the Pixhawk which is making the EKF to diverge. But the same sensors with same parameters works well in other lab. Can it be a possibility that we have some magnetic or some other interference in our room?

@JulianOes @TSC21 Can you please point me to the piece of code where I can overwrite the x,y,z positions coming from the EKF with VICON data? I guess this should be a quick fix to this issue? I don’t know why is it listening to internal sensors more. I don’t know if there is a way to reduce their impact in EKF output.

Please help!

Regards,
Kashish Dhal

To anyone reading this thread, I was able to localize the PX4 by running the VICON data streaming node to Onboard computer which earlier I was running Ground Station.

With this being said, I was able to localize the PX4 in the other lab even when my VICON data streaming node was sitting on Ground Station. I don’t really know, what difference does that make but it worked in my case.

If in case, the reader wants to know why this is happening please feel free to reach out to the developers. Although, I did not have a luck with them but you might! Good luck!

Hello @kashishdhal

I’ve met the same issue, that Position control based on OptiTrack data streaming failed in 1 min. If you have any update, plz let me know thanks a lot. I can also do some tests here. As you’ve mentioned, you go to another lab to test the code. Do the two labs use same WiFi route?

Hi, @kashishdhal

I have just used a method that may solve the issue. I’ve noticed that the uORB msg vehicle_visual_odometry has shown that the sampled time has large delay for the message. In my system, alle devices are offline, there is no chance to set all device synchronized. Therefore, there are large time differences between each device (may over 300 ms). In my case I subscribe the /vrpn topic on the raspberry and re-publish the topic (with another name) for the mavros with the current timestamp (of course, remap required for mavros with new topic name). In my last test, the quadrotor can fly at least double longer than before.

So, I wonder if another lab you’ve mentioned may have internet connection for all devices? If so, I can confirm that the time is the issue of local position problem, since you’ve used same hardware/software for the test.

Hello @tomcattigerkkk ,

You are correct, other lab has internet, however, my lab does not. Other thing is you need to run the ROS Master on-board because there are packet losses over the wifi network. In case of packet losses, you can still publish the old position value which can only be done when ROS Master is sitting on-board.

Also, EKF in PX4 is poorly designed, it tends to diverge during packet losses and other issues. So you need to make sure you are feeding in data all the time. I hope it helps!

@kashishdhal @TSC21 @JulianOes @nikhilprakash99 hello! I have some problem about this, can you help me in this issue ?