To install
cd ~
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.13/opencv-2.4.13.zip
cd opencv-2.4.13
mkdir release
cd release
To Make
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D EIGEN_INCLUDE_PATH=/usr/local/include/eigen3/ -D WITH_OPENCL=OFF ..
And then install
sudo make install
Important for ROS and OpenCV
- Copy configuration to bashrc.
CMAKE_PREFIX_PATH=/home/leo/opencv-2.4.13/release:$CMAKE_PREFIX_PATH CPATH=/home/leo/opencv-2.4.13/build/include:$CPATH LD_LIBRARY_PATH=/home/leo/opencv-2.4.13/release/lib:$LD_LIBRARY_PATH- add links to CMakeLists.txt
Set(OpenCV_DIR ~/opencv-2.4.13/release) Include_directories(~/opencv-2.4.3/include)
sudo apt-get update
sudo apt-get upgrade
Now, you need to install many dependencies, such as support for reading and writing image files, drawing on the screen, some needed tools, other libraries, etc… This step is very easy, you only need to write the following command in the Terminal:
sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev default-jdk ant libvtk5-qt4-dev
To install
cd ~
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip
cd opencv-2.4.9
mkdir build
cd build
With out CUDA support and correct path of Eigen and also need to off the OPENCL
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D ENABLE_FAST_MATH=0 D CUDA_FAST_MATH=0 -D WITH_CUBLAS=0 -D EIGEN_INCLUDE_PATH=/usr/local/include/eigen3/ ..
And then install
sudo make install
sudo subl ~/.bashrc
And add the lines
source /home/leo/catkin_ws/devel/setup.bash
CMAKE_PREFIX_PATH=/home/leo/opencv-2.4.9/build:$CMAKE_PREFIX_PATH
CPATH=/home/leo/opencv-2.4.9/build/include:$CPATH
LD_LIBRARY_PATH=/home/leo/opencv-2.4.9/build/lib:$LD_LIBRARY_PATH
sudo updatedb
#sudo ln -s (orginal located file, -> new located file)
sudo ln -s /usr/local/lib/libopencv_videostab.so.2.4.8 /usr/lib/x86_64-linux-gnu/libopencv_videostab.so.2.4.8
locate libopencv_videostab.so.2.4.8
ls /usr/local/lib/libopencv_*
ls /usr/local/lib/libopencv_*.so
for i in '/usr/local/lib/libopencv_*.so.2.4.8'; do sudo ln -s $i /usr/lib/x86_64-linux-gnu/; done;
ls /usr/lib/x86_64-linux-gnu/libopencv_n*
sudo mv /usr/lib/x86_64-linux-gnu/libopencv_nonfree.so /usr/lib/x86_64-linux-gnu/libopencv_nonfree.so.static
ls /usr/lib/x86_64-linux-gnu/libopencv_n*
sudo ln /usr/local/lib/libopencv_nonfree.so /usr/lib/x86_64-linux-gnu/ -s
mkdir build
leo@ramlab:~/awc_pc_fusion/src/lsd_slam/lsd_slam_core$ cd build/
leo@ramlab:~/awc_pc_fusion/src/lsd_slam/lsd_slam_core/build$ ls
leo@ramlab:~/awc_pc_fusion/src/lsd_slam/lsd_slam_core/build$ ccmake ..
install the eigen using
sudo apt-get install libeigen2.dev
sudo apt-get install libeigen3.dev
Copy the folder to home directory cd eigen mkdir build cd build cmake .. make sudo make install
Eigen must be /usr/include otherwise please add using ln -s directory_name Folder_Name
cd /usr/local/include
sudo ln -sf eigen3/Eigen Eigen
• Download Eigen 3.1.2 from http://eigen.tuxfamily.org/index.php?title=Main_Page. • Open a terminal (Ctrl+Alt+T) and run:
cd ~/Downloads
tar xzf eigen-eigen-5097c01bcdc4.tar.bz2
cd eigen-eigen-5097c01bcdc4
sudo cp -r Eigen /usr/include/
• Done! • Copy the Eigen directory to /usr/include. You'd neet root user privileges to do that. So, open a terminal, browse to the directory containing the Eigen directory, and run sudo cp -r Eigen /usr/include/. • To include a header file, say Dense, from the Eigen directory use
#include <Eigen/Dense>
export PATH=$PATH:/usr/local/MATLAB/R2017a/bin
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/leo/catkin_ws/src
source /opt/ros/indigo/setup.bash
source /home/leo/catkin_ws/devel/setup.bash
CMAKE_PREFIX_PATH=/home/leo/opencv-2.4.9/build:$CMAKE_PREFIX_PATH
CPATH=/home/leo/opencv-2.4.9/build/include:$CPATH
LD_LIBRARY_PATH=/home/leo/opencv-2.4.9/build/lib:$LD_LIBRARY_PATH
# source ~/rosbuild_ws/setup.bash
export VREP_ROOT=/home/leo/V-REP_PRO_EDU_V3_4_0_Linux
export VREP_ROOT_DIR=/home/leo/V-REP_PRO_EDU_V3_4_0_Linux
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${VREP_ROOT}/programming/ros_stacks
- Launch in a lauch file example of ma_slam
<launch>
<node name="live_slam1" pkg="lsd_slam_core" type="live_slam" args="__name:=lsd_slam_r1 lsd_slam/keyframes:=lsd_slam_r1/keyframes lsd_slam/graph:=lsd_slam_r1/graph lsd_slam/pose:=lsd_slam_r1/pose lsd_slam/liveframes:=lsd_slam_r1/liveframes lsd_slam/debug:=lsd_slam_r1/debug camera_info:=/usb_cam_r1/camera_info image:=/usb_cam_r1/image_rect" output="screen" />
<node name="live_slam2" pkg="lsd_slam_core" type="live_slam" args="__name:=lsd_slam_r2 lsd_slam/keyframes:=lsd_slam_r2/keyframes lsd_slam/graph:=lsd_slam_r2/graph lsd_slam/pose:=lsd_slam_r2/pose lsd_slam/liveframes:=lsd_slam_r2/liveframes lsd_slam/debug:=lsd_slam_r2/debug camera_info:=/usb_cam_r2/camera_info image:=/usb_cam_r2/image_rect" output="screen" />
<node name="slave_robot1" pkg="slave_robot1" type="slave_robot1" args="__name:=slave_robot1" output="screen" />
<node name="slave_robot2" pkg="slave_robot2" type="slave_robot2" args="__name:=slave_robot2" output="screen" />
<node name="rviz_1" pkg="rviz" type="rviz" args="-d /home/leo/catkin_ws/src/ma_slam/rviz_config.rviz" output="log" />
<node pkg="rosbag" type="play" name="player1" output="screen" args="/home/leo/catkin_ws/src/bag_files/longRIinside/robot1.bag --clock /narrow_stereo/camera_info:=/usb_cam_r1/camera_info /narrow_stereo/image_rect:=/usb_cam_r1/image_rect "/>
<node pkg="rosbag" type="play" name="player2" output="screen" args="/home/leo/catkin_ws/src/bag_files/longRIinside/robot2.bag --clock /narrow_stereo/camera_info:=/usb_cam_r2/camera_info /narrow_stereo/image_rect:=/usb_cam_r2/image_rect"/>
</launch>
Odometry | ROS Links
To run
rosrun odometry_publisher_tutorial odometrpublisherTo View
rvizSelect the
/odem
topic and it will show the poses.
Segmentation Core Faults possible errors can be due to;
- Directory existance
- Use gdb answered Dec 29 '14
You probably want to take a look at roslaunch/Tutorials/Roslaunch Nodes in Valgrind or GDB.Make sure to build proper Debug binaries.
Btw: this is not really specific to catkin_make
. The launch-prefix
just makes this convenient when starting things from launch files. For single nodes (and an already running master), you can also just do:
gdb --args /path/to/your/node/binary
gdb devel/lib/[ros package]/[ros node]
I haven't found anything regarding this on the internet so far. The tutorial I linked was actually the first result after searching for ros gdb on Google.
Edit:
I have tried starting gdb directly with the executable but it says no debugging symbols found
.
I have also tried to do set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -std=c++11 -march=native" )
without success.
This has been answered before, see fi Cmake debug option:
This will set -g for you:
For a release with debug configuration, with optimizations and debug symbols, you can use the RelWithDebInfo
build type:
catkin_make -DCMAKE_BUILD_TYPE=RelWithDebInfo
CMake's useful variables page gives more information about build types.
Official User manual and Wiki Docs
Just extract and run
./vrep.sh
To Install vrep_ros_bridge
First
git clone https://github.com/lagadic/vrep_ros_bridge.git
- If you are using the last version of V-REP (V3_4_0_Linux) and you are under Ubuntu 14.04 you have to download an older version of V-REP (V-REP_PRO_V3_3_2_64_Linux for example) and copy paste the file compiledRosPlugins/libv_repExtRos.so from here.
- Copy the folders vrep_plugin and vrep_common from home/leo/V-REP_PRO_V3_3_2_64_Linux/programming/ros_packages in your catkin_ws/src and do a catkin_make.
- You will find in devel the file libv_repExtRos.so. You will need to copy it in the root of the new V-REP Folder.
Some problem catches: 1. Cannot find V-REP installation. Please set the VREP_ROOT environment variable to point to the root of your V-REP installation. to deal with:
export VREP_ROOT=/home/leo/V-REP_PRO_EDU_V3_4_0_Linux
# Mine is ${HOME}/V-REP_PRO_EDU_V3_4_0_Linux
# To check, please verify using
cd $VREP_ROOT
Course Project Tutorial
The newest version of regarding softwares is recommended. ROS: Kinetic V-REP: 3.5.0 PRO EDU Plugins(Please git clone them from the latest master): vrep_ros_bridge vrep_ros_interface Platform: Ubuntu 16.04 LTS
For vrep_ros_bridge, if you choose V-REP 3.5.0 PRO EDU, please notice:
If you are using Ubuntu 16.04 and ROS Kinetic you will need to compile the plugin by yourself: Copy the folders vrep_plugin and vrep_common from home/user/Desktop/V-REP_PRO_V3_3_2_64_Linux/programming/ros_packages in your catkin_ws/src and do a catkin_make. You will find in devel the file libv_repExtRos.so. You will need to copy it in the root of the new V-REP Folder.
which means, besides V-REP: 3.5.0 PRO EDU you also need to download V-REP_PRO_EDU_V3_3_2_64_Linux.tar.gz, see → Previous versions of V-REP are available here in the http://www.coppeliarobotics.com/downloads.html or http://www.coppeliarobotics.com/previousversions.html. Direct link: http://coppeliarobotics.com/files/V-REP_PRO_EDU_V3_3_2_64_Linux.tabr.gz Or you can access it on shared Course Google Drive, it's in root/Softwares
fatal error: opencv2/opencv.hpp: No such file or directory
sudo apt-get install libopencv (https://askubuntu.com/questions/656461/where-is-opencv-installed)
opencv2/photo/photo.hpp: No such file or directory
sudo apt-get install libopencv-dev (https://stackoverflow.com/questions/35281312/fatal-error-opencv2-photo-hpp-opencv-3-0-install)
Install OpenCV
The above environment is test by TA. If you have any problems, please contact kan.huang.hkust@gmail.com | kan.huang@connect.ust.hk
Here are some useful links for you.
The hyperlinks above, which containing the installation tutorials, and
Ros Bridge Installation test
Pay attention, since installation of vrep_ros_bridge uses catkin_make, and ROS Interface plugin for V-REP uses catkin build, you can create different catkin workspaces for them, refer to this article Create a temporary catkin workspace for ROS Interface. Note! This is just an example for creating tmp workspace, don't use her git clone. Use the latest one:
git clone https://github.com/CoppeliaRobotics/v_repExtRosInterface
put the cloned vrep_ros_interface repo in your new workspace like:
quickstart_ws/src
some problem catches: 1. Cannot find V-REP installation. Please set the VREP_ROOT environment variable to point to the root of your V-REP installation. to deal with:
export VREP_ROOT=YOUR_VREP_3_5_PATH
# Mine is ${HOME}/V-REP_PRO_EDU_V3_5_0_Linux
runprogram('xsltproc', '-o', output('reference.html'), rel('xsl/reference.xsl'), input_xml)
File "/home/huangkan/quickstart_ws/src/vrep_ros_interface/external/v_repStubsGen/generate.py", line 50, in runprogram
runsubprocess(what, [what] + list(args))
File "/home/huangkan/quickstart_ws/src/vrep_ros_interface/external/v_repStubsGen/generate.py", line 38, in runsubprocess
child = subprocess.Popen(args)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
to deal with:
sudo apt install xsltproc
Remember, we only need a temporary catkin workspace to compile the source files of vrep_ros_bridge and vrep_ros_interface, because we just need the library files(*.so), which should be copied into root path of vrep_3.5.0_edu for it to load.
After configing the environment, run
roscore
first. And in another terminal, run(cd to VREP_ROOT)
./vrep.sh
You should see the loading details of plugins, including ROS Bridge and ROS Interface.
huangkan@Y480:~/V-REP_PRO_EDU_V3_5_0_Linux$ ./vrep.sh
Using the default Lua library.
Loaded the video compression library.
Add-on script 'vrepAddOnScript-addOnScriptDemo.lua' was loaded.
Simulator launched.
Plugin 'MeshCalc': loading...
Plugin 'MeshCalc': load succeeded.
Plugin 'BlueZero': loading...
Plugin 'BlueZero': warning: replaced variable 'simB0'
Plugin 'BlueZero': load succeeded.
Plugin 'BubbleRob': loading...
Plugin 'BubbleRob': load succeeded.
Plugin 'Bwf': loading...
Plugin 'Bwf': load succeeded.
Plugin 'Collada': loading...
Plugin 'Collada': load succeeded.
Plugin 'ConvexDecompose': loading...
Plugin 'ConvexDecompose': load succeeded.
Plugin 'CustomUI': loading...
Plugin 'CustomUI': warning: replaced variable 'simUI'
Plugin 'CustomUI': load succeeded.
Plugin 'DynamicsBullet-2-78': loading...
Plugin 'DynamicsBullet-2-78': load succeeded.
Plugin 'DynamicsBullet-2-83': loading...
Plugin 'DynamicsBullet-2-83': load succeeded.
Plugin 'DynamicsNewton': loading...
Plugin 'DynamicsNewton': load succeeded.
Plugin 'DynamicsOde': loading...
Plugin 'DynamicsOde': load succeeded.
Plugin 'DynamicsVortex': loading...
Plugin 'DynamicsVortex': load succeeded.
Plugin 'ExternalRenderer': loading...
Plugin 'ExternalRenderer': load succeeded.
Plugin 'ICP': loading...
Plugin 'ICP': warning: replaced variable 'simICP'
Plugin 'ICP': load succeeded.
Plugin 'Image': loading...
Error with plugin 'Image': load failed (could not load). The plugin probably couldn't load dependency libraries. For additional infos, modify the script 'libLoadErrorCheck.sh', run it and inspect the output.
Plugin 'K3': loading...
Plugin 'K3': load succeeded.
Plugin 'LuaCommander': loading...
Plugin 'LuaCommander': warning: replaced variable 'simLuaComm'
Plugin 'LuaCommander': load succeeded.
Plugin 'LuaRemoteApiClient': loading...
Plugin 'LuaRemoteApiClient': load succeeded.
Plugin 'Mtb': loading...
Plugin 'Mtb': load succeeded.
Plugin 'OMPL': loading...
Plugin 'OMPL': warning: replaced variable 'simOMPL'
Plugin 'OMPL': load succeeded.
Plugin 'OpenMesh': loading...
Plugin 'OpenMesh': load succeeded.
Plugin 'PovRay': loading...
Plugin 'PovRay': load succeeded.
Plugin 'Qhull': loading...
Plugin 'Qhull': load succeeded.
Plugin 'RRS1': loading...
Plugin 'RRS1': load succeeded.
Plugin 'ReflexxesTypeII': loading...
Plugin 'ReflexxesTypeII': load succeeded.
Plugin 'RemoteApi': loading...
Starting a remote API server on port 19997
Plugin 'RemoteApi': load succeeded.
**
Plugin 'Ros': loading...
Plugin 'Ros': load succeeded.
Plugin 'RosInterface': loading...
Plugin 'RosInterface': warning: replaced variable 'simROS'
Plugin 'RosInterface': load succeeded.
**
Plugin 'SDF': loading...
Plugin 'SDF': warning: replaced variable 'simSDF'
Plugin 'SDF': load succeeded.
Plugin 'SurfaceReconstruction': loading...
Plugin 'SurfaceReconstruction': warning: replaced variable 'simSurfRec'
Plugin 'SurfaceReconstruction': load succeeded.
Plugin 'Urdf': loading...
Plugin 'Urdf': load succeeded.
Plugin 'Vision': loading...
Plugin 'Vision': load succeeded.
Using the 'MeshCalc' plugin.
Checking for an updated V-REP version...
This V-REP version is up-to-date.
In V-REP, load the scene file env.ttt. You can use
rostopic list
to see the Topics of vrep. Like
rostopic echo /vrep/cmd_vel
For controling the Pioneer p3dx robot, type the following in terminal
rostopic pub -r 10 /vrep/cmd_vel geometry_msgs/Twist '{linear: {x: 1.0, y: 1.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'
where x stand for the velocity of left wheel, and y for the left. A demo video is attached for your information.
Notes: above cmds are only valid after the simulation is started (the run button is clicked)
Hints: when you don't know the syntax of command, hit tab key in the console. Passing the command using ROS package: you should work by yourself, its part of the project.
This tutorial is still not so pretified and polished, regarding the outline and maybe also details.
If you wish to contribute, you can blame it and create issues on GitHub https://github.com/KellyHwong/ELEC6910R-Public
Two main tool;
Setting python 2.7 as default on Linux
If you have a later version than 2.7 you'll need to set 2.7 as the default Python. Later versions would be 2.7 and 3.6; see what you have by typing
python -V
at the terminal. For purposes of this example we'll assume you have 3.6 installed. You'll next need to execute the following commands:
sudo apt-get install python2.7 idle-python2.7
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10
sudo update-alternatives --config python
This last command will allow you to choose which version of python to use by default. If you have done everything above correctly, python2.7 should already be set as the default. If it is not, choose it to be the default. From now on, running python should start version 2.7.
There are 2 choices for the alternative python (providing /usr/bin/python).
- 0 /usr/bin/python2.7 10 auto mode 1 /usr/bin/python2.7 10 manual mode 2 /usr/bin/python3.6 1 manual mode
Press to keep the current choice[*], or type selection number:
Done
$ python --version Python 3.5.2 $ python2 --version Python 2.7.12 $ python3 --version Python 3.5.2
**Undoing These Changes**
In some cases (e.g., installing or updating certain packages), you'll get an error message if you've run the commands above. To update these packages, you'll have to temporarily undo these changes. Here's how to do that:
```sh
sudo update-alternatives --remove-all python
sudo ln -s python3.6 /usr/bin/python
Once you're done updating these packages, execute the commands at the top to set python2.7 as the default again.