Hello,
I have a device that sends out 4 comma separated values at 9600 baud. I want to grab them with Serial5 on Pix 4(I’m assuming Serial5 is UART & I2C B first 3 pins), and forward them into the ground station as a mavlink package. Before I start flashing the Pix I’m trying to get this working in simulator.
I’m using Ubuntu 20.04 virtual machine for SITL.
I start the simulator as follows:
sim_vehicle.py -v ArduCopter -A “–uartF=/dev/ttyS1”
I set Serial5 protocol to “none” and baud to 9600. However when I try to connect to /dev/ttyS1 with ‘screen’ or simple python script I get an I/O error. My user is in the dialout group.
This is the python script I’m using:
#!/usr/bin/python
import serial,time,sys
try:
ser=serial.Serial(“/dev/ttyS1”,9600)
print(ser.name)
while True:
read_serial=ser.readline()
print(read_serial.rstrip(“\n”))
time.sleep(2)
except KeyboardInterrupt:
ser.close()
sys.exit()
I’m going to write a simple python program that generates the 4 comma separated values and sends them to SITL. But I simply can’t do that right now because I’m not able to connect to SITL via serial.
I also tried the script that decodes mavlink messages with no luck:
Am I understanding correctly that when I start SITL with a virtual serial port attached to it and connect to it with ‘screen’ I should at least see some gibberish(heartbeat package when i set the serial protocol to mavlink1 or 2) ? Right now screen just terminates.
Right now it seems that maybe Ubuntu is blocking it but dmesg output is empty…
Thank you for your time,
Andri