Connecting to Dronekit with Navio2

I’m trying to run Dronekit Python on the same RasPi that I’ve got Navio2 on. How do I connect the thread running my Dronekit Python script to the thread running ArduRover?

I’ve tried launching example with these command line command but I’m getting no-heartbeat timeouts:

python vehicle_state.py --connect udpin:127.0.0.1:5760

or

python vehicle_state.py --connect udpin:127.0.0.1:14550

1 Like

Hello and welcome!

I just followed the instructions obtained from this tutorial and it worked fine. The only adjustment I needed to make was setting address supplied to the vehicle_state.py to 0.0.0.0. After that I launched ArduPlane like this ArduPlane -A udp:127.0.0.1:14550 and got feedback from the Dronekit script.

I hope it’s going to help you!

Hello,

I used it in this way:

1.- Open a terminal to the RPi2 (ssh): # ArduRover -A udp:127.0.0.1:14550.
2.- Open a new terminal and in the examples directory: # python ./vehicle_state.py --connect udp:127.0.0.1:14550

I have had a issue with the “home location” the first time … but now is running well.

On the other hand, I have tried to connect remotely from my laptop, with a wifi dongle or wired LAN, like this: # python ./vehicle_state.py --connect udp:xxx.xxx.xxx.xxx:14550, where xxx.xxx.xxx.xxx is the RPi IP … but I haven’t had luck.

Hei,

I managed to run the connection remotely.

1.- Launch ArduPilot (in my case arucopter) like this: # sudo ArduCopter-quad -A tcp:10.1.0.25:14550

where 10.1.0.25 is just the IP of the RPi2 (not localhost, not IP of GCS o laptop).

2.- In the remote machine: # python ./vehicle_state.py --connect tcp:10.1.0.25:14550

Then now we have an open door to write programs that can interact remotely with the RPi2.

Bye …

2 Likes

You have to use the IP of your GCS computer with udp.

Oscar: That worked! Many thanks. I assume home location will populate once I have GPS lock.

Yes. It works. You can change the tcp:IP_of_the_remote:14550 in the ardupilot command by tcp:0.0.0.0:14550. Or use the udp if you wish.

About the GPS lock … I have the same problem now … I think that if you are indoor (in home) the GPS is not capable of obtain a location. This is that the example: vehicle_state.py outs:

Connecting to vehicle on: tcp:10.1.0.25:14550

APM:Copter V3.4-rc1 (dfa90d29)
Frame: QUAD

Get all vehicle attribute values:
Autopilot Firmware version: APM:Copter-3.4.0-rc0
Major version number: 3
Minor version number: 4
Patch version number: 0
Release type: rc
Release version: 0
Stable release?: False
Autopilot capabilities
Supports MISSION_FLOAT message type: True
Supports PARAM_FLOAT message type: True
Supports MISSION_INT message type: True
Supports COMMAND_INT message type: False
Supports PARAM_UNION message type: False
Supports ftp for file transfers: False
Supports commanding attitude offboard: True
Supports commanding position and velocity targets in local NED frame: True
Supports set position + velocity targets in global scaled integers: True
Supports terrain protocol / data handling: True
Supports direct actuator control: False
Supports the flight termination command: True
Supports mission_float message type: True
Supports onboard compass calibration: False
Global Location: LocationGlobal:lat=40.7042118,lon=0.5780497,alt=None
Global Location (relative altitude): LocationGlobalRelative:lat=40.7042118,lon=0.5780497,alt=0.0
Local Location: LocationLocal:north=None,east=None,down=None
Attitude: Attitude:pitch=0.00105991587043,yaw=3.07117295265,roll=-0.00470507051796
Velocity: [0.0, 0.0, 0.27]
GPS: GPSInfo:fix=3,num_sat=4
Gimbal status: Gimbal: pitch=None, roll=None, yaw=None
Battery: Battery:voltage=14.016,current=24.81,level=97
EKF OK?: False
Last Heartbeat: 0.357726497
Rangefinder: Rangefinder: distance=None, voltage=None
Rangefinder distance: None
Rangefinder voltage: None
Heading: 175
Is Armable?: False
System status: STANDBY
Groundspeed: 0.290172368288
Airspeed: 0.290172368288
Mode: STABILIZE
Armed: False
Waiting for home location …
Waiting for home location …
Waiting for home location …
Waiting for home location …
Waiting for home location …
Waiting for home location …
Waiting for home location …
Waiting for home location …
Waiting for home location …

The GPS says: GPS: GPSInfo:fix=3,num_sat=4

Uhmmm …

Hello,

Finally, I have resolved the “Waiting for home location …” putting the drone outdoor.

I have executed the second example of the dronekit (simple_goto.py) remotely from my laptop, without RC or Joystick, and the engines have rotated. I have made the test without propellers.

Now, I am going to write a small pyGtk UI, with dronekit support, to control “in real time” the drone remotely from my laptop. First, I am going to make it with wifi … but in the future I will use 4G modems.

Regards.

Guys, I guess the issue has been resolved, so I’m closing this thread. Please, feel free to open a new one if you have any questions whatsoever.