Hi,
I’m trying to control a SITL (Software In The Loop) drone using my own Python code based on MAVLink. Here’s what I’ve done so far:
-
I initialize the virtual drone using the following command:
sim_vehicle.py -v ArduCopter -f gazebo-iris --console --map
-
I open Gazebo with the following command:
gazebo --verbose ardupilot_gazebo/worlds/iris_arducopter_runway.world
When I open QGroundControl (QGC), I can see and fly the drone successfully, so I know the SITL and Gazebo setup are working.
Now, I’m trying to connect to the virtual drone with my own Python code. Here is the relevant part of my code:
master = mavutil.mavlink_connection(‘tcp:127.0.0.1:9003’)
Unfortunately, the code doesn’t seem to connect to the drone. I’m new to Ubuntu, and getting this far has been a big achievement for me. However, I’m stuck at this point and need some guidance.
What I need help with:
- Am I using the correct connection string (
tcp:127.0.0.1:9003
) for connecting to the SITL drone? - Are there any additional steps I need to take to make the virtual drone accessible to my Python code?
Any advice or suggestions would be greatly appreciated!