# Enable Offboard Mode in PX4

## Step 1: Download Firmware

Clone this GitHub repository:

{% embed url="<https://github.com/PX4/Firmware>" %}

## Step 2: Tweak code

In the file `Firmware/src/modules/mc_pos_control_main.cpp`add the following lines:

```c
//call for function
void manual_control(float dt);

//function 
void MulticopterPositionControl::follow_aruco_control(float dt)
{
        _att_sp.pitch_body =- _manual.x * _params.man_tilt_max;
	_att_sp.roll_body = _manual.y * _params.man_tilt_max;
      	matrix::Quatf q_sp = matrix::Eulerf(_att_sp.roll_body, _att_sp.pitch_body, _att_sp.yaw_body);
        q_sp.copyTo(_att_sp.q_d);
         _att_sp.q_d_valid = true;
}

//if offboard enabled take manual control
if (_control_mode.flag_control_offboard_enabled)
{
	manual_control(dt);
}
```

{% hint style="success" %}
Offboard control successfully enabled.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.ariitk.in/wiki/tutorials/miscellaneous/simulation-using-offboard-control/enable-offboard-mode-in-px4.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
