Difference between revisions of "ROS Raspberry Pi Demo"

From wikidb
Jump to: navigation, search
(References)
(Execution)
Line 7: Line 7:
 
*  [https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c Adafruit configuring I2C on Raspberry Pi]
 
*  [https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c Adafruit configuring I2C on Raspberry Pi]
 
*  [http://wiki.ros.org/ROS/Tutorials ROS Tutorials]
 
*  [http://wiki.ros.org/ROS/Tutorials ROS Tutorials]
 +
 +
= Motor Hat Node Installation =
 +
 +
These steps have been completed for the catkin_ws dir. I'm starting from
 +
scratch for completeness and I don't want to mess up my working catkin_ws
 +
 +
== Create the Workspace ==
 +
  cd
 +
  mkdir -p catkin_demo/src
 +
  cd catkin_demo/
 +
  ls
 +
  catkin_make
 +
  ls
 +
  cd src
 +
 +
== Download the motor hat SW ==
 +
 +
  git clone https://github.com/matpalm/ros-motorhat-node
 +
 +
== Rename the directory ==
 +
 +
It is less confusing if the motor hat directory matches the project name. The project name is in CMakeLists.txt.
 +
 +
  ls
 +
  more ros-motorhat-node/CMakeLists.txt
 +
  mv ros-motorhat-node/ motor_hat
 +
 +
== Build the motor hat node ==
 +
 +
  cd ..
 +
  catkin_make
 +
  ls devel/lib/motor_hat/
 +
 +
== Setup the .bashrc file ==
 +
 +
Add the following to your ~/.bashrc
 +
 +
  source /home/ubuntu/catkin_demo/devel/setup.bash
 +
  
 
= Execution =
 
= Execution =

Revision as of 19:44, 24 February 2017

References

Motor Hat Node Installation

These steps have been completed for the catkin_ws dir. I'm starting from scratch for completeness and I don't want to mess up my working catkin_ws

Create the Workspace

 cd
 mkdir -p catkin_demo/src
 cd catkin_demo/
 ls
 catkin_make
 ls
 cd src

Download the motor hat SW

 git clone https://github.com/matpalm/ros-motorhat-node

Rename the directory

It is less confusing if the motor hat directory matches the project name. The project name is in CMakeLists.txt.

 ls
 more ros-motorhat-node/CMakeLists.txt
 mv ros-motorhat-node/ motor_hat

Build the motor hat node

 cd ..
 catkin_make
 ls devel/lib/motor_hat/

Setup the .bashrc file

Add the following to your ~/.bashrc

 source /home/ubuntu/catkin_demo/devel/setup.bash


Execution

Demo the ROS installation.

terminal 1

 roscore

terminal 2

 cd catkin_ws/
 source devel/setup.bash 
 rosrun motor_hat motor_hat_node 

terminal 3

 rosnode list
 rostopic list
 rostopic echo cmd

terminal 4

 cd catkin_ws/
 source devel/setup.bash
 rosrun motor_hat stop.py 
 rosrun motor_hat on.py 

TBD - QUESTION - Why isn't the message often not received by the motor_hat_node?

Code Inspection

The next line can be added to ~/.bashrc.

 source ~/catkin_ws/devel/setup.bash
 
 roscd hat_node
 pwd
 cd src
 ls

Look at the code

 emacs on.py&
 emacs motor_hat_node_cpp&

If emacs isn't installed use nano.

 nano on.py

References