I don’t know if it’s any different with ROS2, but I use ROS and mavros. When you want to switch to offboard mode you have to stream 100 setpoints before switching to offboard. Quote from the docs:
Before entering Offboard mode, you must have already started streaming setpoints. Otherwise the mode switch will be rejected. Here,
100
was chosen as an arbitrary amount.