Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAD_DATA reception on PyMAVLink #820

Open
TonyJacb opened this issue May 22, 2023 · 0 comments
Open

BAD_DATA reception on PyMAVLink #820

TonyJacb opened this issue May 22, 2023 · 0 comments

Comments

@TonyJacb
Copy link

I am trying to use PyMAVLink to communicate between a vehicle and another laptop. I am using the 3DR telemetry modules connected to serial to implement the same.

I wrote a simple script to send and receive the messages. The below script sends the messages.

from pymavlink import mavutil
import generated_messages

mavlink_connection = mavutil.mavlink_connection(device='/dev/ttyUSB1', baudrate=115200)
mavlink = generated_messages.MAVLink(mavlink_connection)
msg = mavlink.heartbeat_encode(mavutil.mavlink.MAV_TYPE_GCS, mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)
msg.pack(mavlink)

while 1:
    mavlink_connection.mav.send(msg)
    print(msg)

The reception script however, ouputs BAD_DATA{Bad prefix} no matter what I send. (I have tried sending a LONG message and a HEARTBEAT message)

from pymavlink import mavutil
import generated_messages

mavlink_connection = mavutil.mavlink_connection(device='/dev/ttyUSB0', baudrate=115200, input=False)
while True:
    msg = mavlink_connection.recv_match()
    if msg:
        print(msg)

It would be great help if I am directed as to why the script is behaving as such.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant