Problem Switching to Offboard mode After Arming

Hello, I am struggling to switch to offboard after arming a real-world drone through a ROS_node script. However, the code works in the Gazebo simulation and I can also switch straight into offboard mode without arming so I am sure that the points are being received.

The error i get when switching to Offboard is :
[ WARN] [1577568026.571076614]: CMD: Unexpected command 176, result 0

PX4 LOG:
NODES
/
mavros (mavros/mavros_node)

auto-starting new master
process[master]: started with pid [9871]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to ae23efc6-29b7-11ea-8058-00044be6704f
WARNING: Package name “Drone” does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
WARNING: Package name “schoolThings” does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
process[rosout-1]: started with pid [9882]
started core service [/rosout]
process[mavros-2]: started with pid [9890]
[ INFO] [1577567950.983533636]: FCU URL: /dev/ttyACM0:57600
[ INFO] [1577567950.993841604]: serial0: device: /dev/ttyACM0 @ 57600 bps
[ INFO] [1577567950.996088252]: GCS bridge disabled
[ INFO] [1577567951.195053799]: Plugin 3dr_radio loaded
[ INFO] [1577567951.205287286]: Plugin 3dr_radio initialized
[ INFO] [1577567951.205849430]: Plugin actuator_control loaded
[ INFO] [1577567951.218821136]: Plugin actuator_control initialized
[ INFO] [1577567951.349121587]: Plugin adsb loaded
[ INFO] [1577567951.360487747]: Plugin adsb initialized
[ INFO] [1577567951.361059891]: Plugin altitude loaded
[ INFO] [1577567951.364989586]: Plugin altitude initialized
[ INFO] [1577567951.365421988]: Plugin cam_imu_sync loaded
[ INFO] [1577567951.367913849]: Plugin cam_imu_sync initialized
[ INFO] [1577567951.368404637]: Plugin command loaded
[ INFO] [1577567951.387956755]: Plugin command initialized
[ INFO] [1577567951.388408532]: Plugin companion_process_status loaded
[ INFO] [1577567951.393551110]: Plugin companion_process_status initialized
[ INFO] [1577567951.393931220]: Plugin debug_value loaded
[ INFO] [1577567951.405495612]: Plugin debug_value initialized
[ INFO] [1577567951.405627437]: Plugin distance_sensor blacklisted
[ INFO] [1577567951.406209217]: Plugin fake_gps loaded
[ INFO] [1577567951.434577196]: Plugin fake_gps initialized
[ INFO] [1577567951.435246633]: Plugin ftp loaded
[ INFO] [1577567951.457281027]: Plugin ftp initialized
[ INFO] [1577567951.457754368]: Plugin global_position loaded
[ INFO] [1577567951.496433856]: Plugin global_position initialized
[ INFO] [1577567951.496840737]: Plugin gps_rtk loaded
[ INFO] [1577567951.502291809]: Plugin gps_rtk initialized
[ INFO] [1577567951.502772858]: Plugin hil loaded
[ INFO] [1577567951.535181679]: Plugin hil initialized
[ INFO] [1577567951.535688874]: Plugin home_position loaded
[ INFO] [1577567951.545151777]: Plugin home_position initialized
[ INFO] [1577567951.545810537]: Plugin imu loaded
[ INFO] [1577567951.564496287]: Plugin imu initialized
[ INFO] [1577567951.565104525]: Plugin landing_target loaded
[ INFO] [1577567951.607008645]: Plugin landing_target initialized
[ INFO] [1577567951.607483444]: Plugin local_position loaded
[ INFO] [1577567951.622882426]: Plugin local_position initialized
[ INFO] [1577567951.623460039]: Plugin log_transfer loaded
[ INFO] [1577567951.633395970]: Plugin log_transfer initialized
[ INFO] [1577567951.633889258]: Plugin manual_control loaded
[ INFO] [1577567951.640757330]: Plugin manual_control initialized
[ INFO] [1577567951.641162076]: Plugin mocap_pose_estimate loaded
[ INFO] [1577567951.649337303]: Plugin mocap_pose_estimate initialized
[ INFO] [1577567951.650025907]: Plugin mount_control loaded
[ INFO] [1577567951.659725897]: Plugin mount_control initialized
[ INFO] [1577567951.660209498]: Plugin obstacle_distance loaded
[ INFO] [1577567951.667647579]: Plugin obstacle_distance initialized
[ INFO] [1577567951.668090138]: Plugin odom loaded
[ INFO] [1577567951.678262270]: Plugin odom initialized
[ INFO] [1577567951.678733839]: Plugin onboard_computer_status loaded
[ INFO] [1577567951.685217322]: Plugin onboard_computer_status initialized
[ INFO] [1577567951.685845353]: Plugin param loaded
[ INFO] [1577567951.695682949]: Plugin param initialized
[ INFO] [1577567951.696142018]: Plugin px4flow loaded
[ INFO] [1577567951.711075160]: Plugin px4flow initialized
[ INFO] [1577567951.711207089]: Plugin rangefinder blacklisted
[ INFO] [1577567951.711747565]: Plugin rc_io loaded
[ INFO] [1577567951.721560994]: Plugin rc_io initialized
[ INFO] [1577567951.721872822]: Plugin safety_area blacklisted
[ INFO] [1577567951.722344131]: Plugin setpoint_accel loaded
[ INFO] [1577567951.729847734]: Plugin setpoint_accel initialized
[ INFO] [1577567951.730641131]: Plugin setpoint_attitude loaded
[ INFO] [1577567951.754769307]: Plugin setpoint_attitude initialized
[ INFO] [1577567951.755314680]: Plugin setpoint_position loaded
[ INFO] [1577567951.792490916]: Plugin setpoint_position initialized
[ INFO] [1577567951.793004986]: Plugin setpoint_raw loaded
[ INFO] [1577567951.814774845]: Plugin setpoint_raw initialized
[ INFO] [1577567951.815367042]: Plugin setpoint_trajectory loaded
[ INFO] [1577567951.828349581]: Plugin setpoint_trajectory initialized
[ INFO] [1577567951.828841255]: Plugin setpoint_velocity loaded
[ INFO] [1577567951.842054995]: Plugin setpoint_velocity initialized
[ INFO] [1577567951.843149752]: Plugin sys_status loaded
[ INFO] [1577567951.870197398]: Plugin sys_status initialized
[ INFO] [1577567951.870785272]: Plugin sys_time loaded
[ INFO] [1577567951.885222833]: TM: Timesync mode: MAVLINK
[ INFO] [1577567951.888833200]: Plugin sys_time initialized
[ INFO] [1577567951.889287217]: Plugin trajectory loaded
[ INFO] [1577567951.901037967]: Plugin trajectory initialized
[ INFO] [1577567951.901510422]: Plugin vfr_hud loaded
[ INFO] [1577567951.903667694]: Plugin vfr_hud initialized
[ INFO] [1577567951.903790768]: Plugin vibration blacklisted
[ INFO] [1577567951.904182753]: Plugin vision_pose_estimate loaded
[ INFO] [1577567951.921912083]: Plugin vision_pose_estimate initialized
[ INFO] [1577567951.922364329]: Plugin vision_speed_estimate loaded
[ INFO] [1577567951.930803779]: Plugin vision_speed_estimate initialized
[ INFO] [1577567951.931347746]: Plugin waypoint loaded
[ INFO] [1577567951.946356617]: Plugin waypoint initialized
[ INFO] [1577567951.946555422]: Plugin wheel_odometry blacklisted
[ INFO] [1577567951.946993710]: Plugin wind_estimation loaded
[ INFO] [1577567951.949341246]: Plugin wind_estimation initialized
[ INFO] [1577567951.949515519]: Autostarting mavlink via USB on PX4
[ INFO] [1577567951.949883858]: Built-in SIMD instructions: ARM NEON
[ INFO] [1577567951.949976047]: Built-in MAVLink package version: 2019.12.12
[ INFO] [1577567951.950076465]: Known MAVLink dialects: common ardupilotmega ASLUAV autoquad icarous matrixpilot paparazzi slugs standard uAvionix ualberta
[ INFO] [1577567951.950150789]: MAVROS started. MY ID 1.240, TARGET ID 1.1
[ INFO] [1577567951.968636432]: IMU: High resolution IMU detected!
[ INFO] [1577567951.970489637]: IMU: Attitude quaternion IMU detected!
[ INFO] [1577567951.993582432]: RC_CHANNELS message detected!
[ INFO] [1577567952.201876088]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
[ INFO] [1577567952.211798008]: IMU: High resolution IMU detected!
[ INFO] [1577567952.213290322]: IMU: Attitude quaternion IMU detected!
[ INFO] [1577567952.240405106]: RC_CHANNELS message detected!
[ERROR] [1577567952.856373856]: FCU: REJECT POSITION CONTROL
[ERROR] [1577567952.907173683]: FCU: Manual control lost
[ INFO] [1577567952.955694726]: FCU: Manual control regained after 669ms
[ERROR] [1577567953.005133803]: FCU: Manual control lost
[ INFO] [1577567953.056567233]: FCU: Manual control regained after 588ms
[ INFO] [1577567953.216666518]: VER: 1.1: Capabilities 0x000000000000e4ef
[ INFO] [1577567953.218138936]: VER: 1.1: Flight software: 010a00ff (4f6faac2c8000000)
[ INFO] [1577567953.220683297]: VER: 1.1: Middleware software: 010a00ff (4f6faac2c8000000)
[ INFO] [1577567953.222034515]: VER: 1.1: OS software: 071d00ff (427238133be2b0ec)
[ INFO] [1577567953.223093281]: VER: 1.1: Board hardware: 00000011
[ INFO] [1577567953.223882147]: VER: 1.1: VID/PID: 26ac:0011
[ INFO] [1577567953.225017008]: VER: 1.1: UID: 3337510e31303337
[ WARN] [1577567953.225645507]: CMD: Unexpected command 520, result 0
[ INFO] [1577567955.492892913]: FCU: Manual control regained after 3890ms
[ WARN] [1577567956.340414471]: GP: No GPS fix
[ INFO] [1577567962.203184899]: HP: requesting home position
[ INFO] [1577567967.215087572]: WP: mission received
[ INFO] [1577567972.203889482]: HP: requesting home position
[ INFO] [1577567982.202857996]: HP: requesting home position
[ WARN] [1577567986.446954895]: GP: No GPS fix
[ INFO] [1577567992.203256429]: HP: requesting home position
[ INFO] [1577567999.609928479]: FCU: [logger] file: /fs/microsd/log/2019-12-28/21_19_5
[ INFO] [1577568002.203472254]: HP: requesting home position
[ INFO] [1577568012.203384429]: HP: requesting home position
[ WARN] [1577568016.455092484]: GP: No GPS fix
[ INFO] [1577568018.183989078]: FCU: ARMED by Arm/Disarm component command
[ INFO] [1577568018.230233264]: FCU: [logger] file: /fs/microsd/log/2019-12-28/21_20_1
[ INFO] [1577568022.202710866]: HP: requesting home position
[ WARN] [1577568026.571076614]: CMD: Unexpected command 176, result 0
[ INFO] [1577568028.180467556]: FCU: DISARMED by Auto disarm initiated
[ INFO] [1577568032.202880597]: HP: requesting home position
[ INFO] [1577568042.203011109]: HP: requesting home position
^C[mavros-2] killing on exit
Debug: mavconn: serial0: recv: v2.0 !CRC Message-Id: 111 [13 bytes] IDs: 1.1 Seq: 147
Debug: mavconn: serial0: recv: v2.0 !CRC Message-Id: 65 [42 bytes] IDs: 1.1 Seq: 148
Debug: mavconn: serial0: recv: v2.0 !CRC Message-Id: 141 [32 bytes] IDs: 1.1 Seq: 149
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor…
… shutting down processing monitor complete
done

If anyone could share some insight on this it would be greatly appreciated. Thank you.

2 Likes

I encountered the same problem, can you help me?thank you very much

1 Like

If you are getting the same warning message: “CMD: Unexpected command 176, result 0”, I believe that means the command is accepted. If you look at vehicle_command_ack.h and vehicle_command.h files 176 is the mavlink message VEHICLE_CMD_DO_SET_MODE and 0 is VEHICLE_RESULT_ACCEPTED.

Are you experiencing any particular error with the warning message?
If the vehicle isn’t arming via transmitter try arming it with QGC. At least that was the case for me.

Seems like you armed the vehicle in manual mode and trying to switch to offboard while it is still asking for GPS fix. Offboard mode requires some sort of requires position or pose/attitude information. You can find more information here: https://docs.px4.io/master/en/flight_modes/offboard.html

Were you able to solve this issue?

I encountered the same problem and was able to solve it by disabling one of the PX4 parameters:[COM_DISARM_PRFLT] have a look [here] (Parameter Reference | PX4 User Guide)