Skip to content

AndriyPt/rosserial-arduino-examples

Repository files navigation

rosserial-arduino-examples

Hardware

Arduino and wiring

I have used Arduino Mega 2560. Also there is firmware for Arduino M0.

Pin 2 (for Arduino M0 - pin 3) was connected to FC-03 digital output. 5V and GND was connected to appropriate inputs of FC-03. The following hardware RC filter was applied for FC-03 digital output:

Hardware RC filter
More details about filter can be found here.

Motor was connected using this circuit: Motor Wiring

Docker Container

For development the following docker container was used. To pull it please run

docker pull shadowrobot/build-tools:xenial-kinetic-ide

If you want to run everything from docker container use the following command

docker run -it --name meetup_demo --privileged -e DISPLAY  -e LOCAL_USER_ID=$(id -u) -v /dev/ttyUSB0:/dev/ttyUSB0 -v /tmp/.X11-unix:/tmp/.X11-unix:rw shadowrobot/build-tools:xenial-kinetic-ide

For Arduino M0 the following command was used

docker run -it --name meetup_demo --privileged -e DISPLAY  -e LOCAL_USER_ID=$(id -u) -v /dev/bus/usb:/dev/bus/usb -v /dev/ttyACM0:/dev/ttyACM0 -v /tmp/.X11-unix:/tmp/.X11-unix:rw shadowrobot/build-tools:xenial-kinetic-ide

Also uninstallation of modemmanager was required on host machine in order to connect and detect USB connection of Arduino M0.

Setup

Workspace installation

Go to ~/workspace/src folder on Docker container. Clone repository

git clone https://github.com/AndriyPt/rosserial-arduino-examples.git

Got to ~/workspace. Install dependencies.

rosdep install --from-paths src --ignore-src --rosdistro kinetic -y

Compile source code

catkin_make

and

source ~/workspace/devel/setup.bash

Install Arduino

Download and extract Arduino IDE in home folder.

Setup ros_serial_arduino

In Arduino's libraries folder run

source ~/workspace/devel/setup.bash
rm -rf ros_lib
rosrun rosserial_arduino make_libraries.py .

More details can be found here.

Robot model preview

In order to check robot's URDF and move it's joint run

roslaunch first_description display.launch gui:=True

Simulation

roslaunch first_launch simulation.launch

Real Hardware

roslaunch first_launch real_robot.launch

Tools

Different tools are available in RQT

rqt

About

Example of rosserial_arduino usage

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published