Please help me with Ros2 based autonomous flight commands or how to do automatic flight in Gazebo

Thank you for the help I received from you while playing rosflight. The problems that arose before have been resolved to some extent. I’m trying to try automatic flight in Gajebosang, but I searched for information and tried several times, but I failed, so I’m asking for help. The data I saw was based on Ros1. I’m missing something or missing something, but can you tell me specifically how to do autonomous flight based on Ros2? The command I used is ros2 topic pub -r 10 /command rosflight_msg/Command ‘{header: {stamp: now, frame_id: base_line}, mode: 2, ignore: 0, x: 1.0, y: 1.0, z: 0.0, f :-2.0}’
I tried approaching it this way, but nothing happened inside Gazebo.

To perform autonomous flight, you need to use an autonomy stack on top of ROSflight like ROSplane or ROScopter. You then control ROSflight by publishing messages on the /command topic, as described here:

F should be a value between 0 and 1, so a value of -2 wouldn’t work. Also, in order for ROSflight to accept command input, you need to be in offboard mode which is usually enabled/disabled with a switch on the RC controller.

I wouldn’t recommend directly passing commands to ROSflight using the CLI, as that isn’t how ROSflight is intended to be used and if the /command topic isn’t constantly publishing new messages then ROSflight will revert to RC control.