# Mavros/ local\_position/pose Initialize?

**URL:** <https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803>\
**Category:** Pixhawk\
**Created:** [September 13, 2018, 2:14pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803 "2018-09-13T14:14:31Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hinmo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/h/9de053/32.png) [@Hinmo](https://discuss.px4.io/u/Hinmo)\
**Post date:** [September 13, 2018, 2:14pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/1 "2018-09-13T14:14:31Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [September 15, 2018, 8:21pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/2 "2018-09-15T20:21:11Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Hinmo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/h/9de053/32.png) [@Hinmo](https://discuss.px4.io/u/Hinmo)\
**Post date:** [September 16, 2018, 8:57am UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/3 "2018-09-16T08:57:57Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [September 16, 2018, 11:19am UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/4 "2018-09-16T11:19:58Z")

</div>

@Hinmo Thank you for the nice words,

> [@Hinmo](#):
>
> 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…

- Can you clarify the flow part? Do you have a optical flow onboard?

> [@Hinmo](#):
>
> 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.

- 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.

---

<div class="post-metadata">

**Author:** ![Hinmo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/h/9de053/32.png) [@Hinmo](https://discuss.px4.io/u/Hinmo)\
**Post date:** [September 16, 2018, 1:12pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/5 "2018-09-16T13:12:18Z")

</div>

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

> [@Jaeyoung-Lim](#):
>
> Can you clarify the flow part? Do you have a optical flow onboard?

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

> [@Jaeyoung-Lim](#):
>
> 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.

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 : )

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [September 16, 2018, 3:13pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/6 "2018-09-16T15:13:17Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Hinmo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/h/9de053/32.png) [@Hinmo](https://discuss.px4.io/u/Hinmo)\
**Post date:** [September 17, 2018, 2:15pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/7 "2018-09-17T14:15:52Z")

</div>

@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.  
[/quote]  
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.

> [@Jaeyoung-Lim](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [September 17, 2018, 3:02pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/8 "2018-09-17T15:02:56Z")

</div>

@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](https://404warehouse.net/2016/08/10/trajectory-following-with-mavros-on-raspberry-pi/) or a VICON motion capture system for [indoor flight](https://404warehouse.net/2015/12/20/autopilot-offboard-control-using-mavros-package-on-ros/)

---

<div class="post-metadata">

**Author:** ![Hinmo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/h/9de053/32.png) [@Hinmo](https://discuss.px4.io/u/Hinmo)\
**Post date:** [September 18, 2018, 6:41pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/9 "2018-09-18T18:41:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hinmo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/h/9de053/32.png) [@Hinmo](https://discuss.px4.io/u/Hinmo)\
**Post date:** [October 7, 2018, 7:41am UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/10 "2018-10-07T07:41:48Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [October 7, 2018, 12:16pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/11 "2018-10-07T12:16:53Z")

</div>

@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](https://github.com/ethz-asl/rovio), [SVO](https://github.com/uzh-rpg/rpg_svo), [ORB SAM](http://webdiis.unizar.es/~raulmur/orbslam/).

EKF2 on PX4 [supports external vision estimation](https://www.youtube.com/watch?v=VqZkAWSl_U0) to utilize the estimates provided from the visual odometry of such systems.

---

<div class="post-metadata">

**Author:** ![Hinmo](https://discuss.px4.io/letter_avatar_proxy/v4/letter/h/9de053/32.png) [@Hinmo](https://discuss.px4.io/u/Hinmo)\
**Post date:** [October 7, 2018, 2:42pm UTC](https://discuss.px4.io/t/mavros-local-position-pose-initialize/7803/12 "2018-10-07T14:42:21Z")

</div>

@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 ; \_ ;
