Hello all,
I’m not sure if this is the correct forum to be posting this question to. I apologize beforehand if it is not.
I’m running into an issue when I attempt to connect to the Gazebo simulator using pymavlink. Specifically, the issue is this line of code:
vehicleConnection = mavutil.mavlink_connection()
For TCP, I set up SITL (Gazebo) using these instructions. This is what it looks like when it is running:
(not sure what “link 1 down” means)
Here is the connection I use:
vehicleConnection = mavutil.mavlink_connection('tcp:127.0.0.1:5760')
When I run this line within a Python script, I get the following output:
[Errno 111] Connection refused sleeping
[Errno 111] Connection refused sleeping
Unable to establish connection with PixHawk.
For UDP, I ran the headless Gazebo simulator found on px4-gazebo-headless. Here is the connection I use:
vehicleConnection = mavutil.mavlink_connection('udpin:localhost:14540')
When I run the Python script, it never gets past this line. I have to Ctrl+C to kill the process.
I know this port is active because I’m able to connect to it via mavsdk_server. I was also able to retrieve data from the simulation with MAVSDK.
For serial, I plug in a Pixhawk into my machine with a USB cord and then attach a GPS unit to the Pixhawk.
This was originally “working”. The building I’m in makes it impossible for the GPS unit to connect to satellites, but I was at least able to get 0’s. But now when I run the script with this line of code:
vehicleConnection = mavutil.mavlink_connection('/dev/ttyACM0')
I only get BAD DATA
responses. Updating the firmware with QGC did not fix this issue.
My system is running Ubuntu 20.04 LTS.
My main goal is to get an SITL running and figure out the serial connection later. I’ve searched this forum, the pymavlink gitter channel, and the Ardupilot repo for answers but I’m coming up short.
Any help would be greatly appreciated.
-Matt