Hi, I am currently using Gazebo to test out some algorithms with ROS2, and to spawn the vehicle I am using the command
PX4_GZ_MODEL_POSE="0,0,0,0,0,0" make px4_sitl gz_x500
I noticed that the spawned vehicle’s odometry (from /fmu/out/vehicle_odometry) is off by almost 20cm on every axis (it oscillates between 0 and 40 cm) and that the drone starts with a 90-degree rotation around the z-axis, always according to the odometry.
Is there a way to initialize the odometry to 0 on every field by setting some parameters? My current idea is to publish an “initial position” onto the visual odometry topic to set it to 0 at the start of the simulation.
Hi @biagio PX4_GZ_MODEL_POSE sets the model pose with Gazebo convention (ENU/FLU). Therefore when you set yaw=0 and you align the Gazebo x axis with the drone x axis, in the PX4 convention (NED, FRD) you obtain the 90° rotation.
The odometry is computed from the perturbed measurements of the simulated GPS, this is why you don’t have perfect measurements. You can check the true pose inspecting the Gazebo topics.
You can use the gz_x500_vision model, which uses the gazebo odometry plugin, to have perfect data. Look at the differences w.r.t. the standard gz_x500 in terms of model file and airframe (default parameters).