GithubHelp home page GithubHelp logo

srmanikandasriram / ev3-ros Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 4.0 471 KB

Interfacing LEGO Mindstorms EV3 running ev3dev Linux OS with ROS

License: GNU General Public License v2.0

Shell 0.11% C++ 99.21% Makefile 0.68%

ev3-ros's Introduction

ev3-ros

Interfacing LEGO Mindstorms EV3 running ev3dev linux OS with ROS

Note : This repositry is compatible with the ev3image file ev3dev-jessie-2015-12-30

Pre-requisites:

  • Host computer with ROS installed
  • A lego mindstorm ev3 unit with a Wi-Fi dongle

Setup

  • Download the image file from this repository or from here.

  • Follow the instructions here to copy the image file onto a SD card .

  • Follow the instructions to setup the ssh connection between your workstation and the ev3 brick :

    (i) In order to make the connection with a Wi-Fi dongle one has to first follow the instructions to get connected through USB here.

    (ii) Now once the connection is made through the USB, go here to learn how to get connected through a Wi-Fi dongle.

Note: Connecting the first time through dongle will only be cumbersome, this step is completed,connection will be made automatically upon booting the ev3 and our job is to only type the ssh command. 
  • Now, follow instructions from here to setup the developement environment on the host computer.This will download two folders- examples and ros_lib in your working directory.roslib contains all the libraries required by the pre- existing ROS packages to run.

  • Get CPP language bindings for ev3dev from here and copy the files ev3dev.h and ev3dev.cpp from the repository into the src directory.

  • Store this repository along with the two directories downloaded earlier in a one new folder and name it ev3-ros in your catkin workspace's src directory.

  • Replace time.h and time.cpp files from ros_lib directory with the ones provided here.

  • Install gcc-arm-linux-gnueabi, g++-arm-linux-gnueabi, toolchains(these are the compilers that we use in cross compilation to obtain an executable that will run on the ev3).

  • Now, run

    $ cd ~/<your catkin workspace>/src/ev3-ros/src

    $ source ../setenv.sh ; make all

Note: " make all " compiles all the programs in the src file.
If suppose you want to compile only a specific program, 
run $ make <name of that program> 

These commands will compile the programs written in the src folder and would create an executable for 
the program that can
run in ev3 in  ~/<your catkin workspace>/src/ev3-ros>/bin 
folder   


Important note : When setting up for the first time, make sure you create an empty folder named 'bin' in 
~/catkin_ws/src/ev3-ros directory.

  • Now run the ssh command to connect the host computer and the ev3 brick.

  • Now, to send the executable from the computer to the ev3, in your laptop's terminal run,

    $ cd ~/<your catkin workspace>/src/ev3-ros/bin

    $ scp <executable name> [email protected]:/<address of the directory in ev3 to store>

  • Once the executable is copied onto the ev3 go here to
    understand rosserial in embeddedlinux.

  • Now in the ROS workstation run, $ roscore

    In another terminal, $ rosrun rosserial_python serial_node.py tcp

  • In the ev3 ssh terminal,

    $ cd ~/catkin_ws/src/ev3-ros/bin

    $ ./<name of executable>

~/catkin_ws/src/ev3-ros/bin is the place where the cross compiled executablle is instructed to be created at, in the Makefile

  • Increase OUTPUT_SIZE and INPUT_SIZE in ros/node_handle.h incase you face buffer overflow issue. The current
    ROSSerial_EmbeddedLinux available as binary in repositories has a bug in serialization which causes all negative numbers to be converted to 0. This has been fixed in the trunk version. Hence, build rosserial from source code until an updated release is available.

  • When constructing messages in EV3, ensure all variables are initialised. If a message contains an array,
    initialise it with zero if you don't want to use data in that.


Steps to be followed to use rosservices in ev3

  • Look here for a simple rosservice code that runs in the ev3.

  • The important factor in using services is the generation of headerfiles.

    1. First create a ros package called "headers", refer here for creating and building a ros package.

    2. Follow the steps here, for creating header files for ros services

    3. Now to obtain the header file generated, run $ rosrun rosserial_mbed make_libraries.py <address of directory to store>

    4. The above command would create a roslib directory which contains all the header files required by all the packages, in the mentioned address. Inside roslib will be a directory called headers and inside that will be the headerfile we created.

    5. Replace this roslib directory with the roslib in ~/catkin_ws/src/ev3-ros

  • Once the required header files are created, cross compile the services code and copy it onto the ev3, and run the code.

  • To call the services, a client code is not required. Instead run this command in the ros workstation,
    $ rosservice call /<service_name> <arg1> <arg2>...<argn>

Note : The headerfiles required to run the ros services provided in this repository are stored in 'headers' directory in 'roslib' in this repository


ev3-ros's People

Contributors

ruthrash avatar srmanikandasriram avatar

Stargazers

Mirko Adam avatar  avatar Dammian Miller avatar Micaela Angeli avatar Evan O'Keeffe avatar

Watchers

James Cloos avatar  avatar Adarsh Jagan Sathyamoorthy avatar  avatar

Forkers

eokeeffe kyr7 hwtwj

ev3-ros's Issues

License Issue with GPL

I found some GPL'ed code in the Repository which is needed to compile the project (in the files src/ev3_demo.cpp, src/ev3_demo.h, ev3dev.h and ev3dev.cpp). However, the whole project is licensed under the MIT license. This is against the terms of the GPL, as pointed out here: https://www.gnu.org/licenses/gpl-faq.html#IfLibraryIsGPL. It is strictly necessary that the whole project is licensed under the (A)GPL.

This can only be resolved by the copyright holder of the repo, which is @srmanikandasriram.

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.