Giter Site home page Giter Site logo

cjsatuforc / usma_mavros Goto Github PK

View Code? Open in Web Editor NEW

This project forked from westpoint-robotics/usma_mavros

0.0 0.0 0.0 10.07 MB

Repository to configure a computer and the PX4 autopilot to use with the mavros package.

License: Apache License 2.0

CMake 45.61% Python 54.39%

usma_mavros's Introduction

usma_mavros

These instructions are for operating a small, multirotor UAS running a PX4 flight control unit or similar variant. They also include setup for a ROS interface using mavlink and mavros. The companion computer can be a number of embedded devices such as a NUC, Odroid, RPi, or ground station PC.

Indoor Operations

  1. We recommend first starting with a tethered configuration (power and communications). A Linux computer can connect to the PX4 using a USB extension and FTDI adapter to the Telemetry 2 port on the PX4 as described here. For initial testing and configuration, it is possible to connect to the PX4's micro USB port.

  2. For general manual control, configure the PX4 using QGroundControl (download latest firmware, set up flight modes, etc).

  3. If operating in mocap, follow the usma_optitrack instructions for set up motion capture.

    • Configure the PX4 to operate in mocap using external position estimation.

    • Instructions are included to build from source. The firmware can also be downloaded here.

    • Transmitter settings can be found here. At a minimum, the RC transmitter should have manual, position control, offboard control, and a kill switch.

    • First achieve position control of the vehicle using the transmitter.

    • Here is a summary of firmware parameters:

      -- The sys_companion field is set 921600. -- ATT_EXT_HDG_M parameter is set to 2.

Outdoor Operations

PX4 Instructions

  1. We recommend first starting with a tethered configuration (power and communications). A Linux computer can connect to the PX4 using a USB extension and FTDI adapter to the Telemetry 2 port on the PX4 as described [here] (http://ardupilot.org/dev/docs/odroid-via-mavlink.html).
  2. Configure PX4 using QGroundControl (download latest firmware, set up flight modes, etc).
  • If operating in mocap, follow the usma_optitrack instructions for set up motion capture.
  • Configure the PX4 to operate in mocap using [external position] (http://dev.px4.io/external-position.html).
  • The sys_companion field is set 921600.
  • ATT_EXT_HDG_M parameter is set to 1 (when using vision_pose topic).
  • CBRK_NO_VISION parameter set to 0.
  • Indoor navigation is only achieved by using the external headings from mocap.
  • The offboard control documentation provides a good overview.

Computer Instructions

  1. Install the mavros package and dependencies (assuming ROS Indigo used).
  • sudo apt-get install ros-indigo-mavros ros-indigo-mavlink ros-indigo-diagnostic-updater ros-indigo-tf2-ros ros-indigo-angles ros-indigo-eigen-conversions ros-indigo-image-transport ros-indigo-cv-bridge ros-indigo-urdf ros-indigo-tf ros-indigo-control-toolbox
  1. Clone usma_mavros
  • cd ~/catkin_ws/src
  • git clone https://github.com/westpoint-robotics/usma_mavros
  1. Build
  • cd ~/catkin_ws/
  • catkin_make -DMAVLINK_DIALECT=common
  1. Configure mavros on computer:
  • Note some variations to the mavros configuration:
  • Using QGC, the sys_companion field is set 921600 so that autopilot is enabled with a higher baud rate to communicate with the computer.
  • In px4.launch,
  • The computer is connecting through ttyUSB0:921600 instead of ttyACM0:57600.
  • Chage the gcs_url argument default to default="udp://:[email protected]:14550" to match the IP of the ground control station.
  • QGC can connect to the autopilot using the Default UDP link.
  • If using mocap, ensure that the vision_pose_estimate plugin is enabled and NOT blacklisted.
  1. Execute mavros
  • roslaunch usma_mavros px4.launch
  • Check that there is a heartbeat with the PX4.
  • Check the debug messages for a valid vision estimate: FCU: [inav] VISION estimate valid
  • Echo the FCU local position to check for propoer coordinate frame conversions: rostopic echo /mavros/local_position/local

Instructions to set up a Raspberry Pi 2

  1. [Install Ubuntu 14.04 LTS] (https://wiki.ubuntu.com/ARM/RaspberryPi)
  1. Connect your RPi2 using wired Ethernet.
  2. Install linux-firmware drivers to enable wifi.
  • sudo apt-get install linux-firmware
  • sudo apt-get install wicd
  1. [Setup wifi on your device] (https://help.ubuntu.com/community/NetworkConfigurationCommandLine/Automatic)
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
  wpa-ssid "EECSDS3"
  wpa-psk "accessgranted"
  1. [Install ROS] (http://wiki.ros.org/indigo/Installation/UbuntuARM) 6
  2. Make these [hardware connections] (http://dev.ardupilot.com/wiki/raspberry-pi-via-mavlink/) between the RPi2 and PX4
  • The software instructions in the above link are not followed.
  1. Assume Ubuntu 14.04 and ROS Indigo installed and a catkin_ws created.
  2. Setup serial port and baud rate on RPi2:
  1. Set up embedded computer to match MASTER_URI of base station
  1. Run mavros on the embedded computer:
  • roslaunch usma_mavros px4.launch
  • Note some variations to the mavros configuration:
    • Using QGC, ensure the sys_companion field is set to 921600 so that autopilot is enabled with higher baud rate to communicate with onboard computer
    • In px4.launch, the RPi2 is connecting through ttyAMA0:921600 instead of ttyACM0:57600

Offboard Tracking

  1. set up ROS_MASTER_URI and IP on all the terminals used in tracking
  2. Run roslaunch mavros px4.launch on onboard computer
  3. on remote host,set up ROS_MASTER_URI and IP and run roslaunch mocap_optitrack mocap.launch
  4. on different terminal,set up ROS_MASTER_URI and IP and run roslaunch mavros_extras teleop_track.launch
  5. Joystick button map is listed in f710_joy.yaml( for take-off ,land, track button reference)

New instructions

Quad rotor naming

All tail numbers must be unique

  • Mocap rigid body naming - f450_<TAIL_NUM>
  • Hostname - odroid-<TAIL_NUM>

PX4 setup

  • Flash the firmware located in the config folder
  • Load the params file in the config folder
  • Calibrate all sensors

Odroid setup

During OS installation

  • Hostname - odroid-<TAIL_NUM>

After OS install

echo "192.168.200.88 ros304" | sudo tee -a /etc/hosts

After ROS install

  • clone and make mavros from source
  • make sure to compile with one job otherwise it will most likely fail
cd ~/catkin_ws
catkin_make -j1

Generate and share SSH key (no password)

ssh-keygen
cat ~/.ssh/id_rsa.pub

Copy and paste this into the base station's authorized_keys file in a new line

Base station setup

Only once

echo  "export ROSLAUNCH_SSH_UNKNOWN=1" >> ~/.bashrc
echo  "export ROS_MASTER_URI=http://ros304:11311" >> ~/.bashrc

For each Odroid

echo "<IP_ADDRESS> odroid-<TAIL_NUM" | sudo tee -a /etc/hosts

An ssh key should already be setup. Share with the odroid

cat ~/.ssh/id_rsa.pub

Copy and paste this into the odroid's authorized_keys file in a new line

How to run

Make sure a BATTERY is plugged in

Terminal A

roslaunch usma_mavros base_station.launch

Terminal B

roslaunch usma_mavros lpe_mavros_quad.launch TAIL_NUM:=131

Terminal C

rosrun usma_mavros test_flight __ns:=f450_131

usma_mavros's People

Contributors

christopherkorpela avatar k-chaney avatar kaustubha-jagtap avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.