# Achieving FW offboard control via ROS2

**URL:** <https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523>\
**Category:** ROS 1 / ROS 2\
**Created:** [July 29, 2021, 11:01am UTC](https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523 "2021-07-29T11:01:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan-Hendrik\_Ewers](https://discuss.px4.io/user_avatar/discuss.px4.io/jan-hendrik_ewers/32/5004_2.png) [@Jan-Hendrik\_Ewers](https://discuss.px4.io/u/Jan-Hendrik_Ewers)\
**Post date:** [July 29, 2021, 11:01am UTC](https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523/1 "2021-07-29T11:01:48Z")

</div>

Does anyone have a offboard control example for a fixed-wing drone? All I can really find is this [Offboard Mode | PX4 User Guide](https://docs.px4.io/master/en/flight_modes/offboard.html#fixed-wing) but all those messages (id 82, 84, 87) are unlisted in [VehicleCommand.msg](https://github.com/PX4/PX4-Autopilot/blob/master/msg/vehicle_command.msg). Is it possible to send raw mavlink messages via ROS2?

---

<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:** [July 29, 2021, 11:34am UTC](https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523/2 "2021-07-29T11:34:26Z")

</div>

@Jan-Hendrik_Ewers Offboard control does not work with `VehicleCommand` or `MAV_CMD_` mavlink messages, therefore I am not sure what you are looking for.

If you send mavlink setpoints, they will work with fixedwing as documented in the userguide.

---

<div class="post-metadata">

**Author:** ![Jan-Hendrik\_Ewers](https://discuss.px4.io/user_avatar/discuss.px4.io/jan-hendrik_ewers/32/5004_2.png) [@Jan-Hendrik\_Ewers](https://discuss.px4.io/u/Jan-Hendrik_Ewers)\
**Post date:** [July 29, 2021, 12:18pm UTC](https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523/3 "2021-07-29T12:18:38Z")

</div>

@Jaeyoung-Lim maybe offboard control is the wrong term. I’m just looking for any examples of FW being controlled via ROS2.

So the setpoints like “AttitudeSetpoint\_PubSubTopic”, “PositionSetpoint\_PubSubTopic”, etc.?

Could you point me towards that section of the userguide? I must have missed it.

---

<div class="post-metadata">

**Author:** ![Jan-Hendrik\_Ewers](https://discuss.px4.io/user_avatar/discuss.px4.io/jan-hendrik_ewers/32/5004_2.png) [@Jan-Hendrik\_Ewers](https://discuss.px4.io/u/Jan-Hendrik_Ewers)\
**Post date:** [July 29, 2021, 1:08pm UTC](https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523/4 "2021-07-29T13:08:41Z")

</div>

@Jaeyoung-Lim was right, using the setpoints worked well. I am currently testing the `VehicleAttitudeSetpoint_PubSubTopic` with `roll_body = math.sin(time.time()/4)*0.05` and it’s giving very nice responses.

 ![image](https://discuss.px4.io/uploads/default/original/2X/6/60b8f312ea7b8e1c79a70a6594565581ad387861.png)

Should I upload the code as an example somewhere?

---

<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:** [July 29, 2021, 3:10pm UTC](https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523/5 "2021-07-29T15:10:05Z")

</div>

@Jan-Hendrik_Ewers Great! Adding it to the user guide would be definitely cool 🙂[GitHub - PX4/PX4-user\_guide: PX4 User Guide](https://github.com/PX4/PX4-user_guide)

---

<div class="post-metadata">

**Author:** ![Jan-Hendrik\_Ewers](https://discuss.px4.io/user_avatar/discuss.px4.io/jan-hendrik_ewers/32/5004_2.png) [@Jan-Hendrik\_Ewers](https://discuss.px4.io/u/Jan-Hendrik_Ewers)\
**Post date:** [August 4, 2021, 10:44am UTC](https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523/6 "2021-08-04T10:44:50Z")

</div>

Hi @Jaeyoung-Lim, upon further testing it seems like I can control the FW `plane` using the `/VehicleAttitudeSetpoint_PubSubTopic` but not via `/VehicleLocalPositionSetpoint_PubSubTopic`.

From the px4 architecture it looks like these two feed into different controllers

 ![image](https://discuss.px4.io/uploads/default/original/2X/7/7fb9a1a301064209baf2811f92b35d85b56010e6.png)

Is there a block within `fw_pos_control_l1`?

I’m seeing the values that i’m sending within PXH but the SITL is not responding to this command.

```auto
pxh> listener vehicle_local_position_setpoint

TOPIC: vehicle_local_position_setpoint
 vehicle_local_position_setpoint_s
        timestamp: 205431999 (0.128001 seconds ago)
        x: 0.0000
        y: 0.0000
        z: 0.0000
        yaw: -3.1400
        yawspeed: 0.0000
        vx: 0.0000
        vy: 0.0000
        vz: 0.0000
        acceleration: [0.0000, 0.0000, 0.0000]
        jerk: [0.0000, 0.0000, 0.0000]
        thrust: [0.0000, 0.0000, 0.0000]

```

---

<div class="post-metadata">

**Author:** ![elech](https://discuss.px4.io/letter_avatar_proxy/v4/letter/e/b2d939/32.png) [@elech](https://discuss.px4.io/u/elech)\
**Post date:** [November 3, 2023, 7:46am UTC](https://discuss.px4.io/t/achieving-fw-offboard-control-via-ros2/23523/7 "2023-11-03T07:46:34Z")

</div>

Hi，have you found the way to control the fixed wing via ROS2? This problem make me confused.
