# Velocity setpoints generation for mission mode

**URL:** <https://discuss.px4.io/t/velocity-setpoints-generation-for-mission-mode/21952>\
**Category:** PX4 Autopilot\
**Created:** [April 16, 2021, 2:18am UTC](https://discuss.px4.io/t/velocity-setpoints-generation-for-mission-mode/21952 "2021-04-16T02:18:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eldewany](https://discuss.px4.io/user_avatar/discuss.px4.io/eldewany/32/8457_2.png) [@eldewany](https://discuss.px4.io/u/eldewany)\
**Post date:** [April 16, 2021, 2:18am UTC](https://discuss.px4.io/t/velocity-setpoints-generation-for-mission-mode/21952/1 "2021-04-16T02:18:20Z")

</div>

Hello, i would like to know how and where in the flight code is the velocity setpoints are generated from the given position setpoints to be fed later into the position controller.

---

<div class="post-metadata">

**Author:** ![bresch](https://discuss.px4.io/user_avatar/discuss.px4.io/bresch/32/2343_2.png) [@bresch](https://discuss.px4.io/u/bresch)\
**Post date:** [April 20, 2021, 8:05am UTC](https://discuss.px4.io/t/velocity-setpoints-generation-for-mission-mode/21952/2 "2021-04-20T08:05:13Z")

</div>

Hi @eldewany ,

The high-level logic is here:

- Get waypoints in global position from the mission plan and convert to local frame + checks: [PX4-Autopilot/FlightTaskAuto.cpp at 3d8a35288e2c663a53caa8cae9281eb9927d87de · PX4/PX4-Autopilot · GitHub](https://github.com/PX4/PX4-Autopilot/blob/3d8a35288e2c663a53caa8cae9281eb9927d87de/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp#L126)
- Computes the required speed to reach the next waypoint (switches from L1-stlye turns to straight line): [PX4-Autopilot/FlightTaskAutoLineSmoothVel.cpp at 3d8a35288e2c663a53caa8cae9281eb9927d87de · PX4/PX4-Autopilot · GitHub](https://github.com/PX4/PX4-Autopilot/blob/3d8a35288e2c663a53caa8cae9281eb9927d87de/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.cpp#L321-L353)

Then the trajectory generator class used before is defined here: [PX4-Autopilot/src/lib/motion\_planning at master · PX4/PX4-Autopilot · GitHub](https://github.com/PX4/PX4-Autopilot/tree/master/src/lib/motion_planning)

Some documentation can be found here:  
[https://docs.px4.io/master/en/flight\_modes/mission.html#rounded-turns-inter-waypoint-trajectory](https://docs.px4.io/master/en/flight_modes/mission.html#rounded-turns-inter-waypoint-trajectory)  
[https://docs.px4.io/master/en/config\_mc/mc\_jerk\_limited\_type\_trajectory.html#jerk-limited-type-trajectory-for-multicopters](https://docs.px4.io/master/en/config_mc/mc_jerk_limited_type_trajectory.html#jerk-limited-type-trajectory-for-multicopters)

---

<div class="post-metadata">

**Author:** ![eldewany](https://discuss.px4.io/user_avatar/discuss.px4.io/eldewany/32/8457_2.png) [@eldewany](https://discuss.px4.io/u/eldewany)\
**Post date:** [April 21, 2021, 4:56am UTC](https://discuss.px4.io/t/velocity-setpoints-generation-for-mission-mode/21952/3 "2021-04-21T04:56:35Z")

</div>

Thanks for your reply, this is exactly what i was looking for.
