What I want to do is to plot the sensor data of on-board sensors in pixhawk4 with my notebook in real time.
I’ve been trying to stream the log data in real-time using mavlink_ulog_streaming.py with the pixhawk4 connected via usb port.
But every time I try, I come up with the error message of
[Errno 16] Could not open port /dev/serial/by-id/usb-3D_Robotics_PX4_FMUv5.x_0-if00:
[Errno 16] Device or resource busy: ‘/dev/serial/by-id/usb-3D_Robotics_PX4_FMUv5.x_0-if00’
Actually, I knew that QGC supports real-time plotting, but what I’m looking for is how to stream log data in real-time to the notebook with no QGC via cable.
Ok, for real-time you’re better off using MAVLink, and you could use MAVSDK or pymavlink.
But yes, you could also use mavlink_ulog_streaming.py, and then parse the log (there’s no real-time parsing library).
To answer your original question: the error means that another process already opened the serial port. You can check with lsof /dev/serial/by-id/usb-3D_Robotics_PX4_FMUv5.x_0-if00