Category

2016년 12월 18일 일요일

Drone : Connecting to a Vehicle

The connection to the vehicle (or multiple vehicles) is set up within the DroneKit script. Scripts import and call the connect() method. After connecting this returns a Vehicle object from which you can get/set parameters and attributes, and control vehicle movement.
The most common way to call connect() is shown below:
from dronekit import connect

# Connect to the Vehicle (in this case a UDP endpoint)
vehicle = connect('127.0.0.1:14550', wait_ready=True)

The first parameter specifies the target address (in this case the loopback address for UDP port 14550). See Connection string options for the strings to use for other common vehicles.
The second parameter (wait_ready) is used to determine whether connect() returns immediately on connection or if it waits until some vehicle parameters and attributes are populated. In most cases you should use wait_ready=True to wait on the default set of parameters.
connect() also has arguments for setting the baud rate, the length of the connection timeout, and/or to use a custom vehicle class.

There is more documentation on all of the parameters in the API Reference.

Connection string options

The table below shows connection strings you can use for some of the more common connection types:
Connection typeConnection string
Linux computer connected to the vehicle via USB/dev/ttyUSB0
Linux computer connected to the vehicle via Serial port (RaspberryPi example)/dev/ttyAMA0 (also set baud=57600)
SITL connected to the vehicle via UDP127.0.0.1:14550
SITL connected to the vehicle via TCPtcp:127.0.0.1:5760
OSX computer connected to the vehicle via USBdev/cu.usbmodem1
Windows computer connected to the vehicle via USB (in this case on COM14)com14
Windows computer connected to the vehicle using a 3DR Telemetry Radio on COM14com14 (also set baud=57600)
in my case using a connected to the vehicle via Serial port -> /dev/ttyAMA0 (also set baud=57600
ex> connection_string = "/dev/ttyAMA0"
vehicle=connect(connection_string, wait_ready=True)

But not working
Now working


~/Gwang_ws$ mavproxy.py --master=/dev/ttyAMA0,57600


gdrone@gdrone-desktop:~/Gwang_ws$ python show_info.py --connect 127.0.0.1:14550




next plan -> "simple_goto.py"





댓글 없음:

댓글 쓰기