BlueROV-6: Quick Start of Dronekit and Connect Dronekit to the Vehicle

Quick Start of Dronekit(Simulator)http://python.dronekit.io/guide/quick_start.html
sudo pip install dronekit   or  sudo -H pip install dronekit

sudo pip install dronekit-sitl   or  sudo -H pip install dronekit-sitl

BlueROV-6: Quick Start of Dronekit and Connect Dronekit to the Vehicle

Connect other laptop using the local IP or global IP:
Useifconfig to check the IP address of a laptop.

[email protected]:~ $ ifconfig

eth0      Link encap:Ethernet HWaddr b8:27:eb:08:0d:f7  

          inet6 addr:fe80::35f6:db2c:a9b8:94d8/64 Scope:Link

          UP BROADCASTMULTICAST  MTU:1500  Metric:1

          RX packets:0errors:0 dropped:0 overruns:0 frame:0

          TX packets:0errors:0 dropped:0 overruns:0 carrier:0

          collisions:0txqueuelen:1000 

          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo        Link encap:LocalLoopback  

          inetaddr:127.0.0.1  Mask:255.0.0.0

          inet6 addr:::1/128 Scope:Host

          UP LOOPBACKRUNNING  MTU:65536  Metric:1

          RX packets:1551errors:0 dropped:0 overruns:0 frame:0

          TX packets:1551errors:0 dropped:0 overruns:0 carrier:0

          collisions:0txqueuelen:1 

          RX bytes:297300(290.3 KiB)  TX bytes:297300 (290.3 KiB)

wlan0     Link encap:Ethernet  HWaddrb8:27:eb:5d:58:a2  

          inetaddr:172.17.5.27  Bcast:172.17.255.255  Mask:255.255.0.0

          inet6 addr:fe80::efcb:6379:52e3:aa35/64 Scope:Link

          UP BROADCASTRUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:5726999errors:0 dropped:137854 overruns:0 frame:0

          TX packets:156162errors:0 dropped:0 overruns:0 carrier:0

          collisions:0txqueuelen:1000 

          RX bytes:2064163155 (1.9 GiB)  TX bytes:18002083 (17.1 MiB)

  • In another laptop, use a software to rename the IP address, like BlueROV.(Optional)
  • ping 172.17.5.27

(Toconnect and receive response)

(Tologin in)

Typein the password(raspberry). Then it works.

  • sudo adduser k845002185

(Toadd my own user)

 

Connect Dronekit to the vehicle:

from dronekit import connect

# Connect to the Vehicle (in this case a UDPendpoint)

vehicle = connect('/dev/tty.usbmodem1',wait_ready=True)

Differentsystems have different ways to connect:

http://python.dronekit.io/guide/connecting_vehicle.html

ForMac USB connection: the example is "dev/cu.usbmodem1", but whatactually it is?

Check in the terminal: the current path is/Users/apple, repeat thecommandls /dev when the laptop is disconnected and connected to the pixhawk, andsee what file  appears when they areconnected. In this laptop the file is tty.usbmodem1.

BlueROV-6: Quick Start of Dronekit and Connect Dronekit to the Vehicle


BlueROV-6: Quick Start of Dronekit and Connect Dronekit to the Vehicle


Read the Dronekit examples and understand the relationship between Dronekit, Mavlink and Ardusub.

I solve the connection problem by changing to another micro-USB line.

I also find that the battery has no power left at all(the program results show that voltage = 0 and current = 0), so it cannot drive motors. 

I manage to download the program into the copter and let the copter finish some program functions that do not need the power of battery, like presenting the altitude of the copter. 

In the green frame, the altitude grows higher because I lift up the copter.

BlueROV-6: Quick Start of Dronekit and Connect Dronekit to the Vehicle

It proves the laptop and vehicle is well-connected and can communicate.