Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Offboard #1644

Open
iamrajee opened this issue Nov 8, 2021 · 10 comments
Open

Unable to Offboard #1644

iamrajee opened this issue Nov 8, 2021 · 10 comments

Comments

@iamrajee
Copy link

iamrajee commented Nov 8, 2021


Issue details

On running offboard commands, it's not offboarding and gives errors like time out and Unexpected command 176.

Command

Terminal1: roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"
Terminal2: roslaunch px4 posix_sitl.launch
Terminal3: rosrun mavros mavsafety arm
Terminal4: rosrun mavros mavsys mode -c OFFBOARD

Errors:

Terminal1:
CMD: Unexpected command 176, result 1
Terminal2:

INFO  [commander] Armed by external command	
INFO  [tone_alarm] notify negative
INFO  [commander] Disarmed by auto preflight disarming	
INFO  [logger] closed logfile, bytes written: 1873827

Terminal3:
No Error
Terminal4:
Timed out!

MAVROS version and platform

ROS: ?Noetic?
Ubuntu: ?20.04?

Autopilot type and version

[ ] PX4

Version: ?3.7.1?

===== > Expand to see: Node logs, Diagnostics & Check ID Output <======= ### Node logs ``` ... logging to /home/rajendra/.ros/log/18daa76e-4087-11ec-b188-d915890be05a/roslaunch-u20-86915.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://u20:40867/

SUMMARY

CLEAR PARAMETERS

  • /mavros/

PARAMETERS

  • /mavros/cmd/use_comp_id_system_control: False
  • /mavros/conn/heartbeat_rate: 1.0
  • /mavros/conn/system_time_rate: 1.0
  • /mavros/conn/timeout: 10.0
  • /mavros/conn/timesync_rate: 10.0
  • /mavros/distance_sensor/hrlv_ez4_pub/field_of_view: 0.0
  • /mavros/distance_sensor/hrlv_ez4_pub/frame_id: hrlv_ez4_sonar
  • /mavros/distance_sensor/hrlv_ez4_pub/id: 0
  • /mavros/distance_sensor/hrlv_ez4_pub/orientation: PITCH_270
  • /mavros/distance_sensor/hrlv_ez4_pub/send_tf: True
  • /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/x: 0.0
  • /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/y: 0.0
  • /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/z: -0.1
  • /mavros/distance_sensor/laser_1_sub/id: 3
  • /mavros/distance_sensor/laser_1_sub/orientation: PITCH_270
  • /mavros/distance_sensor/laser_1_sub/subscriber: True
  • /mavros/distance_sensor/lidarlite_pub/field_of_view: 0.0
  • /mavros/distance_sensor/lidarlite_pub/frame_id: lidarlite_laser
  • /mavros/distance_sensor/lidarlite_pub/id: 1
  • /mavros/distance_sensor/lidarlite_pub/orientation: PITCH_270
  • /mavros/distance_sensor/lidarlite_pub/send_tf: True
  • /mavros/distance_sensor/lidarlite_pub/sensor_position/x: 0.0
  • /mavros/distance_sensor/lidarlite_pub/sensor_position/y: 0.0
  • /mavros/distance_sensor/lidarlite_pub/sensor_position/z: -0.1
  • /mavros/distance_sensor/sonar_1_sub/horizontal_fov_ratio: 1.0
  • /mavros/distance_sensor/sonar_1_sub/id: 2
  • /mavros/distance_sensor/sonar_1_sub/orientation: PITCH_270
  • /mavros/distance_sensor/sonar_1_sub/subscriber: True
  • /mavros/distance_sensor/sonar_1_sub/vertical_fov_ratio: 1.0
  • /mavros/fake_gps/eph: 2.0
  • /mavros/fake_gps/epv: 2.0
  • /mavros/fake_gps/fix_type: 3
  • /mavros/fake_gps/geo_origin/alt: 408.0
  • /mavros/fake_gps/geo_origin/lat: 47.3667
  • /mavros/fake_gps/geo_origin/lon: 8.55
  • /mavros/fake_gps/gps_rate: 5.0
  • /mavros/fake_gps/mocap_transform: True
  • /mavros/fake_gps/satellites_visible: 5
  • /mavros/fake_gps/tf/child_frame_id: fix
  • /mavros/fake_gps/tf/frame_id: map
  • /mavros/fake_gps/tf/listen: False
  • /mavros/fake_gps/tf/rate_limit: 10.0
  • /mavros/fake_gps/tf/send: False
  • /mavros/fake_gps/use_mocap: True
  • /mavros/fake_gps/use_vision: False
  • /mavros/fcu_protocol: v2.0
  • /mavros/fcu_url: udp://:14540@127....
  • /mavros/gcs_url:
  • /mavros/global_position/child_frame_id: base_link
  • /mavros/global_position/frame_id: map
  • /mavros/global_position/gps_uere: 1.0
  • /mavros/global_position/rot_covariance: 99999.0
  • /mavros/global_position/tf/child_frame_id: base_link
  • /mavros/global_position/tf/frame_id: map
  • /mavros/global_position/tf/global_frame_id: earth
  • /mavros/global_position/tf/send: False
  • /mavros/global_position/use_relative_alt: True
  • /mavros/image/frame_id: px4flow
  • /mavros/imu/angular_velocity_stdev: 0.0003490659 // 0...
  • /mavros/imu/frame_id: base_link
  • /mavros/imu/linear_acceleration_stdev: 0.0003
  • /mavros/imu/magnetic_stdev: 0.0
  • /mavros/imu/orientation_stdev: 1.0
  • /mavros/landing_target/camera/fov_x: 2.0071286398
  • /mavros/landing_target/camera/fov_y: 2.0071286398
  • /mavros/landing_target/image/height: 480
  • /mavros/landing_target/image/width: 640
  • /mavros/landing_target/land_target_type: VISION_FIDUCIAL
  • /mavros/landing_target/listen_lt: False
  • /mavros/landing_target/mav_frame: LOCAL_NED
  • /mavros/landing_target/target_size/x: 0.3
  • /mavros/landing_target/target_size/y: 0.3
  • /mavros/landing_target/tf/child_frame_id: camera_center
  • /mavros/landing_target/tf/frame_id: landing_target
  • /mavros/landing_target/tf/listen: False
  • /mavros/landing_target/tf/rate_limit: 10.0
  • /mavros/landing_target/tf/send: True
  • /mavros/local_position/frame_id: map
  • /mavros/local_position/tf/child_frame_id: base_link
  • /mavros/local_position/tf/frame_id: map
  • /mavros/local_position/tf/send: False
  • /mavros/local_position/tf/send_fcu: False
  • /mavros/mission/pull_after_gcs: True
  • /mavros/mission/use_mission_item_int: True
  • /mavros/mocap/use_pose: True
  • /mavros/mocap/use_tf: False
  • /mavros/odometry/fcu/odom_child_id_des: base_link
  • /mavros/odometry/fcu/odom_parent_id_des: map
  • /mavros/plugin_blacklist: ['safety_area', '...
  • /mavros/plugin_whitelist: []
  • /mavros/px4flow/frame_id: px4flow
  • /mavros/px4flow/ranger_fov: 0.118682
  • /mavros/px4flow/ranger_max_range: 5.0
  • /mavros/px4flow/ranger_min_range: 0.3
  • /mavros/safety_area/p1/x: 1.0
  • /mavros/safety_area/p1/y: 1.0
  • /mavros/safety_area/p1/z: 1.0
  • /mavros/safety_area/p2/x: -1.0
  • /mavros/safety_area/p2/y: -1.0
  • /mavros/safety_area/p2/z: -1.0
  • /mavros/setpoint_accel/send_force: False
  • /mavros/setpoint_attitude/reverse_thrust: False
  • /mavros/setpoint_attitude/tf/child_frame_id: target_attitude
  • /mavros/setpoint_attitude/tf/frame_id: map
  • /mavros/setpoint_attitude/tf/listen: False
  • /mavros/setpoint_attitude/tf/rate_limit: 50.0
  • /mavros/setpoint_attitude/use_quaternion: False
  • /mavros/setpoint_position/mav_frame: LOCAL_NED
  • /mavros/setpoint_position/tf/child_frame_id: target_position
  • /mavros/setpoint_position/tf/frame_id: map
  • /mavros/setpoint_position/tf/listen: False
  • /mavros/setpoint_position/tf/rate_limit: 50.0
  • /mavros/setpoint_raw/thrust_scaling: 1.0
  • /mavros/setpoint_velocity/mav_frame: LOCAL_NED
  • /mavros/startup_px4_usb_quirk: True
  • /mavros/sys/disable_diag: False
  • /mavros/sys/min_voltage: 10.0
  • /mavros/target_component_id: 1
  • /mavros/target_system_id: 1
  • /mavros/tdr_radio/low_rssi: 40
  • /mavros/time/time_ref_source: fcu
  • /mavros/time/timesync_avg_alpha: 0.6
  • /mavros/time/timesync_mode: MAVLINK
  • /mavros/vibration/frame_id: base_link
  • /mavros/vision_pose/tf/child_frame_id: vision_estimate
  • /mavros/vision_pose/tf/frame_id: odom
  • /mavros/vision_pose/tf/listen: False
  • /mavros/vision_pose/tf/rate_limit: 10.0
  • /mavros/vision_speed/listen_twist: True
  • /mavros/vision_speed/twist_cov: True
  • /mavros/wheel_odometry/child_frame_id: base_link
  • /mavros/wheel_odometry/count: 2
  • /mavros/wheel_odometry/frame_id: odom
  • /mavros/wheel_odometry/send_raw: True
  • /mavros/wheel_odometry/send_twist: False
  • /mavros/wheel_odometry/tf/child_frame_id: base_link
  • /mavros/wheel_odometry/tf/frame_id: odom
  • /mavros/wheel_odometry/tf/send: False
  • /mavros/wheel_odometry/use_rpm: False
  • /mavros/wheel_odometry/vel_error: 0.1
  • /mavros/wheel_odometry/wheel0/radius: 0.05
  • /mavros/wheel_odometry/wheel0/x: 0.0
  • /mavros/wheel_odometry/wheel0/y: -0.15
  • /mavros/wheel_odometry/wheel1/radius: 0.05
  • /mavros/wheel_odometry/wheel1/x: 0.0
  • /mavros/wheel_odometry/wheel1/y: 0.15
  • /rosdistro: noetic
  • /rosversion: 1.15.13

NODES
/
mavros (mavros/mavros_node)

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

setting /run_id to 18daa76e-4087-11ec-b188-d915890be05a
process[rosout-1]: started with pid [86957]
started core service [/rosout]
process[mavros-2]: started with pid [86965]
[ INFO] [1636370953.337379554]: FCU URL: udp://:14540@127.0.0.1:14557
[ INFO] [1636370953.338554393]: udp0: Bind address: 0.0.0.0:14540
[ INFO] [1636370953.338588363]: udp0: Remote address: 127.0.0.1:14557
[ INFO] [1636370953.338653668]: GCS bridge disabled
[ INFO] [1636370953.344637127]: Plugin 3dr_radio loaded
[ INFO] [1636370953.345229702]: Plugin 3dr_radio initialized
[ INFO] [1636370953.345260797]: Plugin actuator_control loaded
[ INFO] [1636370953.346531315]: Plugin actuator_control initialized
[ INFO] [1636370953.348686356]: Plugin adsb loaded
[ INFO] [1636370953.350249280]: Plugin adsb initialized
[ INFO] [1636370953.350298662]: Plugin altitude loaded
[ INFO] [1636370953.350787542]: Plugin altitude initialized
[ INFO] [1636370953.350825836]: Plugin cam_imu_sync loaded
[ INFO] [1636370953.351143715]: Plugin cam_imu_sync initialized
[ INFO] [1636370953.351238120]: Plugin command loaded
[ INFO] [1636370953.354342777]: Plugin command initialized
[ INFO] [1636370953.354415274]: Plugin companion_process_status loaded
[ INFO] [1636370953.355708975]: Plugin companion_process_status initialized
[ INFO] [1636370953.355780504]: Plugin debug_value loaded
[ INFO] [1636370953.357896568]: Plugin debug_value initialized
[ INFO] [1636370953.357914016]: Plugin distance_sensor blacklisted
[ INFO] [1636370953.357982266]: Plugin esc_status loaded
[ INFO] [1636370953.358564021]: Plugin esc_status initialized
[ INFO] [1636370953.358641378]: Plugin esc_telemetry loaded
[ INFO] [1636370953.358939999]: Plugin esc_telemetry initialized
[ INFO] [1636370953.359027319]: Plugin fake_gps loaded
[ INFO] [1636370953.366722431]: Plugin fake_gps initialized
[ INFO] [1636370953.366807277]: Plugin ftp loaded
[ INFO] [1636370953.369959456]: Plugin ftp initialized
[ INFO] [1636370953.370032120]: Plugin geofence loaded
[ INFO] [1636370953.371490409]: Plugin geofence initialized
[ INFO] [1636370953.371567068]: Plugin global_position loaded
[ INFO] [1636370953.379730890]: Plugin global_position initialized
[ INFO] [1636370953.379803892]: Plugin gps_input loaded
[ INFO] [1636370953.381226136]: Plugin gps_input initialized
[ INFO] [1636370953.381299174]: Plugin gps_rtk loaded
[ INFO] [1636370953.382655862]: Plugin gps_rtk initialized
[ INFO] [1636370953.382735016]: Plugin gps_status loaded
[ INFO] [1636370953.383937501]: Plugin gps_status initialized
[ INFO] [1636370953.384012134]: Plugin hil loaded
[ INFO] [1636370953.390284194]: Plugin hil initialized
[ INFO] [1636370953.390358809]: Plugin home_position loaded
[ INFO] [1636370953.392139148]: Plugin home_position initialized
[ INFO] [1636370953.392188020]: Plugin imu loaded
[ INFO] [1636370953.395839831]: Plugin imu initialized
[ INFO] [1636370953.395885965]: Plugin landing_target loaded
[ INFO] [1636370953.402558907]: Plugin landing_target initialized
[ INFO] [1636370953.402636775]: Plugin local_position loaded
[ INFO] [1636370953.405978119]: Plugin local_position initialized
[ INFO] [1636370953.406046740]: Plugin log_transfer loaded
[ INFO] [1636370953.407635219]: Plugin log_transfer initialized
[ INFO] [1636370953.407706050]: Plugin mag_calibration_status loaded
[ INFO] [1636370953.408532198]: Plugin mag_calibration_status initialized
[ INFO] [1636370953.408608057]: Plugin manual_control loaded
[ INFO] [1636370953.410557452]: Plugin manual_control initialized
[ INFO] [1636370953.410623550]: Plugin mocap_pose_estimate loaded
[ INFO] [1636370953.412570183]: Plugin mocap_pose_estimate initialized
[ INFO] [1636370953.412616839]: Plugin mount_control loaded
[ INFO] [1636370953.414478274]: Plugin mount_control initialized
[ INFO] [1636370953.414528324]: Plugin nav_controller_output loaded
[ INFO] [1636370953.415322558]: Plugin nav_controller_output initialized
[ INFO] [1636370953.415369991]: Plugin obstacle_distance loaded
[ INFO] [1636370953.416799441]: Plugin obstacle_distance initialized
[ INFO] [1636370953.416842831]: Plugin odom loaded
[ INFO] [1636370953.418902424]: Plugin odom initialized
[ INFO] [1636370953.418949060]: Plugin onboard_computer_status loaded
[ INFO] [1636370953.420092997]: Plugin onboard_computer_status initialized
[ INFO] [1636370953.420143455]: Plugin param loaded
[ INFO] [1636370953.421683008]: Plugin param initialized
[ INFO] [1636370953.421729172]: Plugin play_tune loaded
[ INFO] [1636370953.423481387]: Plugin play_tune initialized
[ INFO] [1636370953.423526233]: Plugin px4flow loaded
[ INFO] [1636370953.426912991]: Plugin px4flow initialized
[ INFO] [1636370953.426965817]: Plugin rallypoint loaded
[ INFO] [1636370953.428381960]: Plugin rallypoint initialized
[ INFO] [1636370953.428400111]: Plugin rangefinder blacklisted
[ INFO] [1636370953.428449084]: Plugin rc_io loaded
[ INFO] [1636370953.430169743]: Plugin rc_io initialized
[ INFO] [1636370953.430186083]: Plugin safety_area blacklisted
[ INFO] [1636370953.430239832]: Plugin setpoint_accel loaded
[ INFO] [1636370953.431712237]: Plugin setpoint_accel initialized
[ INFO] [1636370953.431764933]: Plugin setpoint_attitude loaded
[ INFO] [1636370953.436787050]: Plugin setpoint_attitude initialized
[ INFO] [1636370953.436843061]: Plugin setpoint_position loaded
[ INFO] [1636370953.444695079]: Plugin setpoint_position initialized
[ INFO] [1636370953.444749019]: Plugin setpoint_raw loaded
[ INFO] [1636370953.448981401]: Plugin setpoint_raw initialized
[ INFO] [1636370953.449039607]: Plugin setpoint_trajectory loaded
[ INFO] [1636370953.451888522]: Plugin setpoint_trajectory initialized
[ INFO] [1636370953.451947705]: Plugin setpoint_velocity loaded
[ INFO] [1636370953.454700339]: Plugin setpoint_velocity initialized
[ INFO] [1636370953.454775349]: Plugin sys_status loaded
[ INFO] [1636370953.460130088]: Plugin sys_status initialized
[ INFO] [1636370953.460193739]: Plugin sys_time loaded
[ INFO] [1636370953.462800523]: TM: Timesync mode: MAVLINK
[ INFO] [1636370953.462980192]: TM: Not publishing sim time
[ INFO] [1636370953.463493991]: Plugin sys_time initialized
[ INFO] [1636370953.463546019]: Plugin trajectory loaded
[ INFO] [1636370953.466134952]: Plugin trajectory initialized
[ INFO] [1636370953.466184619]: Plugin tunnel loaded
[ INFO] [1636370953.467601361]: Plugin tunnel initialized
[ INFO] [1636370953.467656896]: Plugin vfr_hud loaded
[ INFO] [1636370953.467943191]: Plugin vfr_hud initialized
[ INFO] [1636370953.467964132]: Plugin vibration blacklisted
[ INFO] [1636370953.468013825]: Plugin vision_pose_estimate loaded
[ INFO] [1636370953.471496581]: Plugin vision_pose_estimate initialized
[ INFO] [1636370953.471549667]: Plugin vision_speed_estimate loaded
[ INFO] [1636370953.473181368]: Plugin vision_speed_estimate initialized
[ INFO] [1636370953.473234360]: Plugin waypoint loaded
[ INFO] [1636370953.475488740]: Plugin waypoint initialized
[ INFO] [1636370953.475512220]: Plugin wheel_odometry blacklisted
[ INFO] [1636370953.475565594]: Plugin wind_estimation loaded
[ INFO] [1636370953.475875658]: Plugin wind_estimation initialized
[ INFO] [1636370953.475899715]: Autostarting mavlink via USB on PX4
[ INFO] [1636370953.475925073]: Built-in SIMD instructions: SSE, SSE2
[ INFO] [1636370953.475939586]: Built-in MAVLink package version: 2021.9.9
[ INFO] [1636370953.475955560]: Known MAVLink dialects: common ardupilotmega ASLUAV all development icarous matrixpilot paparazzi standard uAvionix ualberta
[ INFO] [1636370953.476000700]: MAVROS started. MY ID 1.240, TARGET ID 1.1
[ INFO] [1636370957.598001363]: udp0: Remote address: 127.0.0.1:14580
[ INFO] [1636370957.598108186]: IMU: High resolution IMU detected!
[ INFO] [1636370958.583735245]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
[ INFO] [1636370958.586685253]: IMU: High resolution IMU detected!
[ INFO] [1636370959.595795761]: GF: Using MISSION_ITEM_INT
[ INFO] [1636370959.595916362]: RP: Using MISSION_ITEM_INT
[ INFO] [1636370959.596008041]: WP: Using MISSION_ITEM_INT
[ INFO] [1636370959.596153706]: VER: 1.1: Capabilities 0x000000000000e4ef
[ INFO] [1636370959.596527388]: VER: 1.1: Flight software: 010d0000 (f9cfcc5cfa000000)
[ INFO] [1636370959.596653307]: VER: 1.1: Middleware software: 010d0000 (f9cfcc5cfa000000)
[ INFO] [1636370959.596766877]: VER: 1.1: OS software: 050b00ff (ca1938fbcccc1a0a)
[ INFO] [1636370959.596844121]: VER: 1.1: Board hardware: 00000001
[ INFO] [1636370959.596914584]: VER: 1.1: VID/PID: 0000:0000
[ INFO] [1636370959.596992308]: VER: 1.1: UID: 4954414c44494e4f
[ WARN] [1636370959.599783265]: CMD: Unexpected command 520, result 0
[ INFO] [1636370961.681557341]: IMU: Attitude quaternion IMU detected!
[ INFO] [1636370973.584681805]: GF: mission received
[ INFO] [1636370973.585601544]: RP: mission received
[ INFO] [1636370973.586278057]: WP: mission received
[ WARN] [1636370982.193006279]: CMD: Unexpected command 176, result 1
[ WARN] [1636371132.274533726]: CMD: Unexpected command 176, result 1
[ WARN] [1636371150.539472021]: CMD: Unexpected command 176, result 1

</details>

### Diagnostics

header:
seq: 593
stamp:
secs: 1636371755
nsecs: 476583860
frame_id: ''
status:

level: 0
name: "mavros: FCU connection"
message: "connected"
hardware_id: "udp://:14540@127.0.0.1:14557"
values: 
  - 
    key: "Received packets:"
    value: "64498"
  - 
    key: "Dropped packets:"
    value: "0"
  - 
    key: "Buffer overruns:"
    value: "0"
  - 
    key: "Parse errors:"
    value: "0"
  - 
    key: "Rx sequence number:"
    value: "239"
  - 
    key: "Tx sequence number:"
    value: "0"
  - 
    key: "Rx total bytes:"
    value: "19378364"
  - 
    key: "Tx total bytes:"
    value: "456588"
  - 
    key: "Rx speed:"
    value: "24357.000000"
  - 
    key: "Tx speed:"
    value: "570.000000"
  • level: 0
    name: "mavros: GPS"
    message: "3D fix"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Satellites visible"
    value: "10"
    
    • key: "Fix type"
      value: "3"
    • key: "EPH (m)"
      value: "0.00"
    • key: "EPV (m)"
      value: "0.00"
  • level: 0
    name: "mavros: Heartbeat"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Heartbeats since startup"
    value: "797"
    
    • key: "Frequency (Hz)"
      value: "1.037023"
    • key: "Vehicle type"
      value: "Quadrotor"
    • key: "Autopilot type"
      value: "PX4 Autopilot"
    • key: "Mode"
      value: "AUTO.LOITER"
    • key: "System status"
      value: "Standby"
  • level: 2
    name: "mavros: System"
    message: "Sensor health"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Sensor present"
    value: "0x1028002C"
    
    • key: "Sensor enabled"
      value: "0x1021000C"
    • key: "Sensor health"
      value: "0x102E002F"
    • key: "3D magnetometer"
      value: "Ok"
    • key: "absolute pressure"
      value: "Ok"
    • key: "rc receiver"
      value: "Fail"
    • key: "AHRS subsystem health"
      value: "Ok"
    • key: "pre-arm check status. Always healthy when armed"
      value: "Ok"
    • key: "CPU Load (%)"
      value: "26.0"
    • key: "Drop rate (%)"
      value: "0.0"
    • key: "Errors comm"
      value: "0"
    • key: "Errors count mavconn library. #1"
      value: "0"
    • key: "Errors count Pub/sub for Mavlink.msg #2"
      value: "0"
    • key: "Errors count Plugin loading functionality. #3"
      value: "0"
    • key: "Errors count Diagnostic mesages. #4"
      value: "0"
  • level: 0
    name: "mavros: Battery"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Voltage"
    value: "15.10"
    
    • key: "Current"
      value: "-1.0"
    • key: "Remaining"
      value: "51.0"
  • level: 0
    name: "mavros: Time Sync"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Timesyncs since startup"
    value: "7979"
    
    • key: "Frequency (Hz)"
      value: "9.999868"
    • key: "Last RTT (ms)"
      value: "0.277060"
    • key: "Mean RTT (ms)"
      value: "0.302375"
    • key: "Last remote time (s)"
      value: "797.328000000"
    • key: "Estimated time offset (s)"
      value: "1636370958.136772394"


### Check ID

OK. I got messages from 1:1.


Received 6150 messages, from 1 addresses
sys:comp list of messages
Exception in thread Thread-5:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/timer.py", line 237, in run
self._callback(TimerEvent(last_expected, last_real, current_expected, current_real, last_duration))
File "/home/rajendra/drone_ws/src/mavros/mavros/scripts/checkid", line 82, in timer_cb
for address, messages in self.message_sources.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

@Jaeyoung-Lim
Copy link
Contributor

@iamrajee What are you trying to achieve? If you don't send setpoints, you will not be able to change your mode into offboard mode since there is no setpoint to track

@iamrajee
Copy link
Author

iamrajee commented Nov 17, 2021

@iamrajee What are you trying to achieve? If you don't send setpoints, you will not be able to change your mode into offboard mode since there is no setpoint to track

I tried to publish the setpoint as below but it didn't help.

rostopic pub /mavros/setpoint_position/local geometry_msgs/PoseStamped "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: 'map'
pose:
  position:
    x: 0.0
    y: 0.0
    z: 2.0
  orientation:
    w: 0.0" 

But surprisingly when I tried the below script it works:

/**
 * @file offb_node.cpp
 * @brief offboard example node, written with mavros version 0.14.2, px4 flight
 * stack and tested in Gazebo SITL
 */

#include <ros/ros.h>
#include <geometry_msgs/PoseStamped.h>
#include <mavros_msgs/CommandBool.h>
#include <mavros_msgs/SetMode.h>
#include <mavros_msgs/State.h>

mavros_msgs::State current_state;
void state_cb(const mavros_msgs::State::ConstPtr& msg){
    current_state = *msg;
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "offb_node");
    ros::NodeHandle nh;

    ros::Subscriber state_sub = nh.subscribe<mavros_msgs::State>
            ("mavros/state", 10, state_cb);
    ros::Publisher local_pos_pub = nh.advertise<geometry_msgs::PoseStamped>
            ("mavros/setpoint_position/local", 10);
    ros::ServiceClient arming_client = nh.serviceClient<mavros_msgs::CommandBool>
            ("mavros/cmd/arming");
    ros::ServiceClient set_mode_client = nh.serviceClient<mavros_msgs::SetMode>
            ("mavros/set_mode");

    //the setpoint publishing rate MUST be faster than 2Hz
    ros::Rate rate(20.0);

    // wait for FCU connection
    while(ros::ok() && current_state.connected){
        ros::spinOnce();
        rate.sleep();
    }

    geometry_msgs::PoseStamped pose;
    pose.pose.position.x = 0;
    pose.pose.position.y = 0;
    pose.pose.position.z = 2;

    //send a few setpoints before starting
    for(int i = 100; ros::ok() && i > 0; --i){
        local_pos_pub.publish(pose);
        ros::spinOnce();
        rate.sleep();
    }

    mavros_msgs::SetMode offb_set_mode;
    offb_set_mode.request.custom_mode = "OFFBOARD";

    mavros_msgs::CommandBool arm_cmd;
    arm_cmd.request.value = true;

    ros::Time last_request = ros::Time::now();

    while(ros::ok()){
        if( current_state.mode != "OFFBOARD" &&
            (ros::Time::now() - last_request > ros::Duration(5.0))){
            if( set_mode_client.call(offb_set_mode) &&
                offb_set_mode.response.mode_sent){
                ROS_INFO("Offboard enabled");
            }
            last_request = ros::Time::now();
        } else {
            if( !current_state.armed &&
                (ros::Time::now() - last_request > ros::Duration(5.0))){
                if( arming_client.call(arm_cmd) &&
                    arm_cmd.response.success){
                    ROS_INFO("Vehicle armed");
                }
                last_request = ros::Time::now();
            }
        }

        local_pos_pub.publish(pose);

        ros::spinOnce();
        rate.sleep();
    }

    return 0;
}

I'm not sure what I might be doing wrong when manual publishing set point. Also can you please tell me the correct order of "Arming", "Setting Offboard mode" and "publishing set point"? Thank you so much!

@Jaeyoung-Lim
Copy link
Contributor

@iamrajee You need to be publishing your setpoint for at least 2Hz in order to switch to offboard mode. Your code is publishing a few setpoints then trying to switch to offboard mode

@iamrajee
Copy link
Author

Thank you so much @Jaeyoung-Lim, I tried your suggestions and it worked. I'm new to mavros and didn't knew that.

I'm describing my steps herewith in case anyone faces a similar issue: (works!)

Terminal1: roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"
Terminal2: roslaunch px4 posix_sitl.launch
Terminal3:

rostopic pub -r 10 /mavros/setpoint_position/local geometry_msgs/PoseStamped "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: 'map'
pose:
  position:
    x: 0.0
    y: 0.0
    z: 2.0
  orientation:
    x: 0.0
    y: 0.0
    z: 0.0
    w: 1.0" 

Terminal4: rosrun mavros mavsys mode -c OFFBOARD
Terminal5: rosrun mavros mavsafety arm

@Jaeyoung-Lim
Copy link
Contributor

@iamrajee Glad that it worked, and thanks for sharing the solution!

@iamrajee
Copy link
Author

iamrajee commented Nov 21, 2021

I'm facing the same issue in melodic as well. However, I couldn't resolve it by the above method. I tried both cpp script and manually publishing setpoint but it dint work. Surprisingly same thing works in noetic. Also. I've tried both binary and source versions of mavros with no luck. Here is how I'm running mavros:

Terminal 1: roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"

logging to /home/rajendra/.ros/log/1c22cf90-4ad3-11ec-9285-7cd30a81f90b/roslaunch-u18-29152.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://u18:40415/

SUMMARY
========

CLEAR PARAMETERS
 * /mavros/

PARAMETERS
 * /mavros/cmd/use_comp_id_system_control: False
 * /mavros/conn/heartbeat_rate: 1.0
 * /mavros/conn/system_time_rate: 1.0
 * /mavros/conn/timeout: 10.0
 * /mavros/conn/timesync_rate: 10.0
 * /mavros/distance_sensor/hrlv_ez4_pub/field_of_view: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/frame_id: hrlv_ez4_sonar
 * /mavros/distance_sensor/hrlv_ez4_pub/id: 0
 * /mavros/distance_sensor/hrlv_ez4_pub/orientation: PITCH_270
 * /mavros/distance_sensor/hrlv_ez4_pub/send_tf: True
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/x: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/y: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/z: -0.1
 * /mavros/distance_sensor/laser_1_sub/id: 3
 * /mavros/distance_sensor/laser_1_sub/orientation: PITCH_270
 * /mavros/distance_sensor/laser_1_sub/subscriber: True
 * /mavros/distance_sensor/lidarlite_pub/field_of_view: 0.0
 * /mavros/distance_sensor/lidarlite_pub/frame_id: lidarlite_laser
 * /mavros/distance_sensor/lidarlite_pub/id: 1
 * /mavros/distance_sensor/lidarlite_pub/orientation: PITCH_270
 * /mavros/distance_sensor/lidarlite_pub/send_tf: True
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/x: 0.0
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/y: 0.0
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/z: -0.1
 * /mavros/distance_sensor/sonar_1_sub/horizontal_fov_ratio: 1.0
 * /mavros/distance_sensor/sonar_1_sub/id: 2
 * /mavros/distance_sensor/sonar_1_sub/orientation: PITCH_270
 * /mavros/distance_sensor/sonar_1_sub/subscriber: True
 * /mavros/distance_sensor/sonar_1_sub/vertical_fov_ratio: 1.0
 * /mavros/fake_gps/eph: 2.0
 * /mavros/fake_gps/epv: 2.0
 * /mavros/fake_gps/fix_type: 3
 * /mavros/fake_gps/geo_origin/alt: 408.0
 * /mavros/fake_gps/geo_origin/lat: 47.3667
 * /mavros/fake_gps/geo_origin/lon: 8.55
 * /mavros/fake_gps/gps_rate: 5.0
 * /mavros/fake_gps/mocap_transform: True
 * /mavros/fake_gps/satellites_visible: 5
 * /mavros/fake_gps/tf/child_frame_id: fix
 * /mavros/fake_gps/tf/frame_id: map
 * /mavros/fake_gps/tf/listen: False
 * /mavros/fake_gps/tf/rate_limit: 10.0
 * /mavros/fake_gps/tf/send: False
 * /mavros/fake_gps/use_mocap: True
 * /mavros/fake_gps/use_vision: False
 * /mavros/fcu_protocol: v2.0
 * /mavros/fcu_url: udp://:14540@127....
 * /mavros/gcs_url: 
 * /mavros/global_position/child_frame_id: base_link
 * /mavros/global_position/frame_id: map
 * /mavros/global_position/gps_uere: 1.0
 * /mavros/global_position/rot_covariance: 99999.0
 * /mavros/global_position/tf/child_frame_id: base_link
 * /mavros/global_position/tf/frame_id: map
 * /mavros/global_position/tf/global_frame_id: earth
 * /mavros/global_position/tf/send: False
 * /mavros/global_position/use_relative_alt: True
 * /mavros/image/frame_id: px4flow
 * /mavros/imu/angular_velocity_stdev: 0.0003490659 // 0...
 * /mavros/imu/frame_id: base_link
 * /mavros/imu/linear_acceleration_stdev: 0.0003
 * /mavros/imu/magnetic_stdev: 0.0
 * /mavros/imu/orientation_stdev: 1.0
 * /mavros/landing_target/camera/fov_x: 2.0071286398
 * /mavros/landing_target/camera/fov_y: 2.0071286398
 * /mavros/landing_target/image/height: 480
 * /mavros/landing_target/image/width: 640
 * /mavros/landing_target/land_target_type: VISION_FIDUCIAL
 * /mavros/landing_target/listen_lt: False
 * /mavros/landing_target/mav_frame: LOCAL_NED
 * /mavros/landing_target/target_size/x: 0.3
 * /mavros/landing_target/target_size/y: 0.3
 * /mavros/landing_target/tf/child_frame_id: camera_center
 * /mavros/landing_target/tf/frame_id: landing_target
 * /mavros/landing_target/tf/listen: False
 * /mavros/landing_target/tf/rate_limit: 10.0
 * /mavros/landing_target/tf/send: True
 * /mavros/local_position/frame_id: map
 * /mavros/local_position/tf/child_frame_id: base_link
 * /mavros/local_position/tf/frame_id: map
 * /mavros/local_position/tf/send: False
 * /mavros/local_position/tf/send_fcu: False
 * /mavros/mission/pull_after_gcs: True
 * /mavros/mission/use_mission_item_int: True
 * /mavros/mocap/use_pose: True
 * /mavros/mocap/use_tf: False
 * /mavros/odometry/fcu/odom_child_id_des: base_link
 * /mavros/odometry/fcu/odom_parent_id_des: map
 * /mavros/plugin_blacklist: ['safety_area', '...
 * /mavros/plugin_whitelist: []
 * /mavros/px4flow/frame_id: px4flow
 * /mavros/px4flow/ranger_fov: 0.118682
 * /mavros/px4flow/ranger_max_range: 5.0
 * /mavros/px4flow/ranger_min_range: 0.3
 * /mavros/safety_area/p1/x: 1.0
 * /mavros/safety_area/p1/y: 1.0
 * /mavros/safety_area/p1/z: 1.0
 * /mavros/safety_area/p2/x: -1.0
 * /mavros/safety_area/p2/y: -1.0
 * /mavros/safety_area/p2/z: -1.0
 * /mavros/setpoint_accel/send_force: False
 * /mavros/setpoint_attitude/reverse_thrust: False
 * /mavros/setpoint_attitude/tf/child_frame_id: target_attitude
 * /mavros/setpoint_attitude/tf/frame_id: map
 * /mavros/setpoint_attitude/tf/listen: False
 * /mavros/setpoint_attitude/tf/rate_limit: 50.0
 * /mavros/setpoint_attitude/use_quaternion: False
 * /mavros/setpoint_position/mav_frame: LOCAL_NED
 * /mavros/setpoint_position/tf/child_frame_id: target_position
 * /mavros/setpoint_position/tf/frame_id: map
 * /mavros/setpoint_position/tf/listen: False
 * /mavros/setpoint_position/tf/rate_limit: 50.0
 * /mavros/setpoint_raw/thrust_scaling: 1.0
 * /mavros/setpoint_velocity/mav_frame: LOCAL_NED
 * /mavros/startup_px4_usb_quirk: True
 * /mavros/sys/disable_diag: False
 * /mavros/sys/min_voltage: 10.0
 * /mavros/target_component_id: 1
 * /mavros/target_system_id: 1
 * /mavros/tdr_radio/low_rssi: 40
 * /mavros/time/time_ref_source: fcu
 * /mavros/time/timesync_avg_alpha: 0.6
 * /mavros/time/timesync_mode: MAVLINK
 * /mavros/vibration/frame_id: base_link
 * /mavros/vision_pose/tf/child_frame_id: vision_estimate
 * /mavros/vision_pose/tf/frame_id: odom
 * /mavros/vision_pose/tf/listen: False
 * /mavros/vision_pose/tf/rate_limit: 10.0
 * /mavros/vision_speed/listen_twist: True
 * /mavros/vision_speed/twist_cov: True
 * /mavros/wheel_odometry/child_frame_id: base_link
 * /mavros/wheel_odometry/count: 2
 * /mavros/wheel_odometry/frame_id: odom
 * /mavros/wheel_odometry/send_raw: True
 * /mavros/wheel_odometry/send_twist: False
 * /mavros/wheel_odometry/tf/child_frame_id: base_link
 * /mavros/wheel_odometry/tf/frame_id: odom
 * /mavros/wheel_odometry/tf/send: False
 * /mavros/wheel_odometry/use_rpm: False
 * /mavros/wheel_odometry/vel_error: 0.1
 * /mavros/wheel_odometry/wheel0/radius: 0.05
 * /mavros/wheel_odometry/wheel0/x: 0.0
 * /mavros/wheel_odometry/wheel0/y: -0.15
 * /mavros/wheel_odometry/wheel1/radius: 0.05
 * /mavros/wheel_odometry/wheel1/x: 0.0
 * /mavros/wheel_odometry/wheel1/y: 0.15
 * /rosdistro: melodic
 * /rosversion: 1.14.12

NODES
  /
    mavros (mavros/mavros_node)

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

setting /run_id to 1c22cf90-4ad3-11ec-9285-7cd30a81f90b
process[rosout-1]: started with pid [29195]
started core service [/rosout]
process[mavros-2]: started with pid [29203]
[ INFO] [1637503111.946372514]: FCU URL: udp://:14540@127.0.0.1:14557
[ INFO] [1637503111.947582082]: udp0: Bind address: 0.0.0.0:14540
[ INFO] [1637503111.947625185]: udp0: Remote address: 127.0.0.1:14557
[ INFO] [1637503111.947706274]: GCS bridge disabled
[ INFO] [1637503111.953687784]: Plugin 3dr_radio loaded
[ INFO] [1637503111.954446372]: Plugin 3dr_radio initialized
[ INFO] [1637503111.954488688]: Plugin actuator_control loaded
[ INFO] [1637503111.956276096]: Plugin actuator_control initialized
[ INFO] [1637503111.958386093]: Plugin adsb loaded
[ INFO] [1637503111.959804674]: Plugin adsb initialized
[ INFO] [1637503111.959869992]: Plugin altitude loaded
[ INFO] [1637503111.960362659]: Plugin altitude initialized
[ INFO] [1637503111.960444921]: Plugin cam_imu_sync loaded
[ INFO] [1637503111.960765306]: Plugin cam_imu_sync initialized
[ INFO] [1637503111.960811352]: Plugin command loaded
[ INFO] [1637503111.964367762]: Plugin command initialized
[ INFO] [1637503111.964427360]: Plugin companion_process_status loaded
[ INFO] [1637503111.965477386]: Plugin companion_process_status initialized
[ INFO] [1637503111.965535439]: Plugin debug_value loaded
[ INFO] [1637503111.967941122]: Plugin debug_value initialized
[ INFO] [1637503111.968010806]: Plugin distance_sensor blacklisted
[ INFO] [1637503111.968120022]: Plugin esc_status loaded
[ INFO] [1637503111.968652633]: Plugin esc_status initialized
[ INFO] [1637503111.968713517]: Plugin esc_telemetry loaded
[ INFO] [1637503111.968995346]: Plugin esc_telemetry initialized
[ INFO] [1637503111.969070462]: Plugin fake_gps loaded
[ INFO] [1637503111.975865075]: Plugin fake_gps initialized
[ INFO] [1637503111.975949432]: Plugin ftp loaded
[ INFO] [1637503111.979052338]: Plugin ftp initialized
[ INFO] [1637503111.979126654]: Plugin geofence loaded
[ INFO] [1637503111.980762121]: Plugin geofence initialized
[ INFO] [1637503111.980830138]: Plugin global_position loaded
[ INFO] [1637503111.989336983]: Plugin global_position initialized
[ INFO] [1637503111.989417491]: Plugin gps_input loaded
[ INFO] [1637503111.990842629]: Plugin gps_input initialized
[ INFO] [1637503111.990902858]: Plugin gps_rtk loaded
[ INFO] [1637503111.992323390]: Plugin gps_rtk initialized
[ INFO] [1637503111.992377481]: Plugin gps_status loaded
[ INFO] [1637503111.993423483]: Plugin gps_status initialized
[ INFO] [1637503111.993480639]: Plugin hil loaded
[ INFO] [1637503112.000092436]: Plugin hil initialized
[ INFO] [1637503112.000164990]: Plugin home_position loaded
[ INFO] [1637503112.001775671]: Plugin home_position initialized
[ INFO] [1637503112.001830902]: Plugin imu loaded
[ INFO] [1637503112.005217942]: Plugin imu initialized
[ INFO] [1637503112.005270686]: Plugin landing_target loaded
[ INFO] [1637503112.011669811]: Plugin landing_target initialized
[ INFO] [1637503112.011752563]: Plugin local_position loaded
[ INFO] [1637503112.014927285]: Plugin local_position initialized
[ INFO] [1637503112.014999730]: Plugin log_transfer loaded
[ INFO] [1637503112.016628850]: Plugin log_transfer initialized
[ INFO] [1637503112.016725438]: Plugin mag_calibration_status loaded
[ INFO] [1637503112.017320811]: Plugin mag_calibration_status initialized
[ INFO] [1637503112.017405296]: Plugin manual_control loaded
[ INFO] [1637503112.018918642]: Plugin manual_control initialized
[ INFO] [1637503112.019009661]: Plugin mocap_pose_estimate loaded
[ INFO] [1637503112.020779269]: Plugin mocap_pose_estimate initialized
[ INFO] [1637503112.020878159]: Plugin mount_control loaded
[ INFO] [1637503112.022947326]: Plugin mount_control initialized
[ INFO] [1637503112.023020398]: Plugin nav_controller_output loaded
[ INFO] [1637503112.023283941]: Plugin nav_controller_output initialized
[ INFO] [1637503112.023332916]: Plugin obstacle_distance loaded
[ INFO] [1637503112.024711703]: Plugin obstacle_distance initialized
[ INFO] [1637503112.024794820]: Plugin odom loaded
[ INFO] [1637503112.027503044]: Plugin odom initialized
[ INFO] [1637503112.027569373]: Plugin onboard_computer_status loaded
[ INFO] [1637503112.028835990]: Plugin onboard_computer_status initialized
[ INFO] [1637503112.028902847]: Plugin param loaded
[ INFO] [1637503112.030248440]: Plugin param initialized
[ INFO] [1637503112.030295619]: Plugin play_tune loaded
[ INFO] [1637503112.031404390]: Plugin play_tune initialized
[ INFO] [1637503112.031448871]: Plugin px4flow loaded
[ INFO] [1637503112.034450252]: Plugin px4flow initialized
[ INFO] [1637503112.034504011]: Plugin rallypoint loaded
[ INFO] [1637503112.035814216]: Plugin rallypoint initialized
[ INFO] [1637503112.035830135]: Plugin rangefinder blacklisted
[ INFO] [1637503112.035885398]: Plugin rc_io loaded
[ INFO] [1637503112.037437235]: Plugin rc_io initialized
[ INFO] [1637503112.037455235]: Plugin safety_area blacklisted
[ INFO] [1637503112.037502784]: Plugin setpoint_accel loaded
[ INFO] [1637503112.039035217]: Plugin setpoint_accel initialized
[ INFO] [1637503112.039156222]: Plugin setpoint_attitude loaded
[ INFO] [1637503112.043568510]: Plugin setpoint_attitude initialized
[ INFO] [1637503112.043658792]: Plugin setpoint_position loaded
[ INFO] [1637503112.051480446]: Plugin setpoint_position initialized
[ INFO] [1637503112.051563216]: Plugin setpoint_raw loaded
[ INFO] [1637503112.055334677]: Plugin setpoint_raw initialized
[ INFO] [1637503112.055415560]: Plugin setpoint_trajectory loaded
[ INFO] [1637503112.057598299]: Plugin setpoint_trajectory initialized
[ INFO] [1637503112.057662418]: Plugin setpoint_velocity loaded
[ INFO] [1637503112.060330874]: Plugin setpoint_velocity initialized
[ INFO] [1637503112.060401632]: Plugin sys_status loaded
[ INFO] [1637503112.065682004]: Plugin sys_status initialized
[ INFO] [1637503112.065749237]: Plugin sys_time loaded
[ INFO] [1637503112.068492092]: TM: Timesync mode: MAVLINK
[ INFO] [1637503112.068666386]: TM: Not publishing sim time
[ INFO] [1637503112.069187921]: Plugin sys_time initialized
[ INFO] [1637503112.069245484]: Plugin trajectory loaded
[ INFO] [1637503112.072335697]: Plugin trajectory initialized
[ INFO] [1637503112.072399867]: Plugin tunnel loaded
[ INFO] [1637503112.073752966]: Plugin tunnel initialized
[ INFO] [1637503112.073852270]: Plugin vfr_hud loaded
[ INFO] [1637503112.074285236]: Plugin vfr_hud initialized
[ INFO] [1637503112.074310604]: Plugin vibration blacklisted
[ INFO] [1637503112.074386992]: Plugin vision_pose_estimate loaded
[ INFO] [1637503112.078670735]: Plugin vision_pose_estimate initialized
[ INFO] [1637503112.078782430]: Plugin vision_speed_estimate loaded
[ INFO] [1637503112.080621105]: Plugin vision_speed_estimate initialized
[ INFO] [1637503112.080704368]: Plugin waypoint loaded
[ INFO] [1637503112.083029751]: Plugin waypoint initialized
[ INFO] [1637503112.083057773]: Plugin wheel_odometry blacklisted
[ INFO] [1637503112.083117530]: Plugin wind_estimation loaded
[ INFO] [1637503112.083420426]: Plugin wind_estimation initialized
[ INFO] [1637503112.083462348]: Autostarting mavlink via USB on PX4
[ INFO] [1637503112.083497434]: Built-in SIMD instructions: SSE, SSE2
[ INFO] [1637503112.083516776]: Built-in MAVLink package version: 2021.10.10
[ INFO] [1637503112.083532454]: Known MAVLink dialects: common ardupilotmega ASLUAV all development icarous matrixpilot paparazzi standard uAvionix ualberta
[ INFO] [1637503112.083546156]: MAVROS started. MY ID 1.240, TARGET ID 1.1
[ INFO] [1637503124.995040387]: udp0: Remote address: 127.0.0.1:14580
[ INFO] [1637503124.995253344]: IMU: High resolution IMU detected!
[ INFO] [1637503125.984324934]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
[ INFO] [1637503125.988831172]: IMU: High resolution IMU detected!
[ INFO] [1637503127.000273015]: GF: Using MISSION_ITEM_INT
[ INFO] [1637503127.000555581]: RP: Using MISSION_ITEM_INT
[ INFO] [1637503127.000756583]: WP: Using MISSION_ITEM_INT
[ INFO] [1637503127.000968379]: VER: 1.1: Capabilities         0x000000000000e4ef
[ INFO] [1637503127.001111970]: VER: 1.1: Flight software:     010d0000 (eade2915c1000000)
[ INFO] [1637503127.001234330]: VER: 1.1: Middleware software: 010d0000 (eade2915c1000000)
[ INFO] [1637503127.001347762]: VER: 1.1: OS software:         050400ff (ec8f6f56050033cc)
[ INFO] [1637503127.001430146]: VER: 1.1: Board hardware:      00000001
[ INFO] [1637503127.001520223]: VER: 1.1: VID/PID:             0000:0000
[ INFO] [1637503127.001603611]: VER: 1.1: UID:                 4954414c44494e4f
[ WARN] [1637503127.003542728]: CMD: Unexpected command 520, result 0
[ INFO] [1637503129.102129950]: IMU: Attitude quaternion IMU detected!
[ INFO] [1637503140.986058857]: GF: mission received
[ INFO] [1637503140.988113352]: RP: mission received
[ INFO] [1637503140.988844589]: WP: mission received
[ WARN] [1637503169.390914777]: CMD: Unexpected command 176, result 0
[ WARN] [1637503179.515387684]: CMD: Unexpected command 176, result 0
[ WARN] [1637503189.648825702]: CMD: Unexpected command 176, result 0

Terminal 2: roslaunch px4 posix_sitl.launch

logging to /home/rajendra/.ros/log/1c22cf90-4ad3-11ec-9285-7cd30a81f90b/roslaunch-u18-29262.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://u18:37505/

SUMMARY
========

PARAMETERS
 * /gazebo/enable_ros_network: True
 * /rosdistro: melodic
 * /rosversion: 1.14.12
 * /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    sitl (px4/px4)
    vehicle_spawn_u18_29262_493413658228928297 (gazebo_ros/spawn_model)

ROS_MASTER_URI=http://localhost:11311

process[sitl-1]: started with pid [29288]
Creating symlink /home/rajendra/PX4-Autopilot/build/px4_sitl_default/etc -> /home/rajendra/.ros/etc

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
INFO  [init] found model autostart file as SYS_AUTOSTART=10016
INFO  [param] selected parameter default file eeprom/parameters_10016
process[gazebo-2]: started with pid [29302]
INFO  [parameters] BSON document size 467 bytes, decoded 467 bytes
[param] Loaded: eeprom/parameters_10016
process[gazebo_gui-3]: started with pid [29315]
process[vehicle_spawn_u18_29262_493413658228928297-4]: started with pid [29327]
INFO  [dataman] data manager file './dataman' size is 11798680 bytes
PX4 SIM HOST: localhost
INFO  [simulator] Waiting for simulator to accept connection on TCP port 4560
[ INFO] [1637503124.117753804]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1637503124.119088726]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[ INFO] [1637503124.156113584]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1637503124.157716086]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting...
[INFO] [1637503124.505685, 0.000000]: Loading model XML from file /home/rajendra/drone_ws/src/.PX4-SITL_gazebo/models/iris/iris.sdf
[INFO] [1637503124.539958, 0.000000]: Waiting for service /gazebo/spawn_sdf_model
[INFO] [1637503124.547998, 0.000000]: Calling service /gazebo/spawn_sdf_model
[ INFO] [1637503124.576524865]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[INFO] [1637503124.659209, 0.000000]: Spawn status: SpawnModel: Successfully spawned entity
[ INFO] [1637503124.664165167, 0.004000000]: Physics dynamic reconfigure ready.
INFO  [simulator] Simulator connected on TCP port 4560.
INFO  [commander] LED: open /dev/led0 failed (22)
INFO  [init] Mixer: etc/mixers/quad_w.main.mix on /dev/pwm_output0
INFO  [init] setting PWM_AUX_OUT none
[vehicle_spawn_u18_29262_493413658228928297-4] process has finished cleanly
log file: /home/rajendra/.ros/log/1c22cf90-4ad3-11ec-9285-7cd30a81f90b/vehicle_spawn_u18_29262_493413658228928297-4*.log
INFO  [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550
INFO  [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540
INFO  [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14280 remote port 14030
INFO  [mavlink] mode: Gimbal, data rate: 400000 B/s on udp port 13030 remote port 13280
INFO  [logger] logger started (mode=all)
INFO  [logger] Start file log (type: full)
INFO  [logger] [logger] ./log/2021-11-21/13_58_44.ulg	
INFO  [logger] Opened full log file: ./log/2021-11-21/13_58_44.ulg
INFO  [mavlink] MAVLink only on localhost (set param MAV_{i}_BROADCAST = 1 to enable network)
INFO  [mavlink] MAVLink only on localhost (set param MAV_{i}_BROADCAST = 1 to enable network)
INFO  [px4] Startup script returned successfully
pxh> INFO  [mavlink] partner IP: 127.0.0.1
INFO  [tone_alarm] home set
INFO  [tone_alarm] notify negative
INFO  [commander] Failsafe mode activated	
INFO  [navigator] RTL HOME activated	
INFO  [commander] Failsafe mode deactivated	
INFO  [commander] Failsafe mode activated	
INFO  [commander] Failsafe mode deactivated	
INFO  [commander] Failsafe mode activated	
INFO  [commander] Failsafe mode deactivated	
INFO  [commander] Failsafe mode activated	
INFO  [commander] Failsafe mode deactivated	
INFO  [commander] Failsafe mode activated	
INFO  [commander] Failsafe mode deactivated	

Terminal 3: rosrun uav_control uav_take_off (above cpp script)

[ INFO] [1637503169.380403414, 44.432000000]: Offboard enabled
[ INFO] [1637503174.440220777, 49.476000000]: Offboard enabled
[ INFO] [1637503179.509351719, 54.528000000]: Offboard enabled ...

Below are my log

Log

rosrun mavros checkid

OK. I got messages from 1:1.

Received 6178 messages, from 1 addresses
sys:comp list of messages
1:1 0, 1, 2, 4, 8, 140, 141, 147, 24, 410, 411, 30, 31, 32, 33, 36, 74, 331, 77, 83, 340, 85, 230, 105, 111, 241, 242, 245

rostopic echo /mavros/state (Before running arm and offboard)

header:
seq: 214
stamp:
secs: 1637502406
nsecs: 8589608
frame_id: ''
connected: True
armed: False
guided: True
manual_input: False
mode: "AUTO.RTL"
system_status: 3

rostopic echo /mavros/state (After running arm and offboard)

header:
seq: 194
stamp:
secs: 1637502385
nsecs: 932277774
frame_id: ''
connected: True
armed: True
guided: True
manual_input: False
mode: "AUTO.RTL"
system_status: 4

rostopic echo -n 1 /diagnostics

header:
seq: 71
stamp:
secs: 1637503198
nsecs: 583693691
frame_id: ''
status:

level: 0
name: "mavros: FCU connection"
message: "connected"
hardware_id: "udp://:14540@127.0.0.1:14557"
values: 
  - 
    key: "Received packets:"
    value: "29609"
  - 
    key: "Dropped packets:"
    value: "0"
  - 
    key: "Buffer overruns:"
    value: "0"
  - 
    key: "Parse errors:"
    value: "0"
  - 
    key: "Rx sequence number:"
    value: "169"
  - 
    key: "Tx sequence number:"
    value: "0"
  - 
    key: "Rx total bytes:"
    value: "1756623"
  - 
    key: "Tx total bytes:"
    value: "96902"
  - 
    key: "Rx speed:"
    value: "36782.000000"
  - 
    key: "Tx speed:"
    value: "2785.000000"
  • level: 0
    name: "mavros: GPS"
    message: "3D fix"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Satellites visible"
    value: "10"
    
    • key: "Fix type"
      value: "3"
    • key: "EPH (m)"
      value: "0.00"
    • key: "EPV (m)"
      value: "0.00"
  • level: 0
    name: "mavros: Heartbeat"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Heartbeats since startup"
    value: "73"
    
    • key: "Frequency (Hz)"
      value: "1.000007"
    • key: "Vehicle type"
      value: "Quadrotor"
    • key: "Autopilot type"
      value: "PX4 Autopilot"
    • key: "Mode"
      value: "AUTO.RTL"
    • key: "System status"
      value: "Standby"
  • level: 0
    name: "mavros: System"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Sensor present"
    value: "0x1028002C"
    
    • key: "Sensor enabled"
      value: "0x1020000C"
    • key: "Sensor health"
      value: "0x102E002F"
    • key: "3D magnetometer"
      value: "Ok"
    • key: "absolute pressure"
      value: "Ok"
    • key: "AHRS subsystem health"
      value: "Ok"
    • key: "pre-arm check status. Always healthy when armed"
      value: "Ok"
    • key: "CPU Load (%)"
      value: "50.0"
    • key: "Drop rate (%)"
      value: "0.0"
    • key: "Errors comm"
      value: "0"
    • key: "Errors count mavconn library. #1"
      value: "0"
    • key: "Errors count Pub/sub for Mavlink.msg #2"
      value: "0"
    • key: "Errors count Plugin loading functionality. #3"
      value: "0"
    • key: "Errors count Diagnostic mesages. #4"
      value: "0"
  • level: 0
    name: "mavros: Battery"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Voltage"
    value: "16.20"
    
    • key: "Current"
      value: "-1.0"
    • key: "Remaining"
      value: "100.0"
  • level: 0
    name: "mavros: Time Sync"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values:

    key: "Timesyncs since startup"
    value: "69"
    
    • key: "Frequency (Hz)"
      value: "10.126501"
    • key: "Last RTT (ms)"
      value: "0.662706"
    • key: "Mean RTT (ms)"
      value: "0.550882"
    • key: "Last remote time (s)"
      value: "73.396000000"
    • key: "Estimated time offset (s)"
      value: "1637503125.175030470"

@iamrajee iamrajee reopened this Nov 21, 2021
@PaulBauer99
Copy link

I am facing the exact same issue in ROS Melodic. Can anybody confirm/refute that this is an issue with the version? Did you get it working in Melodic @iamrajee?

Kind regards

@peterminh227
Copy link

peterminh227 commented Jan 21, 2022

It seems to be a problem with the current firmware version.

  • it works fine with v1.10.2 in ROS Melodic (Ubuntu 18.04)
  • I used the following steps:
cd PX4-Autopilot
sudo git checkout v1.10.2 
git submodule update --init --recursive
cd ..
chmod -R 777 PX4-Autopilot/

Install tools & dependencies

bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
sudo apt install -y ninja-build exiftool python-argparse python-empy python-toml python-numpy python-yaml python-dev python-pip ninja-build protobuf-compiler libeigen3-dev genromfs xmlstarlet libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo pip3 install --user pandas jinja2 pyserial cerberus pyulog numpy toml pyquaternion  

Edit an error in v1.10.2

gedit ./PX4-Autopilot/Tools/sitl_gazebo/include/gazebo_opticalflow_plugin.h

please change as following

#define HAS_GYRO true (make TRUE lowercase).
cd PX4-Autopilot
make px4_sitl_default gazebo

A usefull script to add paths mavros & SITL: launch_common.sh

#!/bin/bash

px4_dir=$(pwd)/../PX4-Autopilot

source $px4_dir/Tools/setup_gazebo.bash $px4_dir $px4_dir/build/px4_sitl_default

export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$px4_dir
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$px4_dir/Tools/sitl_gazebo

and running mavros & SITL

#!/bin/bash

source ./launch-common.sh
# mavros
gnome-terminal -- /bin/sh -c 'roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557";exec bash'
# px4-sitl
gnome-terminal -- /bin/sh -c 'source /home/samurai/shell_script/launch-common.sh;roslaunch px4 posix_sitl.launch;exec bash'

@iamrajee
Copy link
Author

@peterminh227 Thank you sharing your solution :)

@peterminh227
Copy link

@peterminh227 Thank you sharing your solution :)

My pleasure :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants