mavlink / mavros

MAVLink to ROS gateway with proxy for Ground Control Station
Other
902 stars 993 forks source link

Cannot change flight mode on Cube Blue with Ardupilot via MAVROS2 #1972

Open wntun opened 3 months ago

wntun commented 3 months ago

Issue details

Hi, I use the mavros on the jetson and connect the FC via serial. I can see the values coming from the FC. But, I cannot change the flight mode nor arm/disarm. I can do it all on the mission planner. Any suggestions or solutions, please?

taekyung@taekyung-desktop:~/mavros_ws$ ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{base_mode: 0, custom_mode: 4}"
/opt/ros/foxy/bin/ros2:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import load_entry_point
requester: making request: mavros_msgs.srv.SetMode_Request(base_mode=0, custom_mode='4')

response:
mavros_msgs.srv.SetMode_Response(mode_sent=True)

MAVROS version and platform

Mavros: release/foxy/mavlink ROS: foxy Ubuntu: 20.04

Autopilot type and version

[ / ] ArduPilot [ ] PX4

Version: Arducopter 4.5.5

Node logs

xx@xx-desktop:~/mavros_ws$ ros2 launch mavros apm_launch.py 
/opt/ros/foxy/bin/ros2:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import load_entry_point
[INFO] [launch]: All log files can be found below /home/xx/.ros/log/2024-08-06-16-58-12-480804-xx-desktop-91309
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [mavros_node-1]: process started with pid [91311]
[mavros_node-1] [INFO] [1722931092.613923298] [mavros_node]: Starting mavros_node container
[mavros_node-1] [INFO] [1722931092.614140039] [mavros_node]: FCU URL: /dev/ttyTHS0:115200
[mavros_node-1] [INFO] [1722931092.614165160] [mavros_node]: GCS URL: 
[mavros_node-1] [INFO] [1722931092.614181896] [mavros_node]: UAS Prefix: /uas1
[mavros_node-1] [INFO] [1722931092.614194473] [mavros_node]: Starting mavros router node
[mavros_node-1] [INFO] [1722931092.621865530] [mavros_router]: Built-in SIMD instructions: ARM NEON
[mavros_node-1] [INFO] [1722931092.621951612] [mavros_router]: Built-in MAVLink package version: 2022.12.30
[mavros_node-1] [INFO] [1722931092.621973532] [mavros_router]: Known MAVLink dialects: common ardupilotmega ASLUAV AVSSUAS all cubepilot development icarous matrixpilot paparazzi standard storm32 uAvionix ualberta
[mavros_node-1] [INFO] [1722931092.621988157] [mavros_router]: MAVROS Router started
[mavros_node-1] [INFO] [1722931092.622271171] [mavros_router]: Requested to add endpoint: type: 0, url: /dev/ttyTHS0:115200
[mavros_node-1] [INFO] [1722931092.622893169] [mavros_router]: Endpoint link[1000] created
[mavros_node-1] [INFO] [1722931092.627004944] [mavros_router]: link[1000] opened successfully
[mavros_node-1] [INFO] [1722931092.627289687] [mavros_router]: Requested to add endpoint: type: 2, url: /uas1
[mavros_node-1] [INFO] [1722931092.627545245] [mavros_router]: Endpoint link[1001] created
[mavros_node-1] [INFO] [1722931092.630140889] [mavros_router]: link[1001] opened successfully
[mavros_node-1] [INFO] [1722931092.630289628] [mavros_node]: Starting mavros uas node
[mavros_node-1] [INFO] [1722931092.664446193] [mavros_router]: link[1000] detected remote address 1.1
[mavros_node-1] [INFO] [1722931092.695329371] [mavros]: UAS Executor started, threads: 4
[mavros_node-1] [INFO] [1722931092.695604833] [mavros]: Plugin actuator_control ignored
[mavros_node-1] [INFO] [1722931092.736040583] [mavros]: Plugin adsb created
[mavros_node-1] [INFO] [1722931092.736962364] [mavros]: Plugin adsb initialized
[mavros_node-1] [INFO] [1722931092.737028638] [mavros]: Plugin altitude ignored
[mavros_node-1] [INFO] [1722931092.737064895] [mavros]: Plugin cam_imu_sync ignored
[mavros_node-1] [INFO] [1722931092.737094623] [mavros]: Plugin camera ignored
[mavros_node-1] [INFO] [1722931092.737119808] [mavros]: Plugin cellular_status ignored
[mavros_node-1] [INFO] [1722931092.781798696] [mavros]: Plugin command created
[mavros_node-1] [INFO] [1722931092.782334836] [mavros]: Plugin command initialized
[mavros_node-1] [INFO] [1722931092.790674005] [mavros]: Plugin companion_process_status created
[mavros_node-1] [INFO] [1722931092.790820504] [mavros]: Plugin companion_process_status initialized
[mavros_node-1] [INFO] [1722931092.803254904] [mavros]: Plugin debug_value created
[mavros_node-1] [INFO] [1722931092.804295600] [mavros]: Plugin debug_value initialized
[mavros_node-1] [INFO] [1722931092.804366225] [mavros]: Plugin distance_sensor ignored
[mavros_node-1] [INFO] [1722931092.804401234] [mavros]: Plugin esc_status ignored
[mavros_node-1] [INFO] [1722931092.804429203] [mavros]: Plugin esc_telemetry ignored
[mavros_node-1] [INFO] [1722931092.819101670] [mavros]: Plugin fake_gps created
[mavros_node-1] [INFO] [1722931092.819250729] [mavros]: Plugin fake_gps initialized
[mavros_node-1] [INFO] [1722931092.819309931] [mavros]: Plugin ftp ignored
[mavros_node-1] [INFO] [1722931092.819345899] [mavros]: Plugin geofence ignored
[mavros_node-1] [INFO] [1722931092.842315454] [mavros]: Plugin global_position created
[mavros_node-1] [INFO] [1722931092.843378359] [mavros]: Plugin global_position initialized
[mavros_node-1] [INFO] [1722931092.853427551] [mavros]: Plugin gps_input created
[mavros_node-1] [INFO] [1722931092.853574978] [mavros]: Plugin gps_input initialized
[mavros_node-1] [INFO] [1722931092.864242905] [mavros]: Plugin gps_rtk created
[mavros_node-1] [INFO] [1722931092.864719364] [mavros]: Plugin gps_rtk initialized
[mavros_node-1] [INFO] [1722931092.875467164] [mavros]: Plugin gps_status created
[mavros_node-1] [INFO] [1722931092.876492403] [mavros]: Plugin gps_status initialized
[mavros_node-1] [INFO] [1722931092.876577269] [mavros]: Plugin guided_target ignored
[mavros_node-1] [INFO] [1722931092.876606774] [mavros]: Plugin hil ignored
[mavros_node-1] [INFO] [1722931092.888963764] [mavros]: Plugin home_position created
[mavros_node-1] [INFO] [1722931092.889535073] [mavros]: Plugin home_position initialized
[mavros_node-1] [INFO] [1722931092.905563987] [mavros]: Plugin imu created
[mavros_node-1] [INFO] [1722931092.906671917] [mavros]: Plugin imu initialized
[mavros_node-1] [INFO] [1722931092.924372613] [mavros]: Plugin landing_target created
[mavros_node-1] [INFO] [1722931092.924876721] [mavros]: Plugin landing_target initialized
[mavros_node-1] [INFO] [1722931092.941218507] [mavros]: Plugin local_position created
[mavros_node-1] [INFO] [1722931092.941855833] [mavros]: Plugin local_position initialized
[mavros_node-1] [INFO] [1722931092.959677813] [mavros]: Plugin log_transfer created
[mavros_node-1] [INFO] [1722931092.960313764] [mavros]: Plugin log_transfer initialized
[mavros_node-1] [INFO] [1722931092.960386341] [mavros]: Plugin mag_calibration_status ignored
[mavros_node-1] [INFO] [1722931092.972832357] [mavros]: Plugin manual_control created
[mavros_node-1] [INFO] [1722931092.973265711] [mavros]: Plugin manual_control initialized
[mavros_node-1] [INFO] [1722931092.985442632] [mavros]: Plugin mocap_pose_estimate created
[mavros_node-1] [INFO] [1722931092.985595084] [mavros]: Plugin mocap_pose_estimate initialized
[mavros_node-1] [INFO] [1722931093.003066879] [mavros]: Plugin mount_control created
[mavros_node-1] [INFO] [1722931093.003717550] [mavros]: Plugin mount_control initialized
[mavros_node-1] [INFO] [1722931093.015928776] [mavros]: Plugin nav_controller_output created
[mavros_node-1] [INFO] [1722931093.016465973] [mavros]: Plugin nav_controller_output initialized
[mavros_node-1] [INFO] [1722931093.030133969] [mavros]: Plugin obstacle_distance created
[mavros_node-1] [INFO] [1722931093.030270836] [mavros]: Plugin obstacle_distance initialized
[mavros_node-1] [INFO] [1722931093.045174348] [mavros]: Plugin odometry created
[mavros_node-1] [INFO] [1722931093.045768442] [mavros]: Plugin odometry initialized
[mavros_node-1] [INFO] [1722931093.062774083] [mavros]: Plugin onboard_computer_status created
[mavros_node-1] [INFO] [1722931093.062916454] [mavros]: Plugin onboard_computer_status initialized
[mavros_node-1] [INFO] [1722931093.085171240] [mavros]: Plugin param created
[mavros_node-1] [INFO] [1722931093.085674804] [mavros]: Plugin param initialized
[mavros_node-1] [INFO] [1722931093.085750230] [mavros]: Plugin play_tune ignored
[mavros_node-1] [INFO] [1722931093.085780982] [mavros]: Plugin px4flow ignored
[mavros_node-1] [INFO] [1722931093.107535501] [mavros]: Plugin rallypoint created
[mavros_node-1] [INFO] [1722931093.108708872] [mavros]: Plugin rallypoint initialized
[mavros_node-1] [INFO] [1722931093.123940072] [mavros]: Plugin rangefinder created
[mavros_node-1] [INFO] [1722931093.124444852] [mavros]: Plugin rangefinder initialized
[mavros_node-1] [INFO] [1722931093.124510197] [mavros]: Plugin rc_io ignored
[mavros_node-1] [INFO] [1722931093.139544849] [mavros]: Plugin setpoint_accel created
[mavros_node-1] [INFO] [1722931093.139686708] [mavros]: Plugin setpoint_accel initialized
[mavros_node-1] [INFO] [1722931093.162505635] [mavros]: Plugin setpoint_attitude created
[mavros_node-1] [INFO] [1722931093.162644870] [mavros]: Plugin setpoint_attitude initialized
[mavros_node-1] [INFO] [1722931093.186563695] [mavros]: Plugin setpoint_position created
[mavros_node-1] [INFO] [1722931093.187981168] [mavros]: Plugin setpoint_position initialized
[mavros_node-1] [INFO] [1722931093.213042707] [mavros]: Plugin setpoint_raw created
[mavros_node-1] [INFO] [1722931093.213853541] [mavros]: Plugin setpoint_raw initialized
[mavros_node-1] [INFO] [1722931093.235249204] [mavros]: Plugin setpoint_trajectory created
[mavros_node-1] [INFO] [1722931093.235402167] [mavros]: Plugin setpoint_trajectory initialized
[mavros_node-1] [INFO] [1722931093.256232024] [mavros]: Plugin setpoint_velocity created
[mavros_node-1] [INFO] [1722931093.256370044] [mavros]: Plugin setpoint_velocity initialized
[mavros_node-1] [INFO] [1722931093.292218296] [mavros]: Plugin sys_status created
[mavros_node-1] [INFO] [1722931093.293830749] [mavros]: Plugin sys_status initialized
[mavros_node-1] [INFO] [1722931093.311075436] [mavros.time]: TM: Timesync mode: MAVLINK
[mavros_node-1] [INFO] [1722931093.321586782] [mavros]: Plugin sys_time created
[mavros_node-1] [INFO] [1722931093.322261934] [mavros]: Plugin sys_time initialized
[mavros_node-1] [INFO] [1722931093.341664430] [mavros]: Plugin tdr_radio created
[mavros_node-1] [INFO] [1722931093.342401951] [mavros]: Plugin tdr_radio initialized
[mavros_node-1] [INFO] [1722931093.342482849] [mavros]: Plugin terrain ignored
[mavros_node-1] [INFO] [1722931093.368872035] [mavros]: Plugin trajectory created
[mavros_node-1] [INFO] [1722931093.369356366] [mavros]: Plugin trajectory initialized
[mavros_node-1] [INFO] [1722931093.394754233] [mavros]: Plugin tunnel created
[mavros_node-1] [INFO] [1722931093.395242372] [mavros]: Plugin tunnel initialized
[mavros_node-1] [INFO] [1722931093.395323462] [mavros]: Plugin vfr_hud ignored
[mavros_node-1] [INFO] [1722931093.395356423] [mavros]: Plugin vibration ignored
[mavros_node-1] [INFO] [1722931093.395382375] [mavros]: Plugin vision_pose ignored
[mavros_node-1] [INFO] [1722931093.395405128] [mavros]: Plugin vision_speed ignored
[mavros_node-1] [INFO] [1722931093.395427080] [mavros]: Plugin waypoint ignored
[mavros_node-1] [INFO] [1722931093.395446761] [mavros]: Plugin wheel_odomotry ignored
[mavros_node-1] [INFO] [1722931093.395469833] [mavros]: Plugin wind_estimation ignored
[mavros_node-1] [INFO] [1722931093.398757941] [mavros]: Built-in SIMD instructions: ARM NEON
[mavros_node-1] [INFO] [1722931093.398826711] [mavros]: Built-in MAVLink package version: 2022.12.30
[mavros_node-1] [INFO] [1722931093.398956858] [mavros]: Known MAVLink dialects: common ardupilotmega ASLUAV AVSSUAS all cubepilot development icarous matrixpilot paparazzi standard storm32 uAvionix ualberta
[mavros_node-1] [INFO] [1722931093.398984283] [mavros]: MAVROS UAS via /uas1 started. MY ID 1.191, TARGET ID 1.1
[mavros_node-1] [WARN] [1722931093.411117907] [mavros.global_position]: GP: No GPS fix
[mavros_node-1] [INFO] [1722931093.412825754] [mavros.imu]: IMU: Raw IMU message used.
[mavros_node-1] [WARN] [1722931093.413153794] [mavros.imu]: IMU: linear acceleration on RAW_IMU known on APM only.
[mavros_node-1] [WARN] [1722931093.413203331] [mavros.imu]: IMU: ~imu/data_raw stores unscaled raw acceleration report.
[mavros_node-1] [WARN] [1722931093.414520482] [mavros.time]: TM: Wrong FCU time.
[mavros_node-1] [INFO] [1722931093.731824645] [mavros]: CON: Got HEARTBEAT, connected. FCU: ArduPilot
[mavros_node-1] [INFO] [1722931093.902931894] [mavros.imu]: IMU: Raw IMU message used.
[mavros_node-1] [INFO] [1722931094.274667652] [mavros_router]: link[1001] detected remote address 1.191

Diagnostics

xx@xx-desktop:~/ardupilot$ ros2 topic echo /diagnostics 
/opt/ros/foxy/bin/ros2:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import load_entry_point
header:
  stamp:
    sec: 1722931245
    nanosec: 463626517
  frame_id: ''
status:
- level: "\0"
  name: 'mavros_router: MAVROS Router'
  message: ok
  hardware_id: none
  values:
  - key: Endpoints
    value: '2'
  - key: Messages routed
    value: '13477'
  - key: Messages sent
    value: '13477'
  - key: Messages dropped
    value: '0'
- level: "\0"
  name: 'mavros_router: endpoint 1000: /dev/ttyTHS0:115200'
  message: ok
  hardware_id: none
  values:
  - key: Received packets
    value: '13301'
  - key: Dropped packets
    value: '0'
  - key: Buffer overruns
    value: '0'
  - key: Parse errors
    value: '0'
  - key: Rx sequence number
    value: '92'
  - key: Tx sequence number
    value: '0'
  - key: Rx total bytes
    value: '399323'
  - key: Tx total bytes
    value: '3945'
  - key: Rx speed
    value: '3873.000000'
  - key: Tx speed
    value: '21.000000'
  - key: Remotes count
    value: '3'
  - key: Remote [0]
    value: '0.0'
  - key: Remote [1]
    value: '1.0'
  - key: Remote [2]
    value: '1.1'
- level: "\0"
  name: 'mavros_router: endpoint 1001: /uas1'
  message: ok
  hardware_id: none
  values:
  - key: Remotes count
    value: '3'
  - key: Remote [0]
    value: '0.0'
  - key: Remote [1]
    value: '1.0'
  - key: Remote [2]
    value: '1.191'

Check ID

xx@xx-desktop:~/mavros_ws$ ros2 run mavros mav checkid
/opt/ros/foxy/bin/ros2:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import load_entry_point
Router topic: /uas1/mavlink_source, target: 1.1
OK. I got messages from 1.1.
---
Received 1937, from 1 addresses
address   list of messages
    1.1   0 (HEARTBEAT), 1 (SYS_STATUS), 129 (SCALED_IMU3), 2 (SYSTEM_TIME), 136 (TERRAIN_REPORT), 137 (SCALED_PRESSURE2), 24 (GPS_RAW_INT), 152, 27 (RAW_IMU), 29 (SCALED_PRESSURE), 30 (ATTITUDE), 11039, 33 (GLOBAL_POSITION_INT), 163, 36 (SERVO_OUTPUT_RAW), 42 (MISSION_CURRENT), 178, 62 (NAV_CONTROLLER_OUTPUT), 65 (RC_CHANNELS), 193, 74 (VFR_HUD), 111 (TIMESYNC), 241 (VIBRATION), 116 (SCALED_IMU2), 125 (POWER_STATUS)
wntun commented 3 months ago

I tried with Pixhawk6C. It has no problems. I don't know what to do with the Cube Blue.

vooon commented 3 months ago

Hello,

Have you tried other commands? I do not see firmware version report in the log, so i suspect that there may be problem on OBC -> FCU path. Have you checked that OBC Tx -> FC Rx have no issues?

wntun commented 3 months ago

Hi, @vooon .. I don't think there is problems in the cable. I used the same cable for the Pixhawk6C, and it has no issues in sending/receiving data. Right now, for the Cube Blue, the USB line works.

vooon commented 3 months ago

I'm not sure, but maybe the port you use configured in telemetry-out mode only? Don't remember exact params and values. But i remember that there were different modes of operation for mavlink app on the PX4 side.

wntun commented 3 months ago

@vooon .. hi, thanks for the suggestions. I'm using the arducopter. I modified the sr2_xxx variables, according to the sr0_xxx variables. Before that, I can't even see the incoming data from the FC. I can't find anything else yet. Please let me know if you remember anything.