ROS GoPiGo3 Node Build - Success!

(I think) I successfully built/setup the ROS catkin build system. (ROS-COMM option / no GUI)

Next, following: Starting with ROS on the GoPiGo3 and the Raspberry Pi

When attempting to build the ROS GoPiGo3 Node it does not seem to be creating the node:

pi@ROSPI:~/gopigo3_ws $ catkin_make
Base path: /home/pi/gopigo3_ws
Source space: /home/pi/gopigo3_ws/src
Build space: /home/pi/gopigo3_ws/build
Devel space: /home/pi/gopigo3_ws/devel
Install space: /home/pi/gopigo3_ws/install
Creating symlink "/home/pi/gopigo3_ws/src/CMakeLists.txt" pointing to "/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake"
####
#### Running command: "cmake /home/pi/gopigo3_ws/src -DCATKIN_DEVEL_PREFIX=/home/pi/gopigo3_ws/devel -DCMAKE_INSTALL_PREFIX=/home/pi/gopigo3_ws/install -G Unix Makefiles" in "/home/pi/gopigo3_ws/build"
####
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/pi/gopigo3_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python (found version "2.7.13") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/pi/gopigo3_ws/build/test_results
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.18
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/gopigo3_ws/build
####
#### Running command: "make -j4 -l4" in "/home/pi/gopigo3_ws/build"
####
pi@ROSPI:~/gopigo3_ws $ 

!!! Don’t know how to check if that succeeded or error’d !!!

Continuing with the process:

pi@ROSPI:~/gopigo3_ws $ cd ~
pi@ROSPI:~ $ echo "source ~/gopigo3_ws/devel/setup.bash" >> ~/.bashrc
pi@ROSPI:~ $ source ~/.bashrc
pi@ROSPI:~ $ cd ~/gopigo3_ws/devel
pi@ROSPI:~/gopigo3_ws/devel $ source setup.bash

So now to test it:

pi@ROSPI:~/gopigo3_ws/devel $ roslaunch gopigo3_node gopigo3.launch
[gopigo3.launch] is neither a launch file in package [gopigo3_node] nor is [gopigo3_node] a launch file name
The traceback for the exception was written to the log file

(Also, I don’t know where the log file is that it is referring to.)

@cyclicalobsessive,

Those instructions are incomplete and out of date.

Use these instructions instead.

Regards,
Tom C

Now following the new instruction page:

pi@ROSPI:~/gopigo3_ws $ rosdep install --from-paths src --ignore-src -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
gopigo3_node: No definition of [tf] for OS [debian]

and

catkin_make failing - Ideas?

pi@ROSPI:~/gopigo3_ws $ catkin_make
Base path: /home/pi/gopigo3_ws
Source space: /home/pi/gopigo3_ws/src
Build space: /home/pi/gopigo3_ws/build
Devel space: /home/pi/gopigo3_ws/devel
Install space: /home/pi/gopigo3_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/pi/gopigo3_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/pi/gopigo3_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/pi/gopigo3_ws/build/test_results
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.18
-- BUILD_SHARED_LIBS is on
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
  Could not find a package configuration file provided by "geometry_msgs"
  with any of the following names:

    geometry_msgsConfig.cmake
    geometry_msgs-config.cmake

For the latest on this: https://github.com/ros-gopigo/gopigo3_node/issues/7

Decision: This is not an issue with GoPiGo3 Node. The GoPiGo3 Node requires ROS packages not installed by the current ROSberryPi install wiki “recommended variant ros-comm”:

  • geometry_msgs
  • rospy
  • sensor_msgs
  • nav_msgs
  • tf (listed in packages.xml and still available, but is deprecated by tf2)

So I closed this issue, and am continuing to investigate how to build a ROS environment with the needed packages.

Asking this on answers.ros.org:

I’m attempting to create a ROS Kinetic installation on Raspbian-Stretch that has the packages needed for a GoPiGo3 node.

I followed ROSberryPiInstalling ROS Kinetic on the Raspberry Pi and chose the “recommended by the wiki” ROS-COMM variant. (The wiki states only the ROS-COMM and DESKTOP variants have been “tested in Kinetic”.)

I followed ROS-GOPIGO3_NODE: INSTALLATION, but my ROS is missing the following packages:

  • geometry_msgs
  • rospy
  • sensor_msgs
  • nav_msgs tf (listed in packages.xml but is deprecated by tf2)

Should I ??

  • install only the missing packages,
  • start over and install the “tested” DESKTOP variant, or
  • start over and attempt one of the REP-131 (groovy variants?)
    – install “ros-base (ros,ros_comm)”, or
    – install "robot(extends ros-base with a bunch of stacks)

Success by adding the needed packages to the ros_comm installation done previously:

====== adding packages/stacks needed for GoPiGo3_Node

$ cd ~/ros_catkin_ws

$ rosinstall_generator ros_comm geometry_msgs rospy sensor_msgs nav_msgs tf --rosdistro kinetic --deps --wet-only --tar >kinetic-custom_ros.rosinstall

$ wstool merge -t src kinetic-custom_ros.rosinstall
Performing actions:

 Add new elements:

actionlib, angles, common_msgs/actionlib_msgs, common_msgs/geometry_msgs, common_msgs/nav_msgs, common_msgs/sensor_msgs, geometry/tf, geometry2/tf2, geometry2/tf2_msgs, geometry2/tf2_py, geometry2/tf2_ros

Config changed, maybe you need run wstool update to update SCM entries.
Overwriting /home/pi/ros_catkin_ws/src/.rosinstall

update complete.

$ wstool update -t src

$ rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:stretch

$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j2

It Worked

1 Like

@cyclicalobsessive,

I ran your CLI command strings and got a successful install.

Nice work, much appreciated as I am a noob when it comes to Raspbian Linux programming.

I then went back and successfully performed the following:

  • ’ cd ~’
  • mkdir -p gopigo3_ws/src
  • ’ cd ~’
  • ’ git clone https://github.com/ros-gopigo/gopigo3_node.git
  • ’ cd gopigo3_node’
  • ’ sudo mv * ~/gopigo3_ws/src’
  • ’ cd ~/gopigo3_ws/’
  • sudo mv * ~/gopigo3_ws/src
  • cd ~/gopigo3_ws/
  • rosdep install --from-paths src --ignore-src -y
  • catkin_make
  • echo "source ~/gopigo3_ws/devel/setup.bash" >> ~/.bashrc
  • source ~/.bashrc
  • cd ~/gopigo3_ws
  • source devel/setup.bash

However, when attempting to run the commands in “Test Your Installation”, I received a OSError:[Errno 13} error message near the bottom of the CLI:
pi@dex:~/gopigo3_ws/devel $ roslaunch gopigo3_node gopigo3.launch
… logging to /home/pi/.ros/log/fc7e3620-cfff-11e9-b77c-b827eb72f61b/roslaunch-dex-1328.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://dex:45653/

SUMMARY

PARAMETERS

  • /rosdistro: kinetic
  • /rosversion: 1.12.14

NODES
/
gopigo3 (gopigo3_node/gopigo3_driver.py)

auto-starting new master
process[master]: started with pid [1338]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to fc7e3620-cfff-11e9-b77c-b827eb72f61b
process[rosout-1]: started with pid [1362]
started core service [/rosout]
process[gopigo3-2]: started with pid [1365]
Traceback (most recent call last):
File “/home/pi/gopigo3_ws/src/src/gopigo3_driver.py”, line 273, in
Robot()
File “/home/pi/gopigo3_ws/src/src/gopigo3_driver.py”, line 59, in init
gpio_direction = os.open("/sys/class/gpio/gpio"+self.POWER_PIN+"/direction", os.O_WRONLY)
OSError: [Errno 13] Permission denied: ‘/sys/class/gpio/gpio23/direction’
[gopigo3-2] process has died [pid 1365, exit code 1, cmd /home/pi/gopigo3_ws/src/src/gopigo3_driver.py __name:=gopigo3 __log:=/home/pi/.ros/log/fc7e3620-cfff-11e9-b77c-b827eb72f61b/gopigo3-2.log].
log file: /home/pi/.ros/log/fc7e3620-cfff-11e9-b77c-b827eb72f61b/gopigo3-2*.log
^C[rosout-1] killing on exit

I believe that the problem may be due to the “/” in front of the “/sys/class/gpio/gpio/gpio23/direction” path?

I will send my error report to Christian to see what he says.

Regards,
Tom C

No - not that, and not his issue.

It looks to me like a configuration issue for python to tell you it does not have permission to mess with the GPIO pin or that another process has “claimed” the GPIO pin you want.

Make sure there is no pgpiod process running:

ps -ef | grep pgpiod
pi 2145 1292 0 15:14 pts/0 00:00:00 grep --color=auto pgpiod

There should only be that one process listed which is the grep looking at the the process list.

Did you set up a remote desktop (or if you built over Raspian4Robots you can use the browser desktop)?

It would be good to check out that the DI software is correctly functioning by running the GoPiGo3 Control Panel. That says that python and paths and permissions are correct.

I would also try re-running the DI software update:

=== Update GoPiGo3 software to latest (This must be done on the GoPiGo3!):
REBOOT
sudo shutdown -h now
wait 20
push power button (turns off)
wait 20
push power button (turn on )

(ssh in or bring up remote desktop or web console)
cd ~

sudo curl -kL dexterindustries.com/update_gopigo3 | bash

=== REBOOT
sudo shutdown -h now
wait 20
push power button (turns off)
wait 20
push power button (turn on )

You are close. This is what it will look like when it gets past setting up the power monitor pin:

$ roslaunch gopigo3_node gopigo3.launch

… logging to /home/pi/.ros/log/60e1e0aa-cff4-11e9-bab6-b4750e1f7fdb/roslaunch-ROSPI-1692.log

Checking log directory for disk usage. This may take awhile.

Press Ctrl-C to interrupt

Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ROSPI:35717/

SUMMARY

========

PARAMETERS

  • /rosdistro: kinetic

  • /rosversion: 1.12.14

NODES

/

gopigo3 (gopigo3_node/gopigo3_driver.py)

auto-starting new master

process[master]: started with pid [1723]

ROS_MASTER_URI=http://localhost:11311

setting /run_id to 60e1e0aa-cff4-11e9-bab6-b4750e1f7fdb

process[rosout-1]: started with pid [1777]

started core service [/rosout]

process[gopigo3-2]: started with pid [1783]

GoPiGo3 info:

Manufacturer : Dexter Industries

Board : GoPiGo3

Serial Number : BA93EB4F514E3437324A2020FF040B1F

Hardware version: 3.x.x

Firmware version: 1.0.0

new_angle2 0.0

new_angle2 0.0

new_angle2 0.0

new_angle2 0.0

@cyclicalobsessive,

Thanks for the update and the commands, much appreciated.

I will give it a shot. Learning a lot here.

While I was waiting for a response I thought that I would try out the instructions in " Installing the RPLidar Lidar Sensor on the Raspberry Pi" to see if there were any issues using “catkin_make” and there weren’t.

So I attached the RPLidar to a Rpi 3B+ USB port and found that it was on ttyUSB0 and proceeded to give permission to use USB0.

I then used “roslaunch rplidar_ros view_rplidar.launch” to start the program and things were looking good until I got this message:

process[rplidarNode-2]: started with pid [3212]
ERROR: cannot launch node of type [rviz/rviz]: rviz
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/pi/rplidar_ws/src
ROS path [2]=/home/pi/gopigo3_ws/src
ROS path [3]=/opt/ros/kinetic/share
[ INFO] [1567712640.471817258]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.10.0
RPLIDAR S/N: A1BF9AF2C1EA9FC3BEEB9CF32E6C3203
[ INFO] [1567712642.981428955]: Firmware Ver: 1.25
[ INFO] [1567712642.981644944]: Hardware Rev: 5
[ INFO] [1567712642.985126031]: RPLidar health status : 0
[ INFO] [1567712643.549147614]: current scan mode: Express, max_distance: 12.0 m, Point number: 4.0K , angle_compensate: 1

So the program is definitely talking to the RPLidar, but is not displaying the RPLidar sensor data due to the lack of the being able to launch the rviz node which is supposed to display the data.

It looks like we are missing the rviz node in our present ROS Kinetic build?

Regards,
Tom C.

OUCH - you want rviz? That means you should have installed the desktop and the dependancies might or might not be there:

So your step would look like:

$ rosinstall_generator desktop geometry_msgs rospy sensor_msgs nav_msgs tf --rosdistro kinetic --deps --wet-only --tar >kinetic-custom_ros.rosinstall

$ wstool init src kinetic-custom_ros.rosinstall

@cyclicalobsessive,

Updating the GoPiGo3 software and then REBOOTing did the trick. When I first updated the GoPiGo3 software I did not do a reboot and I think that was the problem.

roslaunch gopigo3_node gopigo3.launch executed and produced an output just like in your post above.

Unfortunately if I want to see the RPLidar output then I guess that I am going to have to install the Desktop to be able to use rviz.

If you plan to use the RPLidar for SLAM to allow Carl to navigate a room and find his charging station more efficiently than using the distance sensor and accurate wheel rotation then you might want to install the Desktop.

The -j2 option doesn’t get involved with the Desktop ROS install?

Thanks for all the help, much appreciated. Again, learning a lot. Love to see examples. That is way that I learned to program my Arduino with C++.

Regards,
Tom C

Yes, but I was thinking about this - You need to find someone (or a tutorial?) to help you install a desktop ROS environment on your laptop, and just run the minimal ROS environment possible on the RPi of the GoPiGo3.

That is one of the advantages of ROS, that the GUI and 2D or 3D display work can happen on a dedicated machine, preferably one with a strong graphics processor either by subscribing to the timestamped sensor messagages (topics) or by processing a recorded bag of topics.

I have been “watching” ROS for the last 10 years or so, always admiring it, but also always shying away from it because of the complexity. My first programming jobs were programming computers on “bare metal” - no operating system, no function libraries, and everything the computer did, I told it to do - everything.

I didn’t like mainframes because they all came with an operating system that did mysterious things someone else told them to do.

Today, we not only have operating systems and a plethora of special purpose function stacks, our little GoPiGo3 can send requests “into the cloud” and only perform essential operations. I know that Google does better speech recognition, better text-to-speech, and better image recognition than I can do keeping everything local on Carl’s RPi, but I will feel better knowing how and what is going on at any moment. I’m still old school, doing everything local on my GoPiGo3, and trying to understand (and control) every thought and action of my bot.

This foray into ROS has fulfilled a dream, and I have you to thank for it. It was really fun, and I will be watching for your success reports here.

Carl really needs me to get back to finishing my OpenCV in Python course so I can help him finish his docking behavior. There are just too many interesting subjects to investigate.

@cyclicalobsessive,

After reading your post above, I fully agree with determining how to install the ROS Desktop environment on my PC and keep the GoPiGo3 ROS install at a minimum as you have suggested.

However, I did try using your command string to add the ROS Desktop, but it did not work and the original installation from your post of 9/4 was compiled as there were 88 packages processed just like before.

I think that the problem may lie with the “wstool init src kinetic-custom_ros.rosinstall” command string as CLI came back with " a confi.? file already exists and a “modify” option was required to make the necessary changes.

I will see what I can find on doing such an installation.

Regards,
Tom C

@cyclicalobsessive,

This website gives instructions on how to setup a ROS workstation on a Desktop or Laptop with emphasis on using the ROS workstation to connect with your robot.

The have an out of the box virtual machine that can run on Windows and a native ROS installation. The downside of the virtual machine is that the process of virtualization saps performance from your system so things will not be as fast as if you are running natively. On a fast system you may not notice this. In any event, the virtualization system is a good way to try out having a workstation before committing to set one up on your laptop.

The only problem I see with this virtual machine ROS workstation is that it may be designed to only communicate with their specific robot OS.

My laptop is has an I7 processor, 8GB of ram, and a 1TB hard drive so it should be up to the task of the ROS virtual machine requirements.

Comments?

Regards,
Tom C

Personally, before running to create a two machine ROS environment to visualize the LIDAR topics, I would want to understand what is successfully running right now and how it is working.

For me, the best way to do this is to have

  1. the github ros-gopigo3 software in one browser tab, and
  2. the ROS Tutorials open in another tab, and
  3. the GoPiGo3 desktop open (in tab of RaspianForRobots, or remote desktop to tightvncserver on plain Stretch) with the GoPiGo3 Control Panel open
    (or an ssh shell with ~/Dexter/GoPiGo3/Projects/BasicRobotControl/run_this.py running - to use keyboard commands )

so I can drive the robot around and see what ROS messages come out.

The questions most pressing on my mind are:

  • What exactly was printing the wheel encoder status?
  • Do other status show up when I drive the bot around?
  • The GoPiGo3 node subscribes to some command topics - how do I send them from the cmd line?
 # subscriber
        rospy.Subscriber("motor/dps/left", Int16, lambda msg: self.g.set_motor_dps(self.ML, msg.data))
        rospy.Subscriber("motor/dps/right", Int16, lambda msg: self.g.set_motor_dps(self.MR, msg.data))
  • How do I see other status the GoPiGo3 node publishes - like the battery voltage and odometry? (These should be easy)
# publisher
...
        self.pub_battery = rospy.Publisher('battery_voltage', Float64, queue_size=10)
...
        self.pub_odometry = rospy.Publisher("odom", Odometry, queue_size=10)
  • How do I use the existing GoPiGo3 node src/distance_sensor.py so that distance sensor range is published,
    and how do I get the console that is showing the wheel angle to also display these range msgs?

  • How do I add CPU temperature status? (This will be a little harder. This is important when using speech reco or OpenCV to process the camera, as the GoPiGo3 does not have space for a big heatsink on the CPU.)

These are the “under the covers” topics that the visual ROS desktop will be subscribing and publishing to the GoPiGo3 node once I learned how to setup the correct desktop tool on my Mac. So lastly I would do the correct tutorial to learn:

  • How do I install the ROS desktop (native) on my Mac and configure it to know about my GoPiGo3 node?

.

That’s how I would approach this, if I were to continue my ROS adventure.

p.s. I already know the specific configuration (wheel_base, and wheel_diameter) to make Carl accurately drive and turn, which would make it more likely my odometry topic will be close to reality. This becomes important if you want to move or turn based on the robot’s perceived environment.

@cyclicalobsessive,

Excellent observations and insights.

The link to the website I posted above is a bust. They expect to use the robot as a wifi router and have the virtual ROS workstation communicate with that wifi router which is a no go for me.

Regards,
Tom C

1 Like

@cyclicalobsessive,

Since I had a couple of spare 16GB SD cards lying around, I decided to build a Raspbian Stretch OS and add the ROS Desktop version instead of the ROS Basic.

I will then build the RPLidar workspace so that I can test the RPLidar A1 M8 that I purchased from Adafruit. This way I can at least a feeling for the operation of the RPLidar and then go back to my GoPiGo3 R4R or GoPiGo3_Node environments which are on my 32GB SD card.

Update: The ROS Desktop build failed at this point:

[100%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o
[100%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/
/src2/cv2.cpp.o

I let it run on the last build for almost 45 minutes and then did a ^C. The green led on the Rpi was on for the whole 45 minutes.

Regards,
Tom C

1 Like