Difference between revisions of "ROS Raspberry Pi Demo"

From wikidb
Jump to: navigation, search
(Execution)
(Setup the .bashrc file)
Line 46: Line 46:
 
   source /home/ubuntu/catkin_demo/devel/setup.bash
 
   source /home/ubuntu/catkin_demo/devel/setup.bash
  
 +
== Configure I2C ==
 +
 +
I2C is not enabled by default.
 +
 +
  sudo i2cdetect -y 1
 +
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
 +
 +
Edit the boot config file
 +
 +
  cd /boot
 +
  diff config.txt config.txt.org
 +
    1073,1075c1073
 +
    < dtparam=i2c1=on
 +
    < dtparam=i2c_arm=on
 +
    <
 +
    ---
 +
    > #dtparam=i2c_arm=off
  
 
= Execution =
 
= Execution =

Revision as of 19:52, 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

Configure I2C

I2C is not enabled by default.

 sudo i2cdetect -y 1
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

Edit the boot config file

 cd /boot
 diff config.txt config.txt.org 
   1073,1075c1073
   < dtparam=i2c1=on
   < dtparam=i2c_arm=on
   < 
   ---
   > #dtparam=i2c_arm=off

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