Coder Social home page Coder Social logo

roscopter's Introduction

roscopter

This is a cleaned-up version of roscopter. Tested with ROS Groovy and Hydro.

Building

Assuming you have a Catkin workspace set up in ~/catkin_ws as described here:

# Install dependencies (replace hydro by groovy if necessary):
sudo aptitude install ros-hydro-sensor-msgs python-serial python-tz

# Clone this repository and initialise the `mavlink` submodule:
cd ~/catkin_ws/src
git clone https://github.com/ssk2/roscopter.git
cd roscopter
git submodule update --init

# Build:
cd ~/catkin_ws/
catkin_make --pkg roscopter

# Generate mavlink python bindings:
cd ~/catkin_ws/src/roscopter/mavlink
./pymavlink/generator/mavgen.py --output pymavlink/dialects/v10/ardupilotmega.py message_definitions/v1.0/ardupilotmega.xml

Testing

When connecting our APM via USB, it is seen as /dev/ttyACM0.

You may need to add the user running roscopter to the dialout group (sudo usermod -a -G dialout username) to get permission to read / write to this device.

Start roscore in one terminal.

roscore

Run roscopter in another terminal:

rosrun roscopter roscopter_node.py  --device=/dev/ttyACM0 --baudrate=115200

You should see that it receives a heartbeat from the APM, and then displays the APM initialization messages, ending with "Ready to FLY".

In a third terminal, you can do for example rostopic echo /attitude to watch the attitude topic.

See original docs for more details. (Note that the original docs are wrong: you have to use --baudrate instead of --rate. See the source for the meaning of these parameters.)

Performance

pymavlink continually polls the serial port to look for new messages - which is processor intensive.

Setting timeout=1 in roscopter/mavlink/pymavlink/mavutil.py as below proves to help the CPU usage significantly:

class mavserial(mavfile):
    '''a serial mavlink port'''
    def __init__(self, device, baud=115200, autoreconnect=False, source_system=255):
        import serial
        self.baud = baud
        self.device = device
        self.autoreconnect = autoreconnect
        self.port = serial.Serial(self.device, self.baud, timeout=1,
                                  dsrdtr=False, rtscts=False, xonxoff=False)

roscopter's People

Contributors

lzl200102109 avatar

Watchers

James Cloos avatar  avatar  avatar  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.