image_builder: TEMP: Add support installation wo sources

This commit is contained in:
Artem Smirnov
2018-09-18 16:41:06 +03:00
parent 23ba569e48
commit 234b377ceb
7 changed files with 144 additions and 207 deletions

View File

@@ -4,59 +4,32 @@
<version>0.0.0</version>
<description>ArUco maps precise pose estimation nodelet</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="okalachev@gmail.com">Oleg Kalachev</maintainer>
<license>MIT</license>
<!--url type="website">http://wiki.ros.org/aruco_pose</url-->
<author email="okalachev@gmail.com">Oleg Kalachev</author>
<author email="urpylka@gmail.com">Artem Smirnov</author>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/aruco_pose</url> -->
<!-- Author tags are optional, multiple are allowed, one per tag -->
<!-- Authors do not have to be maintainers, but could be -->
<!-- Example: -->
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
<!-- The *_depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<!-- <run_depend>message_runtime</run_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>nodelet</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>image_transport</build_depend>
<build_depend>cv_bridge</build_depend>
<build_depend>tf</build_depend>
<!-- Use buildtool_depend for build tool packages: -->
<buildtool_depend>catkin</buildtool_depend>
<!-- Use run_depend for packages you need at runtime: -->
<run_depend>nodelet</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>image_transport</run_depend>
<run_depend>cv_bridge</run_depend>
<build_depend>tf</build_depend>
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<!-- The export tag contains other, unspecified, tags -->
<export>
<nodelet plugin="${prefix}/nodelet_plugins.xml" />
<nodelet plugin="${prefix}/nodelet_plugins.xml" />
<!-- Other tools can request additional information be placed here -->
</export>
</package>

View File

@@ -2,55 +2,30 @@
<package>
<name>clever</name>
<version>0.0.1</version>
<description>The clever package</description>
<description>The CLEVER package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="okalachev@gmail.com">Oleg Kalachev</maintainer>
<license>MIT</license>
<!--url type="website">http://wiki.ros.org/clever</url-->
<author email="okalachev@gmail.com">Oleg Kalachev</author>
<author email="urpylka@gmail.com">Artem Smirnov</author>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/clever</url> -->
<!-- Author tags are optional, multiple are allowed, one per tag -->
<!-- Authors do not have to be maintainers, but could be -->
<!-- Example: -->
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
<!-- The *_depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<!-- <run_depend>message_runtime</run_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>nodelet</build_depend>
<build_depend>roscpp</build_depend>
<!-- Use buildtool_depend for build tool packages: -->
<buildtool_depend>catkin</buildtool_depend>
<!-- Use run_depend for packages you need at runtime: -->
<run_depend>nodelet</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>mavros</run_depend>
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<!-- The export tag contains other, unspecified, tags -->
<export>
<nodelet plugin="${prefix}/nodelet_plugins.xml" />
<nodelet plugin="${prefix}/nodelet_plugins.xml" />
<!-- Other tools can request additional information be placed here -->
</export>
</package>

View File

@@ -18,6 +18,6 @@ cd ${IMAGE_BUILDER}
[[ $(arch) == 'armv7l' ]] && NUMBER_THREADS=1 || NUMBER_THREADS=$(nproc --all)
./image_config.sh copy_to_chroot ${IMAGE_PATH} ${SCRIPTS_DIR}'/kinetic-ros-coex.rosinstall' '/home/pi/ros_catkin_ws/'
./image_config.sh execute ${IMAGE_PATH} ${SCRIPTS_DIR}'/ros_install.sh' ${TARGET_REPO} ${TARGET_REF} False ${NUMBER_THREADS}
./image_config.sh execute ${IMAGE_PATH} ${SCRIPTS_DIR}'/ros_install.sh' ${TARGET_REPO} ${TARGET_REF} False False ${NUMBER_THREADS}
./autosizer.sh ${IMAGE_PATH}

View File

@@ -26,26 +26,23 @@ echo_stamp() {
echo -e ${TEXT}
}
# Add apt key to allow local mirror usage during image build
echo_stamp "#0 Install apt keys & repos"
# TODO: This STDOUT consist 'OK'
wget -O - ftp://mirror.coex.space/coex-mirror.gpg 2> /dev/null | apt-key add -
# Generate a backup of the original source.list
cp /etc/apt/sources.list /var/sources.list.bak
# Add the coex-mirror as the first priority repository
curl ftp://mirror.coex.space/coex-mirror.list 2> /dev/null | cat - /etc/apt/sources.list > /var/sources.list && mv /var/sources.list /etc/apt/sources.list
# Add the urpylka-rpi repo
curl ftp://mirror.coex.space/urpylka-rpi.list 2> /dev/null >> /etc/apt/sources.list
curl http://repo.coex.space/aptly_repo_signing.key 2> /dev/null | apt-key add -
apt-get install --no-install-recommends -y -qq dirmngr=2.1.18-8~deb9u2 > /dev/null \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
echo_stamp "#1 apt cache update"
echo "deb http://packages.ros.org/ros/ubuntu stretch main" > /etc/apt/sources.list.d/ros-latest.list
echo "deb http://repo.coex.space/rpi-ros-kinetic/ stretch main" > /etc/apt/sources.list.d/rpi-ros-kinetic.list
echo_stamp "#1 Update apt cache"
# Clean repostory cache
apt-get clean -qq > /dev/null
# Update repository cache
# TODO: FIX ERROR: /usr/bin/apt-key: 596: /usr/bin/apt-key: cannot create /dev/null: Permission denied
apt-get update -qq > /dev/null
# && apt upgrade -y
echo_stamp "#2 Write clever information"
echo_stamp "#2 Write CLEVER information"
# Clever image version
echo "$1" >> /etc/clever_version

View File

@@ -1,10 +1,4 @@
#!/bin/bash
##################################################################################################################################
# ROS for user pi
##################################################################################################################################
# ros http://wiki.ros.org/action/fullsearch/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi
#!/usr/bin/env bash
set -e
@@ -28,111 +22,108 @@ echo_stamp() {
echo -e ${TEXT}
}
echo_stamp "Installing ROS"
# TODO: 'kinetic-rosdep-clever.yaml' should add only if we use our repo?
echo_stamp "Init rosdep" \
&& rosdep init \
&& wget -O /etc/ros/rosdep/kinetic-rosdep-clever.yaml http://repo.coex.space/kinetic-rosdep-clever.yaml 2> /dev/null \
&& echo "yaml file:///etc/ros/rosdep/kinetic-rosdep-clever.yaml" >> /etc/ros/rosdep/sources.list.d/20-default.list \
&& rosdep update
echo_stamp "#1 Installing dirmngr & add key to apt-key"
apt-get install --no-install-recommends -y -qq dirmngr=2.1.18-8~deb9u2 > /dev/null
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
echo "deb http://packages.ros.org/ros/ubuntu stretch main" > /etc/apt/sources.list.d/ros-latest.list
resolve_rosdep() {
# TEMPLATE: resolve_rosdep <CATKIN_PATH> <ROS_DISTRO> <OS_DISTRO> <OS_VERSION>
CATKIN_PATH=${1:='/home/pi/ros_catkin_ws'}
ROS_DISTRO=${2:='kinetic'}
OS_DISTRO=${3:='debian'}
OS_VERSION=${4:='stretch'}
echo_stamp "#2 apt update && apt upgrade"
apt-get update -qq > /dev/null
echo_stamp "Installing dependencies apps with rosdep in ${CATKIN_PATH}"
cd ${CATKIN_PATH}
set +e
# Successfull unmount flag (false at thismoment)
install_ok=false
# Repeat 5 times
for i in {1..5}; do
# Resolving Dependencies with rosdep
rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -r --os=${OS_DISTRO}:${OS_VERSION} \
> /dev/null \
&& (install_ok=true; break) || (echo_stamp "rosdep iteration #$i failed!" "ERROR"; sleep 2)
done
set -e
# Stage fail if this condition is not true
[[ $install_ok ]] \
&& echo_stamp "All rosdep dependencies was installed!" "SUCCESS" \
|| (echo_stamp "Rosdep installation was failed!" "ERROR"; exit 1)
}
echo_stamp "#3 Installing wget, unzip, python-rosdep, python-rosinstall-generator, python-wstool, python-rosinstall, build-essential, cmake"
apt-get install --no-install-recommends -y -qq \
python-rosdep=0.12.2-1 \
python-rosinstall-generator=0.1.14-1 \
python-wstool=0.1.17-1 \
python-rosinstall=0.7.8-1 \
build-essential=12.3 \
> /dev/null
echo_stamp "#4 rosdep init && rosdep update"
rosdep init && rosdep update
# If $3 = false, then discover packages
if [ "$3" = "false" ];
then
echo_stamp "#5 Preparing ros_comm packages to kinetic-ros_comm-wet.rosinstall"
# create ros catkin workspace
mkdir -p /home/pi/ros_catkin_ws && cd /home/pi/ros_catkin_ws \
INSTALL_ROS_PACK_SOURCES=${3:='False'}
if [ "${INSTALL_ROS_PACK_SOURCES}" = "True" ]; then
DISCOVER_ROS_PACK=${4:='True'}
if [ "${DISCOVER_ROS_PACK}" = "False" ]; then
echo_stamp "Preparing ros_comm packages to kinetic-ros_comm-wet.rosinstall" \
&& mkdir -p /home/pi/ros_catkin_ws && cd /home/pi/ros_catkin_ws \
&& rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall \
&& wstool init src kinetic-ros_comm-wet.rosinstall
&& wstool init src kinetic-ros_comm-wet.rosinstall \
&& echo_stamp "All roscomm sources was installed!" "SUCCESS" \
|| (echo_stamp "Some roscomm sources installation was failed!" "ERROR"; exit 1)
echo_stamp "#6 Preparing other ROS-packages to kinetic-custom_ros.rosinstall"
echo_stamp "Preparing other ROS-packages to kinetic-custom_ros.rosinstall" \
&& cd /home/pi/ros_catkin_ws \
&& rosinstall_generator \
actionlib actionlib_msgs angles async_web_server_cpp bond bond_core bondcpp bondpy camera_calibration_parsers camera_info_manager catkin class_loader cmake_modules cpp_common cv_bridge cv_camera diagnostic_msgs diagnostic_updater dynamic_reconfigure eigen_conversions gencpp geneus genlisp genmsg gennodejs genpy geographic_msgs geometry_msgs geometry2 image_transport libmavconn mavlink mavros_msgs message_filters message_generation message_runtime mk nav_msgs nodelet orocos_kdl pluginlib python_orocos_kdl ros ros_comm rosapi rosauth rosbag rosbag_migration_rule rosbag_storage rosbash rosboost_cfg rosbridge_library rosbridge_server rosbridge_suite rosbuild rosclean rosconsole rosconsole_bridge roscpp roscpp_serialization roscpp_traits roscreate rosgraph rosgraph_msgs roslang roslaunch roslib roslint roslisp roslz4 rosmake rosmaster rosmsg rosnode rosout rospack rosparam rospy rospy_tutorials rosserial rosserial_client rosserial_msgs rosserial_python rosservice rostest rostime rostopic rosunit roswtf sensor_msgs smclib std_msgs std_srvs stereo_msgs tf tf2 tf2_bullet tf2_eigen tf2_geometry_msgs tf2_kdl tf2_msgs tf2_py tf2_ros tf2_sensor_msgs tf2_tools topic_tools trajectory_msgs urdf urdf_parser_plugin usb_cam uuid_msgs visualization_msgs web_video_server xmlrpcpp mavros opencv3 mavros_extras \
--rosdistro kinetic --deps --wet-only --tar > kinetic-custom_ros.rosinstall \
&& wstool merge -t src kinetic-custom_ros.rosinstall \
&& wstool update -t src \
&& echo_stamp "All custom sources was installed!" "SUCCESS" \
|| (echo_stamp "Some custom sources installation was failed!" "ERROR"; exit 1)
else
echo_stamp "Creating ros_catkin_ws & getting all sources using wstool" \
&& mkdir -p /home/pi/ros_catkin_ws && cd /home/pi/ros_catkin_ws \
&& wstool init src kinetic-ros-clever.rosinstall \
> /dev/null \
&& echo_stamp "All CLEVER sources was installed!" "SUCCESS" \
|| (echo_stamp "Some CLEVER sources installation was failed!" "ERROR"; exit 1)
fi
cd /home/pi/ros_catkin_ws \
&& rosinstall_generator \
actionlib actionlib_msgs angles async_web_server_cpp bond bond_core bondcpp bondpy camera_calibration_parsers camera_info_manager catkin class_loader cmake_modules cpp_common cv_bridge cv_camera diagnostic_msgs diagnostic_updater dynamic_reconfigure eigen_conversions gencpp geneus genlisp genmsg gennodejs genpy geographic_msgs geometry_msgs geometry2 image_transport libmavconn mavlink mavros_msgs message_filters message_generation message_runtime mk nav_msgs nodelet orocos_kdl pluginlib python_orocos_kdl ros ros_comm rosapi rosauth rosbag rosbag_migration_rule rosbag_storage rosbash rosboost_cfg rosbridge_library rosbridge_server rosbridge_suite rosbuild rosclean rosconsole rosconsole_bridge roscpp roscpp_serialization roscpp_traits roscreate rosgraph rosgraph_msgs roslang roslaunch roslib roslint roslisp roslz4 rosmake rosmaster rosmsg rosnode rosout rospack rosparam rospy rospy_tutorials rosserial rosserial_client rosserial_msgs rosserial_python rosservice rostest rostime rostopic rosunit roswtf sensor_msgs smclib std_msgs std_srvs stereo_msgs tf tf2 tf2_bullet tf2_eigen tf2_geometry_msgs tf2_kdl tf2_msgs tf2_py tf2_ros tf2_sensor_msgs tf2_tools topic_tools trajectory_msgs urdf urdf_parser_plugin usb_cam uuid_msgs visualization_msgs web_video_server xmlrpcpp mavros opencv3 mavros_extras \
--rosdistro kinetic --deps --wet-only --tar > kinetic-custom_ros.rosinstall \
&& wstool merge -t src kinetic-custom_ros.rosinstall \
&& wstool update -t src
else
echo_stamp "#5 Creating ros_catkin_ws & getting all sources using wstool"
mkdir -p /home/pi/ros_catkin_ws && cd /home/pi/ros_catkin_ws \
&& wstool init src kinetic-ros-coex.rosinstall \
> /dev/null \
&& echo_stamp "ros_catkin_ws was created!" "SUCCESS" \
|| (echo_stamp "ros_catkin_ws wasn't created!" "ERROR"; exit 1)
resolve_rosdep
# TODO: Add refactor to origin repo
#echo_stamp "Refactoring usb_cam in SRC"
#sed -i '/#define __STDC_CONSTANT_MACROS/a\#define PIX_FMT_RGB24 AV_PIX_FMT_RGB24\n#define PIX_FMT_YUV422P AV_PIX_FMT_YUV422P' /home/pi/ros_catkin_ws/src/usb_cam/src/usb_cam.cpp
# TODO: test without that
#echo_stamp "#9 Installing GeographicLib datasets"
#/home/pi/ros_catkin_ws/src/mavros/mavros/scripts/install_geographiclib_datasets.sh
echo_stamp "Building ros_catkin_ws packages"
cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -j$5 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic
#echo_stamp "#11 Building light packages on 2 threads"
#cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -j2 --install-space /opt/ros/kinetic --pkg actionlib actionlib_msgs angles async_web_server_cpp bond bond_core bondcpp bondpy camera_calibration_parsers camera_info_manager catkin class_loader cmake_modules cpp_common diagnostic_msgs diagnostic_updater dynamic_reconfigure eigen_conversions gencpp geneus genlisp genmsg gennodejs genpy geographic_msgs geometry_msgs geometry2 image_transport libmavconn mavlink mavros_msgs message_filters message_generation message_runtime mk nav_msgs nodelet orocos_kdl pluginlib python_orocos_kdl ros ros_comm rosapi rosauth rosbag rosbag_migration_rule rosbag_storage rosbash rosboost_cfg rosbridge_library rosbridge_server rosbridge_suite rosbuild rosclean rosconsole rosconsole_bridge roscpp roscpp_serialization roscpp_traits roscreate rosgraph rosgraph_msgs roslang roslaunch roslib roslint roslisp roslz4 rosmake rosmaster rosmsg rosnode rosout rospack rosparam rospy rospy_tutorials rosserial rosserial_client rosserial_msgs rosserial_python rosservice rostest rostime rostopic rosunit roswtf sensor_msgs smclib std_msgs std_srvs stereo_msgs tf tf2 tf2_bullet tf2_eigen tf2_geometry_msgs tf2_kdl tf2_msgs tf2_py tf2_ros tf2_sensor_msgs tf2_tools topic_tools trajectory_msgs urdf urdf_parser_plugin usb_cam uuid_msgs visualization_msgs xmlrpcpp
#echo_stamp "#12 Building heavy packages"
# This command uses less threads to avoid Raspberry Pi freeze
#cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -j1 --install-space /opt/ros/kinetic --pkg mavros opencv3 cv_bridge cv_camera mavros_extras web_video_server
# Install builded packages
# WARNING: A major bug was found when using --pkg option (catkin_make_isolated doesn't install environment files)
# TODO: Can we increase threads number with HDD swap?
echo_stamp "Remove build_isolated & devel_isolated from ros_catkin_ws"
rm -rf /home/pi/ros_catkin_ws/build_isolated /home/pi/ros_catkin_ws/devel_isolated
chown -Rf pi:pi /home/pi/ros_catkin_ws
fi
echo_stamp "#7 Installing dependencies apps with rosdep"
cd /home/pi/ros_catkin_ws
set +e
# Successfull unmount flag (false at thismoment)
install_ok=false
# Repeat 5 times
for i in {1..5}; do
# Resolving Dependencies with rosdep
rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:stretch \
> /dev/null \
&& (install_ok=true; break) || (echo_stamp "rosdep iteration #$i failed!" "ERROR"; sleep 2)
done
set -e
# Stage fail if this condition is not true
[[ $install_ok ]] \
&& echo_stamp "All rosdep dependencies was installed!" "SUCCESS" \
|| (echo_stamp "Rosdep installation failed!" "ERROR"; exit 1)
echo_stamp "#8 Refactoring usb_cam in SRC"
sed -i '/#define __STDC_CONSTANT_MACROS/a\#define PIX_FMT_RGB24 AV_PIX_FMT_RGB24\n#define PIX_FMT_YUV422P AV_PIX_FMT_YUV422P' /home/pi/ros_catkin_ws/src/usb_cam/src/usb_cam.cpp
echo_stamp "#9 Installing GeographicLib datasets"
/home/pi/ros_catkin_ws/src/mavros/mavros/scripts/install_geographiclib_datasets.sh
#echo_stamp "#11 Building light packages on 2 threads"
# Build the catkin Workspace
#cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -j2 --install-space /opt/ros/kinetic --pkg actionlib actionlib_msgs angles async_web_server_cpp bond bond_core bondcpp bondpy camera_calibration_parsers camera_info_manager catkin class_loader cmake_modules cpp_common diagnostic_msgs diagnostic_updater dynamic_reconfigure eigen_conversions gencpp geneus genlisp genmsg gennodejs genpy geographic_msgs geometry_msgs geometry2 image_transport libmavconn mavlink mavros_msgs message_filters message_generation message_runtime mk nav_msgs nodelet orocos_kdl pluginlib python_orocos_kdl ros ros_comm rosapi rosauth rosbag rosbag_migration_rule rosbag_storage rosbash rosboost_cfg rosbridge_library rosbridge_server rosbridge_suite rosbuild rosclean rosconsole rosconsole_bridge roscpp roscpp_serialization roscpp_traits roscreate rosgraph rosgraph_msgs roslang roslaunch roslib roslint roslisp roslz4 rosmake rosmaster rosmsg rosnode rosout rospack rosparam rospy rospy_tutorials rosserial rosserial_client rosserial_msgs rosserial_python rosservice rostest rostime rostopic rosunit roswtf sensor_msgs smclib std_msgs std_srvs stereo_msgs tf tf2 tf2_bullet tf2_eigen tf2_geometry_msgs tf2_kdl tf2_msgs tf2_py tf2_ros tf2_sensor_msgs tf2_tools topic_tools trajectory_msgs urdf urdf_parser_plugin usb_cam uuid_msgs visualization_msgs xmlrpcpp
#echo_stamp "#12 Building heavy packages"
# This command uses less threads to avoid Raspberry Pi freeze
# Build the catkin Workspace
#cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -j1 --install-space /opt/ros/kinetic --pkg mavros opencv3 cv_bridge cv_camera mavros_extras web_video_server
echo_stamp "#10 Building packages"
# Install builded packages
# WARNING: A major bug was found when using --pkg option (catkin_make_isolated doesn't install environment files)
# TODO: Can we increase threads number with HDD swap?
cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -j$4 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic
echo_stamp "#11 Remove build_isolated & devel_isolated from ros_catkin_ws"
rm -rf /home/pi/ros_catkin_ws/build_isolated /home/pi/ros_catkin_ws/devel_isolated
chown -Rf pi:pi /home/pi/ros_catkin_ws
echo_stamp "#12 Creating catkin_ws & Installing CLEVER-BUNDLE"
git clone $1 /home/pi/catkin_ws/src/clever \
echo_stamp "#12 Creating catkin_ws & Installing CLEVER-BUNDLE" \
&& git clone $1 /home/pi/catkin_ws/src/clever \
&& cd /home/pi/catkin_ws/src/clever \
&& git checkout $2 \
&& pip install wheel \
&& pip install -r /home/pi/catkin_ws/src/clever/clever/requirements.txt \
&& cd /home/pi/catkin_ws \
&& . /opt/ros/kinetic/setup.sh \
&& catkin_make -j$4 -DCMAKE_BUILD_TYPE=Release \
&& resolve_rosdep $(pwd)
&& catkin_make -j$5 -DCMAKE_BUILD_TYPE=Release \
&& ln -s /home/pi/catkin_ws/src/clever/deploy/roscore.service /lib/systemd/system/roscore.service \
&& ln -s /home/pi/catkin_ws/src/clever/deploy/clever.service /lib/systemd/system/clever.service \
&& systemctl enable roscore \
@@ -143,10 +134,10 @@ chown -Rf pi:pi /home/pi/catkin_ws
echo_stamp "#14 Setup ROS environment"
cat <<EOF | tee -a /home/pi/.bashrc > /dev/null
LANG=C.UTF-8
LC_ALL=C.UTF-8
ROS_DISTRO=kinetic
export ROS_IP=192.168.11.1
LANG='C.UTF-8'
LC_ALL='C.UTF-8'
ROS_DISTRO='kinetic'
export ROS_IP='192.168.11.1'
source /opt/ros/kinetic/setup.bash
source /home/pi/catkin_ws/devel/setup.bash
EOF

View File

@@ -1,11 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
##################################################################################################################################
# Image software installation
##################################################################################################################################
set -e
echo_stamp() {
# TEMPLATE: echo_stamp <TEXT> <TYPE>
# TYPE: SUCCESS, ERROR, INFO
@@ -26,8 +26,7 @@ echo_stamp() {
echo -e ${TEXT}
}
echo_stamp "#1 Software installing"
echo_stamp "Software installing"
apt-get install --no-install-recommends -y \
unzip=6.0-21 \
zip=3.0-11 \
@@ -47,32 +46,34 @@ apt-get install --no-install-recommends -y \
libjpeg8-dev=8d1-2 \
tcpdump \
libpoco-dev=1.7.6+dfsg1-5+deb9u1 \
python-rosdep=0.12.2-1 \
python-rosinstall-generator=0.1.14-1 \
python-wstool=0.1.17-1 \
python-rosinstall=0.7.8-1 \
build-essential=12.3 \
> /dev/null \
&& echo_stamp "Everything was installed!" "SUCCESS" \
|| (echo_stamp "Some packages wasn't installed!" "ERROR"; exit 1)
echo_stamp "#2 Installation OpenCV"
# echo_stamp "Installation OpenCV"
# apt-get install --no-install-recommends -y \
# ros-kinetic-opencv3=3.3.1-0stretch \
# > /dev/null \
# && echo_stamp "OpenCV3 was installed!" "SUCCESS" \
# || (echo_stamp "OpenCV3 wasn't installed!" "ERROR"; exit 1)
apt-get install --no-install-recommends -y \
ros-kinetic-opencv3=3.3.1-0stretch \
> /dev/null \
&& echo_stamp "OpenCV3 was installed!" "SUCCESS" \
|| (echo_stamp "OpenCV3 wasn't installed!" "ERROR"; exit 1)
echo_stamp "#3 Adding mjpg-streamer at /home/pi"
echo_stamp "Adding mjpg-streamer at /home/pi"
# https://github.com/jacksonliam/mjpg-streamer
git clone https://github.com/jacksonliam/mjpg-streamer.git /home/pi/mjpg-streamer \
git clone https://github.com/urpylka/mjpg-streamer.git /home/pi/mjpg-streamer \
&& cd /home/pi/mjpg-streamer/mjpg-streamer-experimental \
&& make > /dev/null \
&& make install \
&& chown -Rf pi:pi /home/pi/mjpg-streamer
echo_stamp "#4 Add .vimrc"
echo_stamp "Add .vimrc"
cat << EOF > /home/pi/.vimrc
set mouse-=a
syntax on
EOF
echo_stamp "#5 End of software installation"
echo_stamp "End of software installation"