# Developing forward facing optical flow in sitl

**URL:** <https://discuss.px4.io/t/developing-forward-facing-optical-flow-in-sitl/6850>\
**Category:** Uncategorized\
**Created:** [June 9, 2018, 10:57pm UTC](https://discuss.px4.io/t/developing-forward-facing-optical-flow-in-sitl/6850 "2018-06-09T22:57:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![weebadbad](https://discuss.px4.io/letter_avatar_proxy/v4/letter/w/8797f3/32.png) [@weebadbad](https://discuss.px4.io/u/weebadbad)\
**Post date:** [June 9, 2018, 10:57pm UTC](https://discuss.px4.io/t/developing-forward-facing-optical-flow-in-sitl/6850/1 "2018-06-09T22:57:43Z")

</div>

Hi all, I would like to develop a simulation in px4 using optical flow sensor which is facing forward in order to do some tracking of front images of the UAV. However, when I rotate the camera to face forward, px4 is not able to takeoff.

When I use the command: commander takeoff, it shows the error:  
error message: WARN [commander] rejecting takeoff, no position lock yet. Please retry…

---

<div class="post-metadata">

**Author:** ![artifactz](https://discuss.px4.io/user_avatar/discuss.px4.io/artifactz/32/3522_2.png) [@artifactz](https://discuss.px4.io/u/artifactz)\
**Post date:** [June 12, 2018, 1:56pm UTC](https://discuss.px4.io/t/developing-forward-facing-optical-flow-in-sitl/6850/2 "2018-06-12T13:56:36Z")

</div>

Hi,

maybe someone can answer your question if you clarify:

- which simulation you use
- what kind of optical flow you use

Usually, optical flow is acquired from a downwards-facing camera for numerous reasons like approximate ground flatness.  
If you want to use a SLAM/odometry-like localization, you could look into [https://dev.px4.io/en/ros/external\_position\_estimation.html](https://dev.px4.io/en/ros/external_position_estimation.html)

Good luck!

---

<div class="post-metadata">

**Author:** ![weebadbad](https://discuss.px4.io/letter_avatar_proxy/v4/letter/w/8797f3/32.png) [@weebadbad](https://discuss.px4.io/u/weebadbad)\
**Post date:** [June 12, 2018, 10:10pm UTC](https://discuss.px4.io/t/developing-forward-facing-optical-flow-in-sitl/6850/3 "2018-06-12T22:10:08Z")

</div>

Hi! Thanks for the reply!

I was using posix gazebo iris\_opt\_flow model for simulation.  
The optical flow I was using was lidar and px4flow camera, available in px4 database.
