Running the LED blink demo on Raspberry Pi and Odroid

To run the demo, launch multiple SSH Terminals and execute each command in each Terminal.

Start roscore:

    $ roscore

Run the executable as root in another Terminal. We are running the node with root privilege, because GPIO handling needs root. If you are working with RPi, the username will be pi instead of odroid:

    $ sudo -s
    # cd /home/odroid/catkin_ws/build/ros_wiring_examples
    #./blink_led

You can publish 1 and 0 to /led_blink to test the node working from another Terminal:

    $ rostopic pub /led_blink std_msgs/Bool 1
    $ rostopic pub /led_blink std_msgs/Bool 0

To run on the Raspberry Pi, we have to perform few more steps. We have to add the following lines to the .bashrc folder of the root user. You can do so using the following command:

    $ sudo -i
    $ nano .bashrc

Add the following lines to the .bashrc file:

    source /opt/ros/<ros_version>/setup.sh
    source /home/pi/catkin_ws/devel/setup.bash
    export ROS_MASTER_URI=http://localhost:11311
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.171.253