PX4 / micrortps_agent

microRTPS agent side of the microRTPS bridge. Used to interface PX4 with the DDS world through FastRTPS/FastDDS.
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

micrortps_agent stuck forever flushing UART #1

Open dsix-ls2n opened 3 years ago

dsix-ls2n commented 3 years ago

Describe the bug Using microRTPS agent with PX4 and a RaspberryPI4 connected via serial port The flushing operation at the start of the micrortps_agent might last forever if messages are received faster than the flushing operation (a pose of 1 ms has been set between each flush). Serial bandwidth was set to 921600.

To Reproduce Steps to reproduce the behavior:

  1. microRTPS client started on PX4 (-b 921600)
  2. microRTPS agent started on Raspberry PI 4 'micrortps_agent -b 921600 -d /dev/ttyS0' It probably depends a lot on the hardware setup.

Expected behavior The flush shouldn't loop forever. I have no idea of the best approach to solve the issue. With printing debug, I was able to be ensured that the code remains stuck in the flushing loop (see microRTPS_transport.cpp, from line 374). There is nothing to prevent flushing forever if you still receive messages at high rate.

**Additional context*** Messages exchanged in the RTPS bridge

rtps:
  - msg: actuator_armed
    id: 0
  - msg: actuator_controls
    id: 1
    send: true
  - msg: actuator_outputs
    id: 3
  - msg: adc_report
    id: 4
  - msg: airspeed
    id: 5
  - msg: battery_status
    id: 6
  - msg: camera_capture
    id: 7
  - msg: camera_trigger
    id: 8
  - msg: collision_report
    id: 9
  - msg: commander_state
    id: 10
  - msg: cpuload
    id: 11
  - msg: debug_array
    id: 12
  - msg: debug_key_value
    id: 13
  - msg: debug_value
    id: 14
  - msg: debug_vect
    id: 15
  - msg: differential_pressure
    id: 16
  - msg: distance_sensor
    id: 17
  - msg: estimator_innovations
    id: 18
  - msg: ekf2_timestamps
    id: 19
  - msg: ekf_gps_drift
    id: 20
  - msg: sensor_gps
    id: 21
  - msg: esc_report
    id: 22
    send: true
  - msg: esc_status
    id: 23
    send: true
  - msg: estimator_status
    id: 24
  - msg: follow_target
    id: 25
  - msg: geofence_result
    id: 26
  - msg: gps_dump
    id: 27
  - msg: gps_inject_data
    id: 28
  - msg: home_position
    id: 29
  - msg: input_rc
    id: 30
  - msg: iridiumsbd_status
    id: 31
  - msg: irlock_report
    id: 32
  - msg: landing_target_innovations
    id: 33
  - msg: landing_target_pose
    id: 34
  - msg: led_control
    id: 35
  - msg: log_message
    id: 36
  - msg: manual_control_setpoint
    id: 37
  - msg: mavlink_log
    id: 38
  - msg: mission
    id: 39
  - msg: mission_result
    id: 40
  - msg: mount_orientation
    id: 41
  - msg: multirotor_motor_limits
    id: 42
  - msg: obstacle_distance
    id: 43
  - msg: offboard_control_mode
    id: 44
    receive: true
  - msg: optical_flow
    id: 45
  - msg: parameter_update
    id: 46
  - msg: ping
    id: 47
  - msg: position_controller_landing_status
    id: 48
  - msg: position_controller_status
    id: 49
  - msg: position_setpoint
    id: 50
  - msg: position_setpoint_triplet
    id: 51
  - msg: power_button_state
    id: 52
  - msg: pwm_input
    id: 53
  - msg: qshell_req
    id: 54
  - msg: qshell_retval
    id: 55
  - msg: radio_status
    id: 56
  - msg: rate_ctrl_status
    id: 57
  - msg: rc_channels
    id: 58
  - msg: rc_parameter_map
    id: 59
  - msg: safety
    id: 60
  - msg: satellite_info
    id: 61
  - msg: sensor_accel
    id: 62
  - msg: sensor_baro
    id: 63
  - msg: estimator_sensor_bias
    id: 64
  - msg: sensor_combined
    id: 65
  - msg: sensor_correction
    id: 66
  - msg: sensor_gyro
    id: 67
  - msg: sensor_mag
    id: 68
  - msg: sensors_status_imu
    id: 69
  - msg: sensor_selection
    id: 70
  - msg: px4io_status
    id: 71
  - msg: system_power
    id: 73
  - msg: task_stack_info
    id: 74
  - msg: tecs_status
    id: 75
  - msg: telemetry_status
    id: 76
  - msg: test_motor
    id: 77
  - msg: timesync
    id: 78
    send: true
    receive: true
  - msg: trajectory_waypoint
    id: 79
  - msg: transponder_report
    id: 80
  - msg: tune_control
    id: 81
  - msg: uavcan_parameter_request
    id: 82
  - msg: uavcan_parameter_value
    id: 83
  - msg: ulog_stream
    id: 84
  - msg: ulog_stream_ack
    id: 85
  - msg: vehicle_air_data
    id: 86
  - msg: vehicle_attitude
    id: 87
  - msg: vehicle_attitude_setpoint
    id: 88
    receive: true
  - msg: vehicle_command
    id: 89
    receive: true
  - msg: vehicle_command_ack
    id: 90
  - msg: vehicle_constraints
    id: 91
  - msg: vehicle_control_mode
    id: 92
    send: true
  - msg: vehicle_global_position
    id: 93
  - msg: vehicle_gps_position
    id: 94
  - msg: vehicle_land_detected
    id: 95
  - msg: vehicle_local_position
    id: 96
  - msg: vehicle_local_position_setpoint
    id: 97
  - msg: vehicle_magnetometer
    id: 98
  - msg: vehicle_odometry
    id: 99
    send: true
  - msg: vehicle_rates_setpoint
    id: 100
    send: true
  - msg: vehicle_roi
    id: 101
  - msg: vehicle_status
    id: 102
    send: true
  - msg: vehicle_status_flags
    id: 103
  - msg: vehicle_trajectory_waypoint
    id: 104
  - msg: vtol_vehicle_status
    id: 105
  - msg: wind
    id: 106
  - msg: collision_constraints
    id: 107
  - msg: orbit_status
    id: 108
  - msg: power_monitor
    id: 109
  - msg: landing_gear
    id: 110
  - msg: wheel_encoders
    id: 111
  - msg: vehicle_angular_velocity
    id: 112
    send: true
  - msg: vehicle_acceleration
    id: 113
    send: true
  - msg: airspeed_validated
    id: 115
  - msg: onboard_computer_status
    id: 116
  - msg: cellular_status
    id: 117
  - msg: sensor_accel_fifo
    id: 118
  - msg: sensor_gyro_fifo
    id: 119
  - msg: vehicle_imu
    id: 120
  - msg: vehicle_imu_status
    id: 121
  - msg: vehicle_angular_acceleration
    id: 122
  - msg: logger_status
    id: 123
  - msg: rpm
    id: 124
  - msg: hover_thrust_estimate
    id: 125
  - msg: trajectory_bezier
    id: 126
  - msg: vehicle_trajectory_bezier
    id: 127
  - msg: timesync_status
    id: 128
  - msg: orb_test
    id: 129
  - msg: orb_test_medium
    id: 130
  - msg: orb_test_large
    id: 131
  - msg: yaw_estimator_status
    id: 132
  - msg: sensor_preflight_mag
    id: 133
  - msg: estimator_states
    id: 134
  - msg: generator_status
    id: 135
  - msg: sensor_gyro_fft
    id: 136
  - msg: navigator_mission_item
    id: 137
  - msg: estimator_optical_flow_vel
    id: 138
  - msg: estimator_selector_status
    id: 139
  - msg: manual_control_switches
    id: 140
  - msg: estimator_status_flags
    id: 141
  - msg: rtl_flight_time
    id: 142
  - msg: vehicle_angular_acceleration_setpoint
    id: 143
  - msg: vehicle_torque_setpoint
    id: 144
  - msg: vehicle_thrust_setpoint
    id: 145
  - msg: vehicle_actuator_setpoint
    id: 146
  - msg: control_allocator_status
    id: 147
  - msg: mag_worker_data
    id: 148
  - msg: takeoff_status
    id: 149
  - msg: heater_status
    id: 150
  - msg: gimbal_device_attitude_status
    id: 151
  - msg: gimbal_device_information
    id: 152
  - msg: gimbal_device_set_attitude
    id: 153
  - msg: gimbal_manager_information
    id: 154
  - msg: gimbal_manager_set_attitude
    id: 155
  - msg: gimbal_manager_status
    id: 156
  - msg: gimbal_manager_set_manual_control
    id: 157
  - msg: airspeed_wind
    id: 158
  - msg: estimator_event_flags
    id: 159
  ########## multi topics: begin ##########
  - msg: actuator_controls_0
    id: 170
    alias: actuator_controls
    send: true
    receive: true
  - msg: actuator_controls_1
    id: 171
    alias: actuator_controls
  - msg: actuator_controls_2
    id: 172
    alias: actuator_controls
  - msg: actuator_controls_3
    id: 173
    alias: actuator_controls
  - msg: actuator_controls_virtual_fw
    id: 174
    alias: actuator_controls
  - msg: actuator_controls_virtual_mc
    id: 175
    alias: actuator_controls
  - msg: mc_virtual_attitude_setpoint
    id: 176
    alias: vehicle_attitude_setpoint
  - msg: fw_virtual_attitude_setpoint
    id: 177
    alias: vehicle_attitude_setpoint
  - msg: vehicle_attitude_groundtruth
    id: 178
    alias: vehicle_attitude
  - msg: vehicle_global_position_groundtruth
    id: 179
    alias: vehicle_global_position
  - msg: vehicle_local_position_groundtruth
    id: 180
    alias: vehicle_local_position
  - msg: vehicle_mocap_odometry
    alias: vehicle_odometry
    id: 181
  - msg: vehicle_visual_odometry
    id: 182
    alias: vehicle_odometry
    receive: true
  - msg: vehicle_trajectory_waypoint_desired
    id: 183
    alias: vehicle_trajectory_waypoint
  - msg: obstacle_distance_fused
    id: 184
    alias: obstacle_distance
  - msg: vehicle_vision_attitude
    id: 185
    alias: vehicle_attitude
  - msg: trajectory_setpoint
    id: 186
    alias: vehicle_local_position_setpoint
  - msg: camera_trigger_secondary
    id: 187
    alias: camera_trigger
  - msg: vehicle_angular_velocity_groundtruth
    id: 188
    alias: vehicle_angular_velocity
  - msg: estimator_visual_odometry_aligned
    id: 189
    alias: vehicle_odometry
  - msg: estimator_innovation_variances
    id: 190
    alias: estimator_innovations
  - msg: estimator_innovation_test_ratios
    id: 191
    alias: estimator_innovations
  - msg: orb_multitest
    id: 192
    alias: orb_test
  - msg: orb_test_medium_multi
    id: 193
    alias: orb_test_medium
  - msg: orb_test_medium_queue
    id: 194
    alias: orb_test_medium
  - msg: orb_test_medium_queue_poll
    id: 195
    alias: orb_test_medium
  - msg: orb_test_medium_wrap_around
    id: 196
    alias: orb_test_medium
  - msg: estimator_local_position
    id: 197
    alias: vehicle_local_position
  - msg: estimator_global_position
    id: 198
    alias: vehicle_global_position
  - msg: estimator_attitude
    id: 199
    alias: vehicle_attitude
  - msg: estimator_odometry
    id: 200
    alias: vehicle_odometry
  - msg: actuator_controls_4
    id: 201
    alias: actuator_controls
  - msg: actuator_controls_5
    id: 202
    alias: actuator_controls
  - msg: estimator_wind
    id: 203
    alias: wind
  - msg: vehicle_acceleration_raw
    id: 204
    alias: vehicle_acceleration
    send: true
  ########## multi topics: end ##########
utkarsh867 commented 1 year ago

@dsix-ls2n over two years later, I believe I am facing the same problem. Was there any solution to this?