Skip to content

Instantly share code, notes, and snippets.

@kurogane1031
Last active February 16, 2021 06:34
Show Gist options
  • Save kurogane1031/6059e9ef18bb4223afdf959582a21316 to your computer and use it in GitHub Desktop.
Save kurogane1031/6059e9ef18bb4223afdf959582a21316 to your computer and use it in GitHub Desktop.
ROS

Compile commands

Example if one try to use python 3.6.5 located in pyenv environment

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DSETUPTOOLS_DEB_LAYOUT=OFF -DPYTHON_EXECUTABLE=/home/user/.pyenv/versions/3.6.5/bin/python3.6m -DPYTHON_INCLUDE_DIR=/home/user/.pyenv/versions/3.6.5/include/python3.6m -DPYTHON_LIBRARY=/home/user/.pyenv/versions/3.6.5/lib/libpython3.6m.so

NOT YET WORKING

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DSETUPTOOLS_DEB_LAYOUT=OFF -DPYTHON_EXECUTABLE=~/.pyenv/versions/ros/bin/python3 -DPYTHON_INCLUDE_DIRS=~/.pyenv/versions/3.6.9/include/python3.6m

ROS from source only works on 3.6.9 and below

installing sip

wget ftp://ftp.calculate-linux.org/calculate/source/sip/sip-4.19.22.tar.gz
python configure.py
make
make install
python_oculus
ros_comm/roslz4
rospack
qt_gui_cpp

qt_gui_cpp possible solution to sip issue

Possibly due to using pyenv and everything, default_sip_dir == home/zulfaqar/.pyenv/versions/ros/share/sip, which is not a folder. I edited sipconfig.py to point to a proper folder, i.e. /usr/share/sip

std_msgs error

pip install pyyaml
pip install empy 

(!!! do not install em source)

Compile Error Logs

UTF-8 Error

jsk_recognition_utils compile error as follows

SyntaxError: Non-ASCII character '\xe3' in file test-enc.py on line 1, 
but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

Append # coding: utf-8 in jsk_recognition/jsk_recognition_utils/python/jsk_recognition_utils/CMakeLists.txt as follows

COMMAND python$ENV{ROS_PYTHON_VERSION} -c "#coding: utf-8; import sys, numpy; sys.stdout.write(numpy.get_include())"

No package libsiftfast found

Clone https://github.com/jsk-ros-pkg/jsk_3rdparty and compile

AttributeError: 'urllib' object has no attribute 'urlretrieve'

Source This error occured when compiling assimp_devel package. However, the culprit is download_checkmd5.py in ros/rosbuild/core/rosbuild/bin. This is due to urllib written in the file uses Python 2 syntax. In Python 3, urllib module is separated, thus it wont work.

A workaround is to edit download_checkmd5.py and add the following

import urllib.request
data = urllib.request.urlretrieve("http://...")

Unit testing is convenient and fun. The output is easy to read. However, if combined with catkin build, you will have to go through a nightware series of compiler output. So what to do? A few option is available.

  1. The easiest is to run the test directly using rosrun.
  2. The long way is to use the following command by TakeTwo's answer from catkin repository issue
$ catkin run_tests | sed -En '/^-- run_tests.py/,/^-- run_tests.py/p'
  1. Use catkin_make run_tests. You have to compile your nodes with catkin_make for this one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment