Mavros/ local_position/pose Initialize?


Hi guys. I’m quite new to pixhawk, mavros and ros…

But I had some question in GitHub or ros answer, so not quite new?

Anyway, I have a question about px4 & mavros data link.

In mavros, about topic /mavros/local_position/pose. It works fine

except for something.

The thing is, that I think when pixhawk starts, the local position of the starting point should be (0,0,0),

not 1.26e-32 something something.

So, is there anyway to initialize starting point coordination to (0,0,0)?

I hope there’s some way or comment :slight_smile:


@Hinmo Can you explain more on why exactly you want it to be exactly (0, 0, 0) and how it is blocking you?

1.26e-32 seems like reasonably closel to 0, given that it is a estimate.


@Jaeyoung-Lim Hi and thank you for reply.

I’ve already seen your 404warehouse blog, etc. I really enjoy it.

I tried your example code to offboard control my drone, but have problem:

First of all, my drone flows away from launching position. I don’t need exact (0,0,0),

but I think it could be the reason to flow, so…

And when launching, it constantly turns in yaw axis. literally.

Finally, though my control command is go to (0,0,1.5), my drone doesn’t fly to 1.5m high. It takes off nearly half of 1.5m.

All my mavros command is setting position setpoint to (0,0,0).

Again, thanks for your reply.


@Hinmo Thank you for the nice words,

  • Can you clarify the flow part? Do you have a optical flow onboard?
  • This might be related to the position estimation. What sensors are you using for the position estimation of the vehicle? The problem with the yaw turning might be that the vehilcle is not getting a good yaw estimate.

@Jaeyoung-Lim Hello again. Thanks for real fast reply.

No I don’t, “flow” part meant that my drone actually fly away from launching point. especially to x axis.

And for your this comment, I’ll say I’m using only pixhawk 1 internal sensors and latest stable PX4 firmware.

I hope this happened just by my mistake : )


@Hinmo First. for the position estimation to work, you need to have a good measurement from the sensor such as a GPS or a motion capture system. Using only the internal IMUs will not result in a accurate position estimate, which will result on the drone being unable to go to your setpoint.

For your Yaw problem depending on how you configured the airframe, the internal mangnetometers might be close to your wires which will make your yaw estimate be disturbed. If you use a external magnetometer(compass sensor) you will have a much more stable yaw estimate.


@Jaeyoung-Lim [quote=“Jaeyoung-Lim, post:6, topic:7803”]
First. for the position estimation to work, you need to have a good measurement from the sensor such as a GPS or a motion capture system. Using only the internal IMUs will not result in a accurate position estimate, which will result on the drone being unable to go to your setpoint.
So, I mean, did you use such sensors when you did your 404warehouse job?

Optical flow or something for indoor environment, GPS for outdoor?

If you did mean that internal IMU is not enough to hold position in offboard mode, I’ll try adding sensors.

And for this advice, I think there’s nearly no electrical wires around pixhawk,

so I’ll try with external compass sensor and check center of mass.

Really thanks, Mr.


@Hinmo I am not sure what article you are referring to, but both of my articles in the blog either use GPS for outdoor flight or a VICON motion capture system for indoor flight


We don’t have VICON system…

So I think I’ll give it a shot with alternatives like ultra sonic & Arduino.

Thanks for all of this


@Jaeyoung-Lim Hello, it’s me again. Sorry for double interrupting you.

After some research, we find sensor called PX4Flow(seems to be combination of optical flow & ultra sonic)

Here’s some extra question(again, WE ARE REALLY SORRY).

Can optical flow sensor help position fixing?

We neither use GPS because our experiment(and also performance) environment is indoor,

nor the VICON because the cost.

And another question : why the hell our pixhawk’s local position z value is parsing some weird value?? I think it must initialize it’s relative value to 0 when powered on, but no.

When we power up the pixhawk and start mavros node, local z position has different value all the time. Sometimes around -1, and other sometimes around 6, etc.

What do you think? Any of your idea can save me, actually.


@Hinmo Optical flows sensor meausre the “velocity” of the features observed from the camera. The imu on the Flight controller measures the “acceleration” of the vehicle.

This means having optical flow and the flight controller will not be enough to estimate the position of the vehicle. Having optical flow stabilizes your velocity in the environment where GPS is not available, but does not provide any position information.

If you want to estimate the position without costly motion capture systems or GPS, you will need some kind of method that provides feedback. This may include low cost systems using external beacons such as UWB beacons.

A more self-contianed approach is to use a visual estimation pipeline using a camera. You may need a companion computer for this as it requires more computation power than a pixhawk can handle. You can look at projects such as ROVIO, SVO, ORB SAM.

EKF2 on PX4 supports external vision estimation to utilize the estimates provided from the visual odometry of such systems.

1 Like

@Jaeyoung-Lim Wow you sure have a lot of experience in drone project…respectful.

First of all, I didn’t know what optical flow sensor(Ok, too long. Let’s say it OFS) is.

Only I heard was OFS can do sort of “motion capture”, so it helps drone positioning.

Maybe that isn’t exactly what it is.

Well, we already have companion computer(lattepanda) for additional application, vision based flight.

But since you tell me there’re some project that use PX4 with vision, I’ll look for it. Thank you.


P.S. What about z position problem? Do you have any idea? We try to add ADC sensor to pixhawk in PX4 firmware,

but it has no ADC settings. Just some specific sensors ; _ ;