How to do vtol transition in offboard mode with ros2

Hello I need to use vtol transition in my offboard script but I dont know how to do a vtol transition in offboard script for ros2. I read about a discussion about it but it was old and for mavros. They suggested to write a ros service. Is there an easy way? Thank you…

I successfully change the mode to FW through px4_msgs::msg::VehicleCommand msg in ROS 2 by uXRCE-DDS way.

But I dont know how to achieve path setpoint control?

this->Pub_Vehicle_Command(px4_msgs::msg::VehicleCommand::VEHICLE_CMD_DO_VTOL_TRANSITION, 4);
        void Pub_Vehicle_Command(uint16_t command, float param1 = 0.0, float param2 = 0.0) {
            px4_msgs::msg::VehicleCommand msg{};
            msg.param1           = param1;
            msg.param2           = param2;
            msg.command          = command;
            msg.target_system    = 1;
            msg.target_component = 1;
            msg.source_system    = 1;
            msg.source_component = 1;
            msg.from_external    = true;
            msg.timestamp        = this->get_clock()->now().nanoseconds() / 1000;
            rcl_obj.pub_px4_vehicle_command->publish(msg);
        }

I am also facing an issue while transitioning. takeoff the drone from qgc while it is hovering, give the following command from terminal

 ros2 topic pub --once /fmu/in/vehicle_command px4_msgs/msg/VehicleCommand "{
  timestamp: $(($(date +%s%N)/1000)),
  command: 3000,
  param1: 1.0,
  target_system: 1,
  target_component: 1,
  source_system: 1,
  source_component: 1,
  from_external: false,
  confirmation: 0
}"
publisher: beginning loop
publishing #1: px4_msgs.msg.VehicleCommand(timestamp=1772956901557620, param1=1.0, param2=0.0, param3=0.0, param4=0.0, param5=0.0, param6=0.0, param7=0.0, command=3000, target_system=1, target_component=1, source_system=1, source_component=1, confirmation=0, from_external=False)

on another terminal echo ros2 topic echo /fmu/out/vehicle_command_ack

ros2 topic echo /fmu/out/vehicle_command_ack
timestamp: 1772957149520758
command: 3000
result: 0
result_param1: 0
result_param2: 0
target_system: 1
target_component: 1
from_external: false

But nothing happened. I try to shift to FW from qgc it is working fine

successfully done the transition from terminal by following command

#MC To FW
ros2 topic pub --once /fmu/in/vehicle_command px4_msgs/msg/VehicleCommand "{timestamp: 0, param1: 4.0, param2: 0.0, command: 3000, target_system: 1, target_component: 1, source_system: 1, source_component: 1, from_external: true}" # MC To FW
#FW to MC
ros2 topic pub --once /fmu/in/vehicle_command px4_msgs/msg/VehicleCommand "{timestamp: 0, param1: 3.0, param2: 0.0, command: 3000, target_system: 1, target_component: 1, source_system: 1, source_component: 1, from_external: true}" #  FW to MC