A prototypical simulation of a TurtleBot2 robot using Gazebo, ROS, PCL & OpenCV. The goal is to allow a random selection and pushing of different cubes with the possibility to return to the initial starting position. This scenario is intended to mimic the way an infant would learn about the basic physical property of mass (developmental learning). This scenario is suppossed to be explored in future machine learning projects.
TESTED AND WORKING ON: Ubuntu 16.04.6 LTS Xenial, using ROS kinetic 1.12.14, PCL 1.7, Boost 1.58.0.
First configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse.", then setup source lists:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init
rosdep update
sudo apt-get install ros-kinetic-turtlebot* ros-kinetic-kobuki* ros-kinetic-gazebo*
!!! IMPORTANT INFO !!!
You will need to copy the _.gazebo/_ folder in this repository to your gazebo installation folder, usually located at _~/.gazebo/_, to add the custom models needed for this simulation. You will also need to replace two URDF files that define the TurtleBot model. These files can be found in the ROS installation path, usually in _/opt/ros/kinetic/share/turtlebot_description/urdf/_, replace the _sensors/_ folder with the custom one from _./custom/sensors/_ and also replace the default file _"turtlebot_gazebo.urdf.xacro"_ with the one provided in the _./custom_folder directory.
Creating a catkin workspace, copy the project wherever it is located into the src folder and build it:
mkdir -p ~/catkin_ws/src
cp -R ~/mlbot ~/catkin_ws/src
catkin_make
In the same terminal, add the workspace to the ROS environment by sourcing the generated setup file:
source ~/catkin_ws/devel/setup.bash
roscore
export TURTLEBOT_GAZEBO_WORLD_FILE=~/catkin_ws/src/mlbot/custom mlbot.world
roslaunch turtlebot_gazebo turtlebot_world.launch
rosrun mlbot mlbot_node
roslaunch turtlebot_rviz_launchers view_robot.launch
roslaunch turtlebot_teleop keyboard_teleop.launch