Im using hector slam with a lidar and remapping to /Mavros/vision_pose/pose. Then using the EKF2 to remap to /Mavros/local_position/pose.
I’m using a pixhawk 4 mini with latest firmware.
My problem is that on Mavros/local_position/pose I get some nice values for about 60 seconds or less then nothing published on that topic for a few seconds then when it starts again there’s a huge drift before jumping back to the right place.
Its frustrating since the localisation from hector slam is pretty good with the lidar. But I can’t just use the raw output from that since I need some altitude data.
I stumbled across this as when I try to set my quad In offboard mode it changes straight to auto.land mode which is an odd issue I’m not sure if that a problem with my python node but it works in simulation.
Any help would be massively appreciated
hi, I’m having problems using px4 and an external slam system (openvslam), may I ask you some details about how to remap the message and the general configuration?
So assuming you are using mavros and ROS you need to configure PX4 to expect vision.
I set EKF2_AID_MASK to 24 and EKF_HGT_MODE to “vision”
i then made a python node that subscribes to the pose output from SLAM and publishes it on ‘/mavros/vision_pose/pose’ at a rate of 30hz (using rospy rate)
If everything is set up properly you should then get localization data on ‘/mavros/local_position/pose’ which is then translated to UORB topics inside the PX4
I also send my setpoints by publishing on mavros topics
ok, so the assumptions are right. I did the same: getting the output topic from openvslam (which is closely related to orbslam) translated it into a PoseStamped message and then republished it to /mavros/vision_pose/pose (which accepts only PoseStamped, to use the original Odometry message from openvslam it would be different).
I’m going to try right now to publish at 30 Hz since the translation and republishing rate is subordintanaed to the activation of a callback, and now that I think about it openvslam publishes slower than 30 hz.
May I ask you to share the frame settings you have in px4_config.yaml for the imu section and the ones in the message from the slam you use?
Sorry mate i dont have access to the UAV or project laptop anymore as it was for a student project. I will try and track it down.
In the meantime i really didnt need to change much from the example config you get with mavros, What really got it working for me was publishing at the right rate (30hz). But for the local pose to publish you will also need your IMU configured correctly. For me this just involved sensor calibration in QGC.
Also ill say that ROS and PX4 use different coordinate bases so in that script you’ll also need to do some kind of translation. I think it was just swapping x and y and negating z but i am not 100% certain. That was the issue for my original post for anyone revisiting this.
that is my problem: I swapped as mentioned in the documentation without any good result. guess I’ll have to keep trying, thanks anyway