Open zhangshuaiqing opened 1 month ago
I want to connect PixHawk and Xavier NX through the serial port and send data through MavLink.
Now I have a problem. I connect the PixHawk's serial port Telem2 to the Xavier NX's pin8, pin9, and pin10.
Then, I used QGC to set the parameters of PixHawk as shown in the figure below.
I have installed ROS and MAVROS on Xavier NX.
I modified the parameter fcu_url in px4.launch.
Then, the script px4.launch was executed.
Check the connection results through the commands rostopic echo /mavros/state and rostopic echo /diagnostics.
It seems the results were unsatisfactory.
Below is the detailed process.
I set the parameters of PixHawk on QGC as followed
The result of command mavlink status run on QGC
mavlink status
Then I run command roslaunch mavros px4.launch
roslaunch mavros px4.launch
drone@ubuntu:/opt/ros/noetic/share/mavros/launch$ roslaunch mavros px4.launch ... logging to /home/drone/.ros/log/8fb350cc-0c5c-11ef-b0e4-fae180623635/roslaunch-ubuntu-4260.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://ubuntu:35051/ SUMMARY ======== CLEAR PARAMETERS * /mavros/ PARAMETERS * /mavros/camera/frame_id: base_link * /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: /dev/ttyTHS0:921600 * /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/mount/debounce_s: 4.0 * /mavros/mount/err_threshold_deg: 10.0 * /mavros/mount/negate_measured_pitch: False * /mavros/mount/negate_measured_roll: False * /mavros/mount/negate_measured_yaw: 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: False * /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.16.0 NODES / mavros (mavros/mavros_node) auto-starting new master process[master]: started with pid [4271] ROS_MASTER_URI=http://localhost:11311 setting /run_id to 8fb350cc-0c5c-11ef-b0e4-fae180623635 process[rosout-1]: started with pid [4284] started core service [/rosout] process[mavros-2]: started with pid [4292] [ INFO] [1715077718.313899932]: FCU URL: /dev/ttyTHS0:921600 [ INFO] [1715077718.321205043]: serial0: device: /dev/ttyTHS0 @ 921600 bps [ INFO] [1715077718.322725804]: GCS bridge disabled [ INFO] [1715077718.358468420]: Plugin 3dr_radio loaded [ INFO] [1715077718.365511858]: Plugin 3dr_radio initialized [ INFO] [1715077718.365828278]: Plugin actuator_control loaded [ INFO] [1715077718.373207750]: Plugin actuator_control initialized [ INFO] [1715077718.388633259]: Plugin adsb loaded [ INFO] [1715077718.397428158]: Plugin adsb initialized [ INFO] [1715077718.397873302]: Plugin altitude loaded [ INFO] [1715077718.400644288]: Plugin altitude initialized [ INFO] [1715077718.401042717]: Plugin cam_imu_sync loaded [ INFO] [1715077718.402875450]: Plugin cam_imu_sync initialized [ INFO] [1715077718.403222939]: Plugin camera loaded [ INFO] [1715077718.405065015]: Plugin camera initialized [ INFO] [1715077718.405403609]: Plugin cellular_status loaded [ INFO] [1715077718.411498779]: Plugin cellular_status initialized [ INFO] [1715077718.411884057]: Plugin command loaded [ INFO] [1715077718.427356442]: Plugin command initialized [ INFO] [1715077718.427746808]: Plugin companion_process_status loaded [ INFO] [1715077718.433773472]: Plugin companion_process_status initialized [ INFO] [1715077718.434106243]: Plugin debug_value loaded [ INFO] [1715077718.447005032]: Plugin debug_value initialized [ INFO] [1715077718.447138780]: Plugin distance_sensor blacklisted [ INFO] [1715077718.447496765]: Plugin esc_status loaded [ INFO] [1715077718.450456086]: Plugin esc_status initialized [ INFO] [1715077718.450831380]: Plugin esc_telemetry loaded [ INFO] [1715077718.452617302]: Plugin esc_telemetry initialized [ INFO] [1715077718.453150278]: Plugin fake_gps loaded [ INFO] [1715077718.488413609]: Plugin fake_gps initialized [ INFO] [1715077718.488885279]: Plugin ftp loaded [ INFO] [1715077718.504037020]: Plugin ftp initialized [ INFO] [1715077718.504514514]: Plugin geofence loaded [ INFO] [1715077718.512158859]: Plugin geofence initialized [ INFO] [1715077718.512678972]: Plugin global_position loaded [ INFO] [1715077718.549224397]: Plugin global_position initialized [ INFO] [1715077718.549731488]: Plugin gps_input loaded [ INFO] [1715077718.556256828]: Plugin gps_input initialized [ INFO] [1715077718.556622651]: Plugin gps_rtk loaded [ INFO] [1715077718.563508344]: Plugin gps_rtk initialized [ INFO] [1715077718.563919603]: Plugin gps_status loaded [ INFO] [1715077718.569406155]: Plugin gps_status initialized [ INFO] [1715077718.569747021]: Plugin guided_target loaded [ INFO] [1715077718.579822702]: Plugin guided_target initialized [ INFO] [1715077718.580194797]: Plugin hil loaded [ INFO] [1715077718.608790144]: Plugin hil initialized [ INFO] [1715077718.609509024]: Plugin home_position loaded [ INFO] [1715077718.617699144]: Plugin home_position initialized [ INFO] [1715077718.618144129]: Plugin imu loaded [ INFO] [1715077718.635126139]: Plugin imu initialized [ INFO] [1715077718.635609137]: Plugin landing_target loaded [ INFO] [1715077718.669705307]: Plugin landing_target initialized [ INFO] [1715077718.670165170]: Plugin local_position loaded [ INFO] [1715077718.690487556]: Plugin local_position initialized [ INFO] [1715077718.690953531]: Plugin log_transfer loaded [ INFO] [1715077718.698942357]: Plugin log_transfer initialized [ INFO] [1715077718.699409131]: Plugin mag_calibration_status loaded [ INFO] [1715077718.702536245]: Plugin mag_calibration_status initialized [ INFO] [1715077718.703024362]: Plugin manual_control loaded [ INFO] [1715077718.710420089]: Plugin manual_control initialized [ INFO] [1715077718.710860306]: Plugin mocap_pose_estimate loaded [ INFO] [1715077718.719899886]: Plugin mocap_pose_estimate initialized [ INFO] [1715077718.720388515]: Plugin mount_control loaded [ WARN] [1715077718.732624036]: Could not retrive negate_measured_roll parameter value, using default (0) [ WARN] [1715077718.733710979]: Could not retrive negate_measured_pitch parameter value, using default (0) [ WARN] [1715077718.734627986]: Could not retrive negate_measured_yaw parameter value, using default (0) [ WARN] [1715077718.737983559]: Could not retrive debounce_s parameter value, using default (4.000000) [ WARN] [1715077718.738911093]: Could not retrive err_threshold_deg parameter value, using default (10.000000) [ INFO] [1715077718.739401481]: Plugin mount_control initialized [ INFO] [1715077718.739895389]: Plugin nav_controller_output loaded [ INFO] [1715077718.741675551]: Plugin nav_controller_output initialized [ INFO] [1715077718.742192273]: Plugin obstacle_distance loaded [ INFO] [1715077718.748732684]: Plugin obstacle_distance initialized [ INFO] [1715077718.749116682]: Plugin odom loaded [ INFO] [1715077718.759636323]: Plugin odom initialized [ INFO] [1715077718.760054494]: Plugin onboard_computer_status loaded [ INFO] [1715077718.765769602]: Plugin onboard_computer_status initialized [ INFO] [1715077718.766161119]: Plugin param loaded [ INFO] [1715077718.772622465]: Plugin param initialized [ INFO] [1715077718.773039900]: Plugin play_tune loaded [ INFO] [1715077718.778796541]: Plugin play_tune initialized [ INFO] [1715077718.779245365]: Plugin px4flow loaded [ INFO] [1715077718.794797871]: Plugin px4flow initialized [ INFO] [1715077718.795302498]: Plugin rallypoint loaded [ INFO] [1715077718.802347600]: Plugin rallypoint initialized [ INFO] [1715077718.802538399]: Plugin rangefinder blacklisted [ INFO] [1715077718.803139977]: Plugin rc_io loaded [ INFO] [1715077718.811331058]: Plugin rc_io initialized [ INFO] [1715077718.811517089]: Plugin safety_area blacklisted [ INFO] [1715077718.811894911]: Plugin setpoint_accel loaded [ INFO] [1715077718.819227668]: Plugin setpoint_accel initialized [ INFO] [1715077718.819698282]: Plugin setpoint_attitude loaded [ INFO] [1715077718.840659939]: Plugin setpoint_attitude initialized [ INFO] [1715077718.841111483]: Plugin setpoint_position loaded [ INFO] [1715077718.877130554]: Plugin setpoint_position initialized [ INFO] [1715077718.877676618]: Plugin setpoint_raw loaded [ INFO] [1715077718.897880967]: Plugin setpoint_raw initialized [ INFO] [1715077718.898351773]: Plugin setpoint_trajectory loaded [ INFO] [1715077718.909572824]: Plugin setpoint_trajectory initialized [ INFO] [1715077718.910070027]: Plugin setpoint_velocity loaded [ INFO] [1715077718.922982448]: Plugin setpoint_velocity initialized [ INFO] [1715077718.923613016]: Plugin sys_status loaded [ INFO] [1715077718.948696483]: Plugin sys_status initialized [ INFO] [1715077718.949211797]: Plugin sys_time loaded [ INFO] [1715077718.961881359]: TM: Timesync mode: MAVLINK [ INFO] [1715077718.962918835]: TM: Not publishing sim time [ INFO] [1715077718.966265930]: Plugin sys_time initialized [ INFO] [1715077718.966738208]: Plugin terrain loaded [ INFO] [1715077718.968290614]: Plugin terrain initialized [ INFO] [1715077718.968634679]: Plugin trajectory loaded [ INFO] [1715077718.981010987]: Plugin trajectory initialized [ INFO] [1715077718.981559835]: Plugin tunnel loaded [ INFO] [1715077718.988759323]: Plugin tunnel initialized [ INFO] [1715077718.989207891]: Plugin vfr_hud loaded [ INFO] [1715077718.991604510]: Plugin vfr_hud initialized [ INFO] [1715077718.991743666]: Plugin vibration blacklisted [ INFO] [1715077718.992058614]: Plugin vision_pose_estimate loaded [ INFO] [1715077719.009431214]: Plugin vision_pose_estimate initialized [ INFO] [1715077719.009872103]: Plugin vision_speed_estimate loaded [ INFO] [1715077719.019461491]: Plugin vision_speed_estimate initialized [ INFO] [1715077719.020016705]: Plugin waypoint loaded [ INFO] [1715077719.031230237]: Plugin waypoint initialized [ INFO] [1715077719.031450953]: Plugin wheel_odometry blacklisted [ INFO] [1715077719.031868420]: Plugin wind_estimation loaded [ INFO] [1715077719.033880945]: Plugin wind_estimation initialized [ INFO] [1715077719.034522200]: Built-in SIMD instructions: ARM NEON [ INFO] [1715077719.034687850]: Built-in MAVLink package version: 2024.3.3 [ INFO] [1715077719.034858395]: Known MAVLink dialects: common ardupilotmega ASLUAV AVSSUAS all csAirLink cubepilot development icarous matrixpilot paparazzi standard storm32 uAvionix ualberta [ INFO] [1715077719.034967377]: MAVROS started. MY ID 1.240, TARGET ID 1.1 ^C[mavros-2] killing on exit [rosout-1] killing on exit [master] killing on exit
The output of rostopic echo /mavros/state
rostopic echo /mavros/state
$ rostopic echo /mavros/state header: seq: 0 stamp: secs: 1715077718 nsecs: 948575246 frame_id: '' connected: False armed: False guided: False manual_input: False mode: '' system_status: 0 ---
The output rostopic echo /diagnostics
rostopic echo /diagnostics
--- header: seq: 88 stamp: secs: 1715077830 nsecs: 535588294 frame_id: '' status: - level: 1 name: "mavros: FCU connection" message: "not connected" hardware_id: "/dev/ttyTHS0:921600" values: - key: "Received packets:" value: "0" - key: "Dropped packets:" value: "0" - key: "Buffer overruns:" value: "0" - key: "Parse errors:" value: "0" - key: "Rx sequence number:" value: "0" - key: "Tx sequence number:" value: "0" - key: "Rx total bytes:" value: "0" - key: "Tx total bytes:" value: "35660" - key: "Rx speed:" value: "0.000000" - key: "Tx speed:" value: "460.000000" - level: 2 name: "mavros: GPS" message: "No satellites" hardware_id: "/dev/ttyTHS0:921600" values: - key: "Satellites visible" value: "0" - key: "Fix type" value: "0" - key: "EPH (m)" value: "Unknown" - key: "EPV (m)" value: "Unknown" - level: 1 name: "mavros: Mount" message: "Can not diagnose in this targeting mode" hardware_id: "/dev/ttyTHS0:921600" values: - key: "Mode" value: "255" - level: 2 name: "mavros: Heartbeat" message: "No events recorded." hardware_id: "/dev/ttyTHS0:921600" values: - key: "Heartbeats since startup" value: "0" - key: "Frequency (Hz)" value: "0.000000" - key: "Vehicle type" value: "Generic micro air vehicle" - key: "Autopilot type" value: "Generic autopilot" - key: "Mode" value: '' - key: "System status" value: "Uninit" - level: 0 name: "mavros: System" message: "Normal" hardware_id: "/dev/ttyTHS0:921600" values: - key: "Sensor present" value: "0x00000000" - key: "Sensor enabled" value: "0x00000000" - key: "Sensor health" value: "0x00000000" - key: "CPU Load (%)" value: "0.0" - key: "Drop rate (%)" value: "0.0" - key: "Errors comm" value: "0" - key: "Errors count #1" value: "0" - key: "Errors count #2" value: "0" - key: "Errors count #3" value: "0" - key: "Errors count #4" value: "0" - level: 2 name: "mavros: Battery" message: "No data" hardware_id: "/dev/ttyTHS0:921600" values: - key: "Voltage" value: "-1.00" - key: "Current" value: "0.0" - key: "Remaining" value: "0.0" - level: 2 name: "mavros: Time Sync" message: "No events recorded." hardware_id: "/dev/ttyTHS0:921600" values: - key: "Timesyncs since startup" value: "0" - key: "Frequency (Hz)" value: "0.000000" - key: "Last RTT (ms)" value: "0.000000" - key: "Mean RTT (ms)" value: "0.000000" - key: "Last remote time (s)" value: "0.000000000" - key: "Estimated time offset (s)" value: "0.000000000" ---
I would really like to achieve onboard control of PixHawk by Xavier NX via MAVROS. I am new in PixHawk, ROS, MAVROS. Please help me solve this problem. Thank you very much.
I want to connect PixHawk and Xavier NX through the serial port and send data through MavLink.
Now I have a problem. I connect the PixHawk's serial port Telem2 to the Xavier NX's pin8, pin9, and pin10.
Then, I used QGC to set the parameters of PixHawk as shown in the figure below.
I have installed ROS and MAVROS on Xavier NX.
I modified the parameter fcu_url in px4.launch.
Then, the script px4.launch was executed.
Check the connection results through the commands rostopic echo /mavros/state and rostopic echo /diagnostics.
It seems the results were unsatisfactory.
Below is the detailed process.
I set the parameters of PixHawk on QGC as followed
![Screenshot from 2024-05-07 18-49-06](https://github.com/mavlink/mavros/assets/65482805/af8590f6-d51b-4e14-a8ef-7be13e8d9979)
The result of command![Screenshot from 2024-05-07 10-43-28](https://github.com/mavlink/mavros/assets/65482805/0d9ff726-a926-4170-b7f4-31572f26be0f)
mavlink status
run on QGCThen I run command
roslaunch mavros px4.launch
The output of
rostopic echo /mavros/state
The output
rostopic echo /diagnostics
I would really like to achieve onboard control of PixHawk by Xavier NX via MAVROS. I am new in PixHawk, ROS, MAVROS. Please help me solve this problem. Thank you very much.