From f2fab5bf72837d7a6088d0e5e40f37662e297816 Mon Sep 17 00:00:00 2001 From: Alexander Moriarty Date: Fri, 1 Feb 2019 22:21:10 -0800 Subject: [PATCH 01/11] [fetch_binary_drivers] new [fetch_drivers] package This is a new package providing the "fetch_drivers" which was previously built internally and distributed as a binary only debian package. We will officially announce when the upgrade from Indigo->Melodic is ready. 18.04 and ROS Melodic on the Fetch Research Platforms is still being tested. The process isn't straight foward as there are calibration files which you will want to back-up before the upgrade. This `fetch_drivers` package also won't start like it use to because of the change from `upstart` to `systemd`. That requires `fetch_system_config` which will be open sourced soon. This `fetch_binary_drivers` package is part of a plan to distribute updates and upgrades to Fetch Research Platform customers faster in the future. This relates to fetchrobotics/fetch_ros#63 1. An officiall announcement will be made when everything is ready. 2. We will update and document the process on: https://docs.fetchrobotics.com/ 3. We will also announce via our mailing list, ros discourse and post on: https://opensource.fetchrobotics.com/ --- fetch_binary_drivers/.gitignore | 3 + fetch_binary_drivers/CMakeLists.txt | 82 +++++++++++++++++++ fetch_binary_drivers/Makefile.tarball | 19 +++++ fetch_binary_drivers/README.md | 43 ++++++++++ .../fetch-drivers-0.8.0.tar.gz.md5sum | 1 + fetch_binary_drivers/package.xml | 47 +++++++++++ 6 files changed, 195 insertions(+) create mode 100644 fetch_binary_drivers/.gitignore create mode 100644 fetch_binary_drivers/CMakeLists.txt create mode 100644 fetch_binary_drivers/Makefile.tarball create mode 100644 fetch_binary_drivers/README.md create mode 100644 fetch_binary_drivers/fetch-drivers-0.8.0.tar.gz.md5sum create mode 100644 fetch_binary_drivers/package.xml diff --git a/fetch_binary_drivers/.gitignore b/fetch_binary_drivers/.gitignore new file mode 100644 index 0000000..1b58f98 --- /dev/null +++ b/fetch_binary_drivers/.gitignore @@ -0,0 +1,3 @@ +build +*.tar.gz +*.so diff --git a/fetch_binary_drivers/CMakeLists.txt b/fetch_binary_drivers/CMakeLists.txt new file mode 100644 index 0000000..b7514e9 --- /dev/null +++ b/fetch_binary_drivers/CMakeLists.txt @@ -0,0 +1,82 @@ +cmake_minimum_required(VERSION 3.5) +project(fetch_drivers) + +### +# +# This is the public version of fetch_drivers. +# +# This is a binary only release of our dirvers and firmware. +# The drivers and firmware have been compiled for our research robots, inside of Docker containers on our TeamCity build servers. +# +# The resulting output of that build job a tar.gz, where the build job should only copy in what is required for the research robots. +# This public repository, just pulls in that tar.gz and extracts installs it into ROS/catkin paths. +## + +find_package(catkin REQUIRED + COMPONENTS + mk +) + +## System dependencies are found with CMake's conventions +find_package(Boost REQUIRED + COMPONENTS + filesystem + program_options + python + thread + system +) + +add_custom_target( + binary_driver ALL + COMMAND cmake -E chdir ${PROJECT_SOURCE_DIR} $(MAKE) -f Makefile.tarball + COMMAND cmake -E make_directory ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_LIB_DESTINATION}/${PROJECT_NAME} + COMMAND cmake -E copy_if_different ${PROJECT_SOURCE_DIR}/build/output/lib/libfetch_drivers.so ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_LIB_DESTINATION}/libfetch_drivers.so + COMMAND cmake -E copy_if_different ${PROJECT_SOURCE_DIR}/build/output/lib/libfetch_drivers_odva.so ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_LIB_DESTINATION}/libfetch_drivers_odva.so + COMMAND cmake -E copy ${PROJECT_SOURCE_DIR}/build/output/lib/${PROJECT_NAME}/* ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_LIB_DESTINATION}/${PROJECT_NAME}/ + COMMAND cmake -E make_directory ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME} + COMMAND cmake -E copy_if_different ${PROJECT_SOURCE_DIR}/build/output/share/${PROJECT_NAME}/firmware.tar.gz ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/ +) + +################################### +## catkin specific configuration ## +################################### +## The catkin_package macro generates cmake config files for your package +## Declare things to be passed to dependent projects +## INCLUDE_DIRS: uncomment this if your package contains header files +## LIBRARIES: libraries you create in this project that dependent projects also need +## CATKIN_DEPENDS: catkin_packages dependent projects also need +## DEPENDS: system dependencies of this project that dependent projects also need +catkin_package( +# INCLUDE_DIRS include +# LIBRARIES fetch_binary_drivers +# CATKIN_DEPENDS other_catkin_pkg +# DEPENDS system_lib +) + +########### +## Build ## +########### + +############# +## Install ## +############# + +install( + FILES build/output/lib/libfetch_drivers.so build/output/lib/libfetch_drivers_odva.so + DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} +) + +install( + DIRECTORY build/output/lib/fetch_drivers + DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + PATTERN "build/output/lib/fetch_drivers/*" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ + GROUP_EXECUTE GROUP_READ + WORLD_EXECUTE WORLD_READ +) + +install( + FILES build/output/share/${PROJECT_NAME}/firmware.tar.gz build/output/share/${PROJECT_NAME}/laser_filters.xml + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} +) diff --git a/fetch_binary_drivers/Makefile.tarball b/fetch_binary_drivers/Makefile.tarball new file mode 100644 index 0000000..1988c2f --- /dev/null +++ b/fetch_binary_drivers/Makefile.tarball @@ -0,0 +1,19 @@ +all: binary_driver + +# TODO: There are some more things to automate. +DRIVER_VERSION = 0.8.0 +TARBALL = build/fetch-drivers-0.8.0.tar.gz +TARBALL_URL = http://packages.fetchrobotics.com/binaries/fetch-drivers-0.8.0.tar.gz +SOURCE_DIR = build/output +MD5SUM_FILE = fetch-drivers-0.8.0.tar.gz.md5sum +UNPACK_CMD = tar zxvf +include $(shell rospack find mk)/download_unpack_build.mk + +binary_driver: $(SOURCE_DIR)/unpacked + echo "binary driver built in: " $(SOURCE_DIR) + +clean: + -rm -rf $(SOURCE_DIR) + +wipe: clean + -rm -rf build diff --git a/fetch_binary_drivers/README.md b/fetch_binary_drivers/README.md new file mode 100644 index 0000000..deb9ff9 --- /dev/null +++ b/fetch_binary_drivers/README.md @@ -0,0 +1,43 @@ +# Fetch Binary Drivers + +This is a public binary version of our drivers and firmware for the Fetch Research Platforms. + +https://fetchrobotics.com/robotics-platforms/ + +We have two Fetch Research Platforms. Commonly known as Fetch and Freight. Fetch is the one with the arm. +The drivers and firmware in this package are for both. + +https://docs.fetchrobotics.com/ + +# Fetch Drivers + +The catkin package inside of this folder is called `fetch_drivers`, not `fetch_binary_drivers`. +This is because we've previously been releasing packages which depend on `fetch_drivers`. +We're just changing how we distribute our drivers. + +# About + +This package should only be needed if you're using one of the Fetch Research Platforms. + +Our goal is to better support our our Fetch Research Platform customers through an improved, more automated build and release process. This will get enable us to get updates out faster. + +We discussed at [ROSCon 2018](https://roscon.ros.org/2018/) in a talk "Hermetic Robot Deployment Using Multi-Stage Dockers" +by @levavakian & @bluryi some of our internal way of doing build/test/deployment using Docker: +[Video](https://vimeo.com/293626218), +[Slides](https://roscon.ros.org/2018/presentations/ROSCon2018_multistage_docker_for_robot_deployment.pdf). + +This public repository, is designed to consume the output of our private `fetch_drivers` repository and enable +Fetch Research Platform users access to the drivers/firmware faster via the official ros packages. + +To create the output of our private package, we have a special build job which runs inside of a docker container to ensure we don't accidentally +pull in any private dependencies, and also doesn't output any of the additional commercial robot drivers. + +Previously, we built our drivers on a private buildbot, and hosted them on our own packages site. +We also had a manually synced mirror of the ros packages. This allowed us to ensure we tested the versions of dependancies which were on our mirror. +The old process was not as automated as we would like. + +We're in the process of testing melodic, and setting up our hosted stable mirror, and documenting the upgrade process to ensure Fetch Research Platform customers have a smooth transition. + +We will announce to our customers when we're officially ready and supporting melodic. + +See https://docs.fetchrobotics.com for more information. diff --git a/fetch_binary_drivers/fetch-drivers-0.8.0.tar.gz.md5sum b/fetch_binary_drivers/fetch-drivers-0.8.0.tar.gz.md5sum new file mode 100644 index 0000000..d9b95ba --- /dev/null +++ b/fetch_binary_drivers/fetch-drivers-0.8.0.tar.gz.md5sum @@ -0,0 +1 @@ +1d283854b2406e1945319a57e660c5ec /tmp/fetch-drivers-0.8.0.tar.gz diff --git a/fetch_binary_drivers/package.xml b/fetch_binary_drivers/package.xml new file mode 100644 index 0000000..b50b7db --- /dev/null +++ b/fetch_binary_drivers/package.xml @@ -0,0 +1,47 @@ + + + fetch_drivers + 0.0.0 + + The public fetch_drivers package is a binary only release. + + fetch_drivers contains both the drivers and firmware for the fetch and freight research robots. + There should be no reason to use these drivers unless you're running on a fetch or a frieght research robot. + This package, is a cmake/make only package which installs the binaries for the drivers and firmware. + + + + Alexander Moriarty + FetchRobotics Open Source Team + + + Proprietary + + + + http://wiki.ros.org/fetch_drivers + https://docs.fetchrobotics.com + https://fetchrobotics.com/robotics-platforms/ + + + + Alexander Moriarty + + + catkin + mk + actionlib + boost + robot_controllers + robot_controllers_interface + rosconsole + roscpp_serialization + roscpp + rostime + urdf + + + + + + From 8e144f9a193129a0de5254075bbe5eb8245e1603 Mon Sep 17 00:00:00 2001 From: Eric Relson Date: Fri, 1 Feb 2019 10:12:18 -0800 Subject: [PATCH 02/11] System config debian components for ROS Melodic Ported from internal Fetch Robotics code used for ROS Indigo/Ubuntu 14.04. Updated to support ROS Melodic/Ubuntu 18.04. Some key changes: - Change from using upstart to using systemd (expect version >= 236) - Correspondingly logs such as /var/log/upstart/robot.log are now available in /var/log/ros/robot.log (as well as via journalctl -u robot) - Manually creates udev rules and updates grub boot arguments to ensure consistent network device naming across different hardware. Uses netplan to set static IP for internal robot communications. - Sixad replaced with ps3joy (hopefully a better solution will be found) - Slightly better logrotate rules - Removed former joystick_monitor and soundplay upstarts --- fetch_binary_drivers/.gitignore | 10 ++ fetch_system_config/README.md | 17 +++ fetch_system_config/debian/changelog | 5 + fetch_system_config/debian/compat | 1 + fetch_system_config/debian/control | 38 +++++ fetch_system_config/debian/copyright | 36 +++++ fetch_system_config/debian/docs | 1 + .../debian/fetch-melodic-config.install | 1 + .../debian/fetch-melodic-config.postinst | 138 ++++++++++++++++++ .../fetch-melodic-config.ps3joy.service | 16 ++ .../debian/fetch-melodic-config.robot.service | 16 ++ .../debian/fetch-melodic-config.ros.logrotate | 73 +++++++++ .../fetch-melodic-config.roscore.service | 18 +++ fetch_system_config/debian/files | 2 + .../freight-melodic-config.debhelper.log | 28 ++++ .../debian/freight-melodic-config.install | 1 + .../debian/freight-melodic-config.postinst | 138 ++++++++++++++++++ .../freight-melodic-config.ps3joy.service | 1 + .../freight-melodic-config.robot.service | 1 + .../freight-melodic-config.ros.logrotate | 1 + .../freight-melodic-config.roscore.service | 1 + fetch_system_config/debian/rules | 15 ++ fetch_system_config/debian/source/format | 1 + fetch_system_config/debian/triggers | 1 + fetch_system_config/root/etc/asound.conf | 2 + .../etc/modprobe.d/blacklist-intel-audio.conf | 3 + .../root/etc/pm/power.d/wireless | 4 + .../lib/udev/rules.d/40-libopenni2-0609.rules | 2 + .../lib/udev/rules.d/99-logitechF710.rules | 2 + .../root/lib/udev/rules.d/99-ps3joy.rules | 1 + .../root/opt/ros/roscore_poststart.bash | 9 ++ .../root/opt/ros/roscore_prestart.bash | 3 + 32 files changed, 586 insertions(+) create mode 100644 fetch_system_config/README.md create mode 100644 fetch_system_config/debian/changelog create mode 100644 fetch_system_config/debian/compat create mode 100644 fetch_system_config/debian/control create mode 100644 fetch_system_config/debian/copyright create mode 100644 fetch_system_config/debian/docs create mode 100644 fetch_system_config/debian/fetch-melodic-config.install create mode 100755 fetch_system_config/debian/fetch-melodic-config.postinst create mode 100644 fetch_system_config/debian/fetch-melodic-config.ps3joy.service create mode 100644 fetch_system_config/debian/fetch-melodic-config.robot.service create mode 100644 fetch_system_config/debian/fetch-melodic-config.ros.logrotate create mode 100644 fetch_system_config/debian/fetch-melodic-config.roscore.service create mode 100644 fetch_system_config/debian/files create mode 100644 fetch_system_config/debian/freight-melodic-config.debhelper.log create mode 100644 fetch_system_config/debian/freight-melodic-config.install create mode 100755 fetch_system_config/debian/freight-melodic-config.postinst create mode 120000 fetch_system_config/debian/freight-melodic-config.ps3joy.service create mode 120000 fetch_system_config/debian/freight-melodic-config.robot.service create mode 100644 fetch_system_config/debian/freight-melodic-config.ros.logrotate create mode 120000 fetch_system_config/debian/freight-melodic-config.roscore.service create mode 100755 fetch_system_config/debian/rules create mode 100644 fetch_system_config/debian/source/format create mode 100644 fetch_system_config/debian/triggers create mode 100644 fetch_system_config/root/etc/asound.conf create mode 100755 fetch_system_config/root/etc/modprobe.d/blacklist-intel-audio.conf create mode 100755 fetch_system_config/root/etc/pm/power.d/wireless create mode 100644 fetch_system_config/root/lib/udev/rules.d/40-libopenni2-0609.rules create mode 100644 fetch_system_config/root/lib/udev/rules.d/99-logitechF710.rules create mode 100644 fetch_system_config/root/lib/udev/rules.d/99-ps3joy.rules create mode 100644 fetch_system_config/root/opt/ros/roscore_poststart.bash create mode 100644 fetch_system_config/root/opt/ros/roscore_prestart.bash diff --git a/fetch_binary_drivers/.gitignore b/fetch_binary_drivers/.gitignore index 1b58f98..81fa991 100644 --- a/fetch_binary_drivers/.gitignore +++ b/fetch_binary_drivers/.gitignore @@ -1,3 +1,13 @@ build *.tar.gz *.so + +# system config +*.deb +*.debhelper +*.substvars +*.log +*.dsc +*.changes +fetch-melodic-config +freight-melodic-config diff --git a/fetch_system_config/README.md b/fetch_system_config/README.md new file mode 100644 index 0000000..69944d4 --- /dev/null +++ b/fetch_system_config/README.md @@ -0,0 +1,17 @@ +# Fetch System Config + +This is the Git Build Package (GBP) repo for Research versions of Fetch/Freight. +All other tools (iso installer, documentation, etc), and the commercial version +of this package, are on the 'master' branch. + +# How to Manually Build + +```bash +git clone git@github.com:fetchrobotics/fetch_binary_drivers.git # -b melodic-devel +cd fetch_binary_drivers/fetch-system-config +dpkg-buildpackage -us -uc +# Debians are placed in the parent directory +cd .. +ls *system*.deb +``` + diff --git a/fetch_system_config/debian/changelog b/fetch_system_config/debian/changelog new file mode 100644 index 0000000..1a51d12 --- /dev/null +++ b/fetch_system_config/debian/changelog @@ -0,0 +1,5 @@ +fetch-system-config (0.1-0) bionic; urgency=medium + + * initial release of melodic packages + + -- Eric Relson Fri, 01 Feb 2019 10:50:25 -0800 diff --git a/fetch_system_config/debian/compat b/fetch_system_config/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/fetch_system_config/debian/compat @@ -0,0 +1 @@ +9 diff --git a/fetch_system_config/debian/control b/fetch_system_config/debian/control new file mode 100644 index 0000000..f5c4153 --- /dev/null +++ b/fetch_system_config/debian/control @@ -0,0 +1,38 @@ +Source: fetch-system-config +Section: main +Priority: optional +Maintainer: Eric Relson +Build-Depends: debhelper (>= 9.0.0), + dh-systemd (>= 1.5) +Standards-Version: 3.9.4 +Homepage: www.fetchrobotics.com + +Package: fetch-melodic-config +Architecture: any +Depends: ${misc:Depends}, + adduser, + chrony, + openssh-server, + ros-melodic-ros +Description: Configuration for Fetch on Melodic + This package will start ROS Melodic at bootup +Conflicts: fetch-indigo-config, + fetch-system-config, + freight-indigo-config, + freight-melodic-config, + freight-system-config + +Package: freight-melodic-config +Architecture: any +Depends: ${misc:Depends}, + adduser, + chrony, + openssh-server, + ros-melodic-ros +Description: Configuration for Freight on Melodic + This package will start ROS Melodic at bootup +Conflicts: fetch-indigo-config, + fetch-melodic-config, + fetch-system-config, + freight-system-config, + freight-indigo-config diff --git a/fetch_system_config/debian/copyright b/fetch_system_config/debian/copyright new file mode 100644 index 0000000..ac25376 --- /dev/null +++ b/fetch_system_config/debian/copyright @@ -0,0 +1,36 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: * +Copyright: 2015-2018 Fetch Robotics Inc + 2013 I Heart Engineering +License: BSD-3-clause + Copyright (c) 2015-2018, Fetch Robotics Inc. + Copyright (c) 2013, I Heart Engineering + All rights reserved. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the I Heart Engineering nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. diff --git a/fetch_system_config/debian/docs b/fetch_system_config/debian/docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/fetch_system_config/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/fetch_system_config/debian/fetch-melodic-config.install b/fetch_system_config/debian/fetch-melodic-config.install new file mode 100644 index 0000000..ed2cb38 --- /dev/null +++ b/fetch_system_config/debian/fetch-melodic-config.install @@ -0,0 +1 @@ +root/* . \ No newline at end of file diff --git a/fetch_system_config/debian/fetch-melodic-config.postinst b/fetch_system_config/debian/fetch-melodic-config.postinst new file mode 100755 index 0000000..8610a2d --- /dev/null +++ b/fetch_system_config/debian/fetch-melodic-config.postinst @@ -0,0 +1,138 @@ +#!/bin/bash + +set -e + +case "$1" in + "configure") + # Add ROS user, give access to audio/hardware + if ! getent passwd ros >/dev/null; then + adduser --disabled-password --quiet --system \ + --no-create-home --home=/var/lib/ros --shell /bin/bash \ + --gecos "ROS system user" --group ros + fi + adduser --quiet ros audio + adduser --quiet ros dialout + adduser --quiet ros plugdev + if ! getent group ros > /dev/null 2>&1; then + addgroup --system ros --quiet + fi + if [ "$(id -gn ros)" = "nogroup" ]; then + usermod -g ros ros + fi + + # Setup /var/lib/ros as home directory + if [ ! -e "/var/lib/ros" ]; then + mkdir /var/lib/ros + fi + chown -R ros:ros /var/lib/ros + chmod 2775 /var/lib/ros + + # Setup /var/log/ros for logging + if [ ! -e "/var/log/ros" ]; then + mkdir /var/log/ros + fi + chown -R ros:ros /var/log/ros + chmod 2775 /var/log/ros + + # Copy the robot.launch if not already existent + if [ ! -e "/etc/ros/melodic/robot.launch" ]; then + mkdir -p /etc/ros/melodic + cp /opt/ros/melodic/share/fetch_bringup/launch/fetch.launch /etc/ros/melodic/robot.launch + fi + + # TODO this file is missing in 18.04? + # Override /etc/acpi/powerbtn.sh + echo "/sbin/shutdown -h now \"Power button pressed\"" > /etc/acpi/powerbtn.sh + echo "exit 0" >> /etc/acpi/powerbtn.sh + + # Do not wait for GRUB (we're headless) + sed -i "s/GRUB_TIMEOUT=.*\"\"/GRUB_TIMEOUT=10/" /etc/default/grub + echo "GRUB_RECORDFAIL_TIMEOUT=\$GRUB_TIMEOUT" >> /etc/default/grub + + # Disable apport + if [ -e "/etc/default/apport" ]; then + sed -i "s/enabled=1/enabled=0/g" /etc/default/apport + fi + + # Run logrotation cron job hourly + if [ ! -e "/etc/cron.hourly/logrotate" ]; then + cp /etc/cron.daily/logrotate /etc/cron.hourly/logrotate + fi + + # Probalby null-op; We replace the update-rc.d with upstart job so that sixad starts properly + update-rc.d -f sixad remove + + ### Set up ethernet to ensure static network for internal robot communications. + # Reboot required for changes to take effect. + # Modify default/grub to not use new-style network device naming + sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/" /etc/default/grub + update-grub + # Determine which device to map to eth0 and eth1 and update /etc/udev/rules.d/70-persistent-net.rules + declare -a x=() + lines=$(udevadm info -e | grep -e "ID_NET_NAME_MAC=e.*[a-f0-9]\{12\}$") + regexmac="ID_NET_NAME_MAC=e.*([a-f0-9]{12})$" + for f in $lines + do + if [[ $f =~ $regexmac ]]; then + macs+="$(echo ${BASH_REMATCH[1]} | sed -r 's/.{2}/&:/g' | sed -r 's/://g6') " + fi + done + + # Make a backup, then remove any existing entries for eth0, eth1 from udev rules + if [[ -f /etc/udev/rules.d/70-persistent-net.rules ]]; then + if [[ ! -f /etc/udev/rules.d/70-persistent-net.rules.bak ]]; then + cp -n /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.bak + fi + cp -f /etc/udev/rules.d/70-persistent-net.rules /tmp/70-persistent-net.rules + grep -v -E "eth0|eth1" /tmp/70-persistent-net.rules > /etc/udev/rules.d/70-persistent-net.rules | true + fi + + # Add our new udev rules for eth0, eth1 + mac_array=($macs) + udev_line='SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="MAC_ADDRESS", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME=' + if [[ ${mac_array[0]} > ${mac_array[1]} ]]; then + echo ${udev_line/MAC_ADDRESS/${mac_array[0]}}'"eth0"' >> /etc/udev/rules.d/70-persistent-net.rules + echo ${udev_line/MAC_ADDRESS/${mac_array[1]}}'"eth1"' >> /etc/udev/rules.d/70-persistent-net.rules + else + echo ${udev_line/MAC_ADDRESS/${mac_array[1]}}'"eth0"' >> /etc/udev/rules.d/70-persistent-net.rules + echo ${udev_line/MAC_ADDRESS/${mac_array[0]}}'"eth1"' >> /etc/udev/rules.d/70-persistent-net.rules + fi + # Add netplan to set static IPs + if [[ ! -f /etc/netplan/99-fetch-ethernet.yaml ]]; then + cat << EOF > /etc/netplan/99-fetch-ethernet.yaml +# Fetch research robots require the below configuration for eth1. +# The configuration for eth0 is left to DHCP by default, but can be set to +# another static IP by uncommenting the block below and running `sudo netplan try`. +network: + version: 2 + ethernets: + #eth0: + # addresses: [172.42.42.1/24] + # gateway4: 172.42.42.1 + eth1: + addresses: [10.42.42.1/24] + gateway4: 10.42.42.1 +EOF + fi + + # Setup chrony to allow time jumps on start + if [ ! `grep makestep /etc/chrony/chrony.conf >/dev/null && echo $?` ]; then + echo ' +# This lets the time jump at startup +makestep 1.0 100' >>/etc/chrony/chrony.conf + fi + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/fetch_system_config/debian/fetch-melodic-config.ps3joy.service b/fetch_system_config/debian/fetch-melodic-config.ps3joy.service new file mode 100644 index 0000000..5d7f241 --- /dev/null +++ b/fetch_system_config/debian/fetch-melodic-config.ps3joy.service @@ -0,0 +1,16 @@ +[Unit] +Description=Job that launches the ps3joy node once roscore has started +After=roscore.service +BindsTo=roscore.service + +[Install] +WantedBy=roscore.service + +[Service] +Environment="ROS_LOG_DIR=/var/log/ros" +Restart=on-failure +StandardOutput=file:/var/log/ros/ps3joy.log +StandardError=file:/var/log/ros/ps3joy.log + +ExecStart=/bin/bash -c ". /opt/ros/melodic/setup.bash && rosrun ps3joy ps3joy.py --inactivity-timeout=3600" + diff --git a/fetch_system_config/debian/fetch-melodic-config.robot.service b/fetch_system_config/debian/fetch-melodic-config.robot.service new file mode 100644 index 0000000..1e89641 --- /dev/null +++ b/fetch_system_config/debian/fetch-melodic-config.robot.service @@ -0,0 +1,16 @@ +[Unit] +Description=Job that launches the robot drivers once roscore has started +After=roscore.service +BindsTo=roscore.service + +[Install] +WantedBy=roscore.service + +[Service] +Environment="ROS_LOG_DIR=/var/log/ros" +Restart=on-failure +StandardOutput=file:/var/log/ros/robot.log +StandardError=file:/var/log/ros/robot.log + +User=ros +ExecStart=/bin/bash -c ". /opt/ros/melodic/setup.bash && roslaunch /etc/ros/melodic/robot.launch --wait" diff --git a/fetch_system_config/debian/fetch-melodic-config.ros.logrotate b/fetch_system_config/debian/fetch-melodic-config.ros.logrotate new file mode 100644 index 0000000..c408da0 --- /dev/null +++ b/fetch_system_config/debian/fetch-melodic-config.ros.logrotate @@ -0,0 +1,73 @@ +compress + +/var/log/ros/*/*.log { + # Run scripts once per set of logs + sharedscripts + firstaction + . /opt/ros/indigo/setup.sh + # get run_id of ROS if it is running + RUN_ID=`rosparam get /run_id 2>/dev/null` + # Create a tarball if ROS is no longer using a given log subdirectory + for i in $( ls /var/log/ros | grep -v \.gz$ ); do + if [ $i != "$RUN_ID" ] && [ -d $i ]; then + cd /var/log/ros && tar -zpcf $i.tar.gz $i + fi + done + endscript + postrotate + . /opt/ros/indigo/setup.sh + RUN_ID=`rosparam get /run_id 2>/dev/null` + # Remove log subdirectory after tarball has been created + for i in $( ls /var/log/ros | grep -v \.gz$ ); do + if [ $i != "$RUN_ID" ] && [ -e /var/log/ros/$i.tar.gz ]; then + rm -r /var/log/ros/$i + fi + done + # Delete tarballs after a week + for i in $( find /var/log/ros -mtime 7 | grep \.gz$ ); do + rm $i + done + endscript + # Do not report errors if ROS has not created logs + missingok + # Rotate logs daily + daily + # Keep 1 weeks worth of logs for active processes + rotate 6 + # ROS continues to write to the old log + # 01 Jan 2013 - BUG: Sending SIGHUP to the ROS does not cause it to write to a new log. + copytruncate + # Compress old logs + delaycompress +} + +/var/log/ros/roscore.log { + maxsize=50M + rotate 3 + missingok + delaycompress + # 01 Jan 2013 - BUG: Sending SIGHUP to the ROS does not cause it to write to a new log. + copytruncate +} + +/var/log/ros/robot.log { + maxsize=50M + rotate 7 + missingok + delaycompress +} + +/var/log/ros/sixad.log { + maxsize=50M + rotate 3 + missingok + delaycompress +} + +/var/log/ros/robot_log.csv { + maxsize 100M + weekly + rotate 8 + missingok + compress +} diff --git a/fetch_system_config/debian/fetch-melodic-config.roscore.service b/fetch_system_config/debian/fetch-melodic-config.roscore.service new file mode 100644 index 0000000..120d401 --- /dev/null +++ b/fetch_system_config/debian/fetch-melodic-config.roscore.service @@ -0,0 +1,18 @@ +[Unit] +Description=Job that launches roscore once the system has started +After=multi-user.target + +[Install] +WantedBy=multi-user.target + +[Service] +Environment="ROS_LOG_DIR=/var/log/ros" +Restart=on-failure +StandardOutput=file:/var/log/ros/roscore.log +StandardError=file:/var/log/ros/roscore.log + +ExecStartPre=/bin/bash /opt/ros/roscore_prestart.bash +ExecStartPost=/bin/bash /opt/ros/roscore_poststart.bash +User=ros +ExecStart=/bin/bash -c ". /opt/ros/melodic/setup.bash && roscore" + diff --git a/fetch_system_config/debian/files b/fetch_system_config/debian/files new file mode 100644 index 0000000..17f8af3 --- /dev/null +++ b/fetch_system_config/debian/files @@ -0,0 +1,2 @@ +fetch-melodic-config_0.9-1_amd64.deb main optional +freight-melodic-config_0.9-1_amd64.deb main optional diff --git a/fetch_system_config/debian/freight-melodic-config.debhelper.log b/fetch_system_config/debian/freight-melodic-config.debhelper.log new file mode 100644 index 0000000..ab2ce64 --- /dev/null +++ b/fetch_system_config/debian/freight-melodic-config.debhelper.log @@ -0,0 +1,28 @@ +dh_auto_configure +dh_auto_build +dh_auto_test +dh_prep +dh_auto_install +dh_install +dh_installdocs +dh_installchangelogs +override_dh_systemd_enable dh_systemd_enable +override_dh_systemd_enable dh_systemd_enable +override_dh_systemd_enable dh_systemd_enable +dh_systemd_enable +dh_systemd_start +override_dh_installlogrotate dh_installlogrotate +dh_installlogrotate +dh_perl +dh_link +dh_compress +dh_fixperms +dh_strip +dh_makeshlibs +dh_shlibdeps +dh_installdeb +dh_gencontrol +dh_md5sums +dh_builddeb +dh_builddeb +dh_builddeb diff --git a/fetch_system_config/debian/freight-melodic-config.install b/fetch_system_config/debian/freight-melodic-config.install new file mode 100644 index 0000000..ed2cb38 --- /dev/null +++ b/fetch_system_config/debian/freight-melodic-config.install @@ -0,0 +1 @@ +root/* . \ No newline at end of file diff --git a/fetch_system_config/debian/freight-melodic-config.postinst b/fetch_system_config/debian/freight-melodic-config.postinst new file mode 100755 index 0000000..8610a2d --- /dev/null +++ b/fetch_system_config/debian/freight-melodic-config.postinst @@ -0,0 +1,138 @@ +#!/bin/bash + +set -e + +case "$1" in + "configure") + # Add ROS user, give access to audio/hardware + if ! getent passwd ros >/dev/null; then + adduser --disabled-password --quiet --system \ + --no-create-home --home=/var/lib/ros --shell /bin/bash \ + --gecos "ROS system user" --group ros + fi + adduser --quiet ros audio + adduser --quiet ros dialout + adduser --quiet ros plugdev + if ! getent group ros > /dev/null 2>&1; then + addgroup --system ros --quiet + fi + if [ "$(id -gn ros)" = "nogroup" ]; then + usermod -g ros ros + fi + + # Setup /var/lib/ros as home directory + if [ ! -e "/var/lib/ros" ]; then + mkdir /var/lib/ros + fi + chown -R ros:ros /var/lib/ros + chmod 2775 /var/lib/ros + + # Setup /var/log/ros for logging + if [ ! -e "/var/log/ros" ]; then + mkdir /var/log/ros + fi + chown -R ros:ros /var/log/ros + chmod 2775 /var/log/ros + + # Copy the robot.launch if not already existent + if [ ! -e "/etc/ros/melodic/robot.launch" ]; then + mkdir -p /etc/ros/melodic + cp /opt/ros/melodic/share/fetch_bringup/launch/fetch.launch /etc/ros/melodic/robot.launch + fi + + # TODO this file is missing in 18.04? + # Override /etc/acpi/powerbtn.sh + echo "/sbin/shutdown -h now \"Power button pressed\"" > /etc/acpi/powerbtn.sh + echo "exit 0" >> /etc/acpi/powerbtn.sh + + # Do not wait for GRUB (we're headless) + sed -i "s/GRUB_TIMEOUT=.*\"\"/GRUB_TIMEOUT=10/" /etc/default/grub + echo "GRUB_RECORDFAIL_TIMEOUT=\$GRUB_TIMEOUT" >> /etc/default/grub + + # Disable apport + if [ -e "/etc/default/apport" ]; then + sed -i "s/enabled=1/enabled=0/g" /etc/default/apport + fi + + # Run logrotation cron job hourly + if [ ! -e "/etc/cron.hourly/logrotate" ]; then + cp /etc/cron.daily/logrotate /etc/cron.hourly/logrotate + fi + + # Probalby null-op; We replace the update-rc.d with upstart job so that sixad starts properly + update-rc.d -f sixad remove + + ### Set up ethernet to ensure static network for internal robot communications. + # Reboot required for changes to take effect. + # Modify default/grub to not use new-style network device naming + sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/" /etc/default/grub + update-grub + # Determine which device to map to eth0 and eth1 and update /etc/udev/rules.d/70-persistent-net.rules + declare -a x=() + lines=$(udevadm info -e | grep -e "ID_NET_NAME_MAC=e.*[a-f0-9]\{12\}$") + regexmac="ID_NET_NAME_MAC=e.*([a-f0-9]{12})$" + for f in $lines + do + if [[ $f =~ $regexmac ]]; then + macs+="$(echo ${BASH_REMATCH[1]} | sed -r 's/.{2}/&:/g' | sed -r 's/://g6') " + fi + done + + # Make a backup, then remove any existing entries for eth0, eth1 from udev rules + if [[ -f /etc/udev/rules.d/70-persistent-net.rules ]]; then + if [[ ! -f /etc/udev/rules.d/70-persistent-net.rules.bak ]]; then + cp -n /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.bak + fi + cp -f /etc/udev/rules.d/70-persistent-net.rules /tmp/70-persistent-net.rules + grep -v -E "eth0|eth1" /tmp/70-persistent-net.rules > /etc/udev/rules.d/70-persistent-net.rules | true + fi + + # Add our new udev rules for eth0, eth1 + mac_array=($macs) + udev_line='SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="MAC_ADDRESS", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME=' + if [[ ${mac_array[0]} > ${mac_array[1]} ]]; then + echo ${udev_line/MAC_ADDRESS/${mac_array[0]}}'"eth0"' >> /etc/udev/rules.d/70-persistent-net.rules + echo ${udev_line/MAC_ADDRESS/${mac_array[1]}}'"eth1"' >> /etc/udev/rules.d/70-persistent-net.rules + else + echo ${udev_line/MAC_ADDRESS/${mac_array[1]}}'"eth0"' >> /etc/udev/rules.d/70-persistent-net.rules + echo ${udev_line/MAC_ADDRESS/${mac_array[0]}}'"eth1"' >> /etc/udev/rules.d/70-persistent-net.rules + fi + # Add netplan to set static IPs + if [[ ! -f /etc/netplan/99-fetch-ethernet.yaml ]]; then + cat << EOF > /etc/netplan/99-fetch-ethernet.yaml +# Fetch research robots require the below configuration for eth1. +# The configuration for eth0 is left to DHCP by default, but can be set to +# another static IP by uncommenting the block below and running `sudo netplan try`. +network: + version: 2 + ethernets: + #eth0: + # addresses: [172.42.42.1/24] + # gateway4: 172.42.42.1 + eth1: + addresses: [10.42.42.1/24] + gateway4: 10.42.42.1 +EOF + fi + + # Setup chrony to allow time jumps on start + if [ ! `grep makestep /etc/chrony/chrony.conf >/dev/null && echo $?` ]; then + echo ' +# This lets the time jump at startup +makestep 1.0 100' >>/etc/chrony/chrony.conf + fi + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/fetch_system_config/debian/freight-melodic-config.ps3joy.service b/fetch_system_config/debian/freight-melodic-config.ps3joy.service new file mode 120000 index 0000000..0b39e58 --- /dev/null +++ b/fetch_system_config/debian/freight-melodic-config.ps3joy.service @@ -0,0 +1 @@ +fetch-melodic-config.ps3joy.service \ No newline at end of file diff --git a/fetch_system_config/debian/freight-melodic-config.robot.service b/fetch_system_config/debian/freight-melodic-config.robot.service new file mode 120000 index 0000000..a43db3b --- /dev/null +++ b/fetch_system_config/debian/freight-melodic-config.robot.service @@ -0,0 +1 @@ +fetch-melodic-config.robot.service \ No newline at end of file diff --git a/fetch_system_config/debian/freight-melodic-config.ros.logrotate b/fetch_system_config/debian/freight-melodic-config.ros.logrotate new file mode 100644 index 0000000..c6ef4e0 --- /dev/null +++ b/fetch_system_config/debian/freight-melodic-config.ros.logrotate @@ -0,0 +1 @@ +fetch-melodic-config.ros.logrotate diff --git a/fetch_system_config/debian/freight-melodic-config.roscore.service b/fetch_system_config/debian/freight-melodic-config.roscore.service new file mode 120000 index 0000000..b5f828a --- /dev/null +++ b/fetch_system_config/debian/freight-melodic-config.roscore.service @@ -0,0 +1 @@ +fetch-melodic-config.roscore.service \ No newline at end of file diff --git a/fetch_system_config/debian/rules b/fetch_system_config/debian/rules new file mode 100755 index 0000000..4e4f827 --- /dev/null +++ b/fetch_system_config/debian/rules @@ -0,0 +1,15 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Grab the following .service files +override_dh_systemd_enable: + dh_systemd_enable --name=roscore + dh_systemd_enable --name=robot + dh_systemd_enable --name=ps3joy + #dh_systemd_enable --name=soundplay # TBD + +override_dh_installlogrotate: + dh_installlogrotate --name=ros + +%: + dh $@ --with=systemd diff --git a/fetch_system_config/debian/source/format b/fetch_system_config/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/fetch_system_config/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/fetch_system_config/debian/triggers b/fetch_system_config/debian/triggers new file mode 100644 index 0000000..7d2a1cc --- /dev/null +++ b/fetch_system_config/debian/triggers @@ -0,0 +1 @@ +interest /var/lib/ros diff --git a/fetch_system_config/root/etc/asound.conf b/fetch_system_config/root/etc/asound.conf new file mode 100644 index 0000000..6df3fe9 --- /dev/null +++ b/fetch_system_config/root/etc/asound.conf @@ -0,0 +1,2 @@ +defaults.pcm.card 1 +defaults.pcm.device 0 diff --git a/fetch_system_config/root/etc/modprobe.d/blacklist-intel-audio.conf b/fetch_system_config/root/etc/modprobe.d/blacklist-intel-audio.conf new file mode 100755 index 0000000..90b1718 --- /dev/null +++ b/fetch_system_config/root/etc/modprobe.d/blacklist-intel-audio.conf @@ -0,0 +1,3 @@ +# Blacklisting Intel sound devices to prevent those devices enumerating on top of +# the audio device on the main board. +blacklist snd_hda_intel diff --git a/fetch_system_config/root/etc/pm/power.d/wireless b/fetch_system_config/root/etc/pm/power.d/wireless new file mode 100755 index 0000000..1ab8167 --- /dev/null +++ b/fetch_system_config/root/etc/pm/power.d/wireless @@ -0,0 +1,4 @@ +#!/bin/sh + +# This is essential for reliable robot wifi +/sbin/iwconfig wlan0 power off diff --git a/fetch_system_config/root/lib/udev/rules.d/40-libopenni2-0609.rules b/fetch_system_config/root/lib/udev/rules.d/40-libopenni2-0609.rules new file mode 100644 index 0000000..378378f --- /dev/null +++ b/fetch_system_config/root/lib/udev/rules.d/40-libopenni2-0609.rules @@ -0,0 +1,2 @@ +# Make primesense device mount with writing permissions (default is read only for unknown devices) +SUBSYSTEM=="usb", ATTR{idProduct}=="0609", ATTR{idVendor}=="1d27", MODE:="0666", OWNER:="root", GROUP:="video" \ No newline at end of file diff --git a/fetch_system_config/root/lib/udev/rules.d/99-logitechF710.rules b/fetch_system_config/root/lib/udev/rules.d/99-logitechF710.rules new file mode 100644 index 0000000..152a0db --- /dev/null +++ b/fetch_system_config/root/lib/udev/rules.d/99-logitechF710.rules @@ -0,0 +1,2 @@ +KERNEL=="js?", SUBSYSTEM=="input", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c219", SYMLINK+="logitechF710" +KERNEL=="js?", SUBSYSTEM=="input", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c21f", SYMLINK+="logitechF710" diff --git a/fetch_system_config/root/lib/udev/rules.d/99-ps3joy.rules b/fetch_system_config/root/lib/udev/rules.d/99-ps3joy.rules new file mode 100644 index 0000000..d01b9ff --- /dev/null +++ b/fetch_system_config/root/lib/udev/rules.d/99-ps3joy.rules @@ -0,0 +1 @@ +KERNEL=="js?", SUBSYSTEM=="input", ATTRS{name}=="PLAYSTATION(R)3 Controller *", SYMLINK+="ps3joy" \ No newline at end of file diff --git a/fetch_system_config/root/opt/ros/roscore_poststart.bash b/fetch_system_config/root/opt/ros/roscore_poststart.bash new file mode 100644 index 0000000..3c892f4 --- /dev/null +++ b/fetch_system_config/root/opt/ros/roscore_poststart.bash @@ -0,0 +1,9 @@ +# This script is used by the roscore systemd service unit +echo "waiting for roscore to come up" +. /opt/ros/melodic/setup.sh +ret=`rosnode list` +while [ "$ret" = '' ] +do + ret=`rosnode list` + sleep 1; +done diff --git a/fetch_system_config/root/opt/ros/roscore_prestart.bash b/fetch_system_config/root/opt/ros/roscore_prestart.bash new file mode 100644 index 0000000..6d2f8da --- /dev/null +++ b/fetch_system_config/root/opt/ros/roscore_prestart.bash @@ -0,0 +1,3 @@ +# This script is used by the roscore systemd service unit +mkdir -p /var/log/ros/ +chown ros:ros /var/log/ros/ From 32f18f81767c62d6bf1af8f778e1299f311b3d73 Mon Sep 17 00:00:00 2001 From: Alexander Moriarty Date: Sat, 2 Feb 2019 00:32:59 -0800 Subject: [PATCH 03/11] [fetch_system_config] fix README TODO: should this be catkinized --- fetch_system_config/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fetch_system_config/README.md b/fetch_system_config/README.md index 69944d4..7dbc423 100644 --- a/fetch_system_config/README.md +++ b/fetch_system_config/README.md @@ -7,11 +7,16 @@ of this package, are on the 'master' branch. # How to Manually Build ```bash -git clone git@github.com:fetchrobotics/fetch_binary_drivers.git # -b melodic-devel -cd fetch_binary_drivers/fetch-system-config +git clone git@github.com:fetchrobotics/fetch_ros.git # -b melodic-devel +cd fetch_ros/fetch_system_config dpkg-buildpackage -us -uc # Debians are placed in the parent directory cd .. ls *system*.deb ``` +# TODO: catkin/standardize + +This isn't a GBP anymore, it will be published to: + +https://github.com/fetchrobotics-gbp/fetch_robots-release From 5f022ca6ee42ff64c4f190136538cbacafa334e6 Mon Sep 17 00:00:00 2001 From: Eric Relson Date: Mon, 4 Feb 2019 07:37:39 -0800 Subject: [PATCH 04/11] Fixup system config debian --- fetch_system_config/debian/files | 2 -- .../freight-melodic-config.debhelper.log | 28 ------------------- 2 files changed, 30 deletions(-) delete mode 100644 fetch_system_config/debian/files delete mode 100644 fetch_system_config/debian/freight-melodic-config.debhelper.log diff --git a/fetch_system_config/debian/files b/fetch_system_config/debian/files deleted file mode 100644 index 17f8af3..0000000 --- a/fetch_system_config/debian/files +++ /dev/null @@ -1,2 +0,0 @@ -fetch-melodic-config_0.9-1_amd64.deb main optional -freight-melodic-config_0.9-1_amd64.deb main optional diff --git a/fetch_system_config/debian/freight-melodic-config.debhelper.log b/fetch_system_config/debian/freight-melodic-config.debhelper.log deleted file mode 100644 index ab2ce64..0000000 --- a/fetch_system_config/debian/freight-melodic-config.debhelper.log +++ /dev/null @@ -1,28 +0,0 @@ -dh_auto_configure -dh_auto_build -dh_auto_test -dh_prep -dh_auto_install -dh_install -dh_installdocs -dh_installchangelogs -override_dh_systemd_enable dh_systemd_enable -override_dh_systemd_enable dh_systemd_enable -override_dh_systemd_enable dh_systemd_enable -dh_systemd_enable -dh_systemd_start -override_dh_installlogrotate dh_installlogrotate -dh_installlogrotate -dh_perl -dh_link -dh_compress -dh_fixperms -dh_strip -dh_makeshlibs -dh_shlibdeps -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_builddeb From 529db79352b3bdddab2b9e3a4e955334d07e4afc Mon Sep 17 00:00:00 2001 From: Eric Relson Date: Mon, 4 Feb 2019 07:40:07 -0800 Subject: [PATCH 05/11] Fixup .gitignore --- fetch_binary_drivers/.gitignore => .gitignore | 1 + 1 file changed, 1 insertion(+) rename fetch_binary_drivers/.gitignore => .gitignore (95%) diff --git a/fetch_binary_drivers/.gitignore b/.gitignore similarity index 95% rename from fetch_binary_drivers/.gitignore rename to .gitignore index 81fa991..9cbf068 100644 --- a/fetch_binary_drivers/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ build *.changes fetch-melodic-config freight-melodic-config +files From ead867e9ac270a67b68de8e0b364e08db9834336 Mon Sep 17 00:00:00 2001 From: Alexander Moriarty Date: Tue, 5 Feb 2019 12:09:02 -0800 Subject: [PATCH 06/11] [fetch_drivers] add more dependencies All these dependencies are exec_dependencies because this package doesn't compile anything. They're also in the CMakeLists.txt in the catkin_package and find_package to be safe. --- fetch_binary_drivers/CMakeLists.txt | 30 ++++++++++++++++++++++------- fetch_binary_drivers/package.xml | 21 +++++++++++++++++++- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/fetch_binary_drivers/CMakeLists.txt b/fetch_binary_drivers/CMakeLists.txt index b7514e9..a147cab 100644 --- a/fetch_binary_drivers/CMakeLists.txt +++ b/fetch_binary_drivers/CMakeLists.txt @@ -20,12 +20,16 @@ find_package(catkin REQUIRED ## System dependencies are found with CMake's conventions find_package(Boost REQUIRED COMPONENTS + chrono filesystem program_options - python - thread + regex system + thread ) +find_package(CURL REQUIRED) +find_package(PythonLibs REQUIRED) +find_package(yaml-cpp REQUIRED) add_custom_target( binary_driver ALL @@ -43,15 +47,27 @@ add_custom_target( ################################### ## The catkin_package macro generates cmake config files for your package ## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if your package contains header files ## LIBRARIES: libraries you create in this project that dependent projects also need ## CATKIN_DEPENDS: catkin_packages dependent projects also need ## DEPENDS: system dependencies of this project that dependent projects also need catkin_package( -# INCLUDE_DIRS include -# LIBRARIES fetch_binary_drivers -# CATKIN_DEPENDS other_catkin_pkg -# DEPENDS system_lib + LIBRARIES fetch_drivers + CATKIN_DEPENDS + actionlib + actionlib_msgs + diagnostic_msgs + fetch_driver_msgs + fetch_auto_dock_msgs + nav_msgs + power_msgs + robot_calibration_msgs + roscpp + sensor_msgs + DEPENDS + Boost + CURL + PYTHON + YAML_CPP ) ########### diff --git a/fetch_binary_drivers/package.xml b/fetch_binary_drivers/package.xml index b50b7db..88a9bd1 100644 --- a/fetch_binary_drivers/package.xml +++ b/fetch_binary_drivers/package.xml @@ -29,9 +29,28 @@ catkin + + mk - actionlib + + boost + curl + python + yaml-cpp + + + actionlib_msgs + diagnostic_msgs + fetch_driver_msgs + fetch_auto_dock_msgs + nav_msgs + power_msgs + robot_calibration_msgs + sensor_msgs + + + actionlib robot_controllers robot_controllers_interface rosconsole From b1445293704b1b026d377041b2d24c7f6a36e66e Mon Sep 17 00:00:00 2001 From: Eric Relson Date: Wed, 6 Feb 2019 19:10:31 -0800 Subject: [PATCH 07/11] Ensure robots power off safely when instructed to Also: - Fix remaining indigo references - Don't worry about conflicting packages that never existed - String fixes --- fetch_binary_drivers/README.md | 4 ++-- fetch_binary_drivers/package.xml | 8 ++++---- fetch_system_config/debian/control | 10 +++------- .../debian/fetch-melodic-config.postinst | 9 ++++----- .../debian/fetch-melodic-config.ros.logrotate | 4 ++-- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/fetch_binary_drivers/README.md b/fetch_binary_drivers/README.md index deb9ff9..a8014d9 100644 --- a/fetch_binary_drivers/README.md +++ b/fetch_binary_drivers/README.md @@ -36,8 +36,8 @@ Previously, we built our drivers on a private buildbot, and hosted them on our o We also had a manually synced mirror of the ros packages. This allowed us to ensure we tested the versions of dependancies which were on our mirror. The old process was not as automated as we would like. -We're in the process of testing melodic, and setting up our hosted stable mirror, and documenting the upgrade process to ensure Fetch Research Platform customers have a smooth transition. +We're in the process of testing ROS Melodic, and setting up our hosted stable mirror, and documenting the upgrade process to ensure Fetch Research Platform customers have a smooth transition. -We will announce to our customers when we're officially ready and supporting melodic. +We will announce to our customers when we're officially ready and supporting ROS Melodic. See https://docs.fetchrobotics.com for more information. diff --git a/fetch_binary_drivers/package.xml b/fetch_binary_drivers/package.xml index 88a9bd1..6585e13 100644 --- a/fetch_binary_drivers/package.xml +++ b/fetch_binary_drivers/package.xml @@ -6,20 +6,20 @@ The public fetch_drivers package is a binary only release. fetch_drivers contains both the drivers and firmware for the fetch and freight research robots. - There should be no reason to use these drivers unless you're running on a fetch or a frieght research robot. + There should be no reason to use these drivers unless you're running on a fetch or a freight research robot. This package, is a cmake/make only package which installs the binaries for the drivers and firmware. Alexander Moriarty - FetchRobotics Open Source Team + Fetch Robotics Open Source Team Proprietary - http://wiki.ros.org/fetch_drivers + https://wiki.ros.org/fetch_drivers https://docs.fetchrobotics.com https://fetchrobotics.com/robotics-platforms/ @@ -49,7 +49,7 @@ robot_calibration_msgs sensor_msgs - + actionlib robot_controllers robot_controllers_interface diff --git a/fetch_system_config/debian/control b/fetch_system_config/debian/control index f5c4153..b4fb0bf 100644 --- a/fetch_system_config/debian/control +++ b/fetch_system_config/debian/control @@ -16,9 +16,7 @@ Depends: ${misc:Depends}, ros-melodic-ros Description: Configuration for Fetch on Melodic This package will start ROS Melodic at bootup -Conflicts: fetch-indigo-config, - fetch-system-config, - freight-indigo-config, +Conflicts: fetch-system-config, freight-melodic-config, freight-system-config @@ -31,8 +29,6 @@ Depends: ${misc:Depends}, ros-melodic-ros Description: Configuration for Freight on Melodic This package will start ROS Melodic at bootup -Conflicts: fetch-indigo-config, - fetch-melodic-config, +Conflicts: fetch-melodic-config, fetch-system-config, - freight-system-config, - freight-indigo-config + freight-system-config diff --git a/fetch_system_config/debian/fetch-melodic-config.postinst b/fetch_system_config/debian/fetch-melodic-config.postinst index 8610a2d..58ddc6e 100755 --- a/fetch_system_config/debian/fetch-melodic-config.postinst +++ b/fetch_system_config/debian/fetch-melodic-config.postinst @@ -40,13 +40,12 @@ case "$1" in cp /opt/ros/melodic/share/fetch_bringup/launch/fetch.launch /etc/ros/melodic/robot.launch fi - # TODO this file is missing in 18.04? - # Override /etc/acpi/powerbtn.sh - echo "/sbin/shutdown -h now \"Power button pressed\"" > /etc/acpi/powerbtn.sh - echo "exit 0" >> /etc/acpi/powerbtn.sh + # Workaround for gnome-settings-daemon not enabling immediate shutdown + # https://unix.stackexchange.com/a/416569 + hostnamectl set-chassis vm # Do not wait for GRUB (we're headless) - sed -i "s/GRUB_TIMEOUT=.*\"\"/GRUB_TIMEOUT=10/" /etc/default/grub + sed -i "s/GRUB_TIMEOUT=.*\"\"/GRUB_TIMEOUT=5/" /etc/default/grub echo "GRUB_RECORDFAIL_TIMEOUT=\$GRUB_TIMEOUT" >> /etc/default/grub # Disable apport diff --git a/fetch_system_config/debian/fetch-melodic-config.ros.logrotate b/fetch_system_config/debian/fetch-melodic-config.ros.logrotate index c408da0..a318be8 100644 --- a/fetch_system_config/debian/fetch-melodic-config.ros.logrotate +++ b/fetch_system_config/debian/fetch-melodic-config.ros.logrotate @@ -4,7 +4,7 @@ compress # Run scripts once per set of logs sharedscripts firstaction - . /opt/ros/indigo/setup.sh + . /opt/ros/melodic/setup.sh # get run_id of ROS if it is running RUN_ID=`rosparam get /run_id 2>/dev/null` # Create a tarball if ROS is no longer using a given log subdirectory @@ -15,7 +15,7 @@ compress done endscript postrotate - . /opt/ros/indigo/setup.sh + . /opt/ros/melodic/setup.sh RUN_ID=`rosparam get /run_id 2>/dev/null` # Remove log subdirectory after tarball has been created for i in $( ls /var/log/ros | grep -v \.gz$ ); do From c5ee99181c01680a97c74396ad7ba363629cb889 Mon Sep 17 00:00:00 2001 From: Eric Relson Date: Wed, 6 Feb 2019 22:53:24 -0800 Subject: [PATCH 08/11] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9cbf068..7ea9cf3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ build *.tar.gz *.so -# system config +# system config; these are all files generated by deb-buildpackage *.deb *.debhelper *.substvars From d305db0fe86a991e7fc33dd0f5526a170974995b Mon Sep 17 00:00:00 2001 From: Eric Relson Date: Sat, 9 Feb 2019 15:38:07 -0800 Subject: [PATCH 09/11] Fix typo in .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7ea9cf3..4349be2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ build *.tar.gz *.so -# system config; these are all files generated by deb-buildpackage +# system config; these are all files generated by dpkg-buildpackage *.deb *.debhelper *.substvars From 4432ece5640efaefe03d56c2874fe0c186b50944 Mon Sep 17 00:00:00 2001 From: Eric Relson Date: Sat, 9 Feb 2019 16:23:47 -0800 Subject: [PATCH 10/11] Update wifi power management disabling --- fetch_system_config/debian/fetch-melodic-config.postinst | 4 ++++ fetch_system_config/root/etc/pm/power.d/wireless | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) delete mode 100755 fetch_system_config/root/etc/pm/power.d/wireless diff --git a/fetch_system_config/debian/fetch-melodic-config.postinst b/fetch_system_config/debian/fetch-melodic-config.postinst index 58ddc6e..18e4676 100755 --- a/fetch_system_config/debian/fetch-melodic-config.postinst +++ b/fetch_system_config/debian/fetch-melodic-config.postinst @@ -121,6 +121,10 @@ EOF makestep 1.0 100' >>/etc/chrony/chrony.conf fi + # Disable wifi power management in 18.04 + # https://gist.github.com/jcberthon/ea8cfe278998968ba7c5a95344bc8b55 + sed -i "s/wifi.powersave = 3/wifi.powersave = 2/" /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf + ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/fetch_system_config/root/etc/pm/power.d/wireless b/fetch_system_config/root/etc/pm/power.d/wireless deleted file mode 100755 index 1ab8167..0000000 --- a/fetch_system_config/root/etc/pm/power.d/wireless +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# This is essential for reliable robot wifi -/sbin/iwconfig wlan0 power off From 68d33faa6a99d2f3765e0bab858b41f2df185042 Mon Sep 17 00:00:00 2001 From: Eric Relson Date: Tue, 12 Feb 2019 08:40:20 -0800 Subject: [PATCH 11/11] Copy updates to freight post-install script --- .../debian/freight-melodic-config.postinst | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fetch_system_config/debian/freight-melodic-config.postinst b/fetch_system_config/debian/freight-melodic-config.postinst index 8610a2d..e368f70 100755 --- a/fetch_system_config/debian/freight-melodic-config.postinst +++ b/fetch_system_config/debian/freight-melodic-config.postinst @@ -37,16 +37,15 @@ case "$1" in # Copy the robot.launch if not already existent if [ ! -e "/etc/ros/melodic/robot.launch" ]; then mkdir -p /etc/ros/melodic - cp /opt/ros/melodic/share/fetch_bringup/launch/fetch.launch /etc/ros/melodic/robot.launch + cp /opt/ros/melodic/share/freight_bringup/launch/freight.launch /etc/ros/melodic/robot.launch fi - # TODO this file is missing in 18.04? - # Override /etc/acpi/powerbtn.sh - echo "/sbin/shutdown -h now \"Power button pressed\"" > /etc/acpi/powerbtn.sh - echo "exit 0" >> /etc/acpi/powerbtn.sh + # Workaround for gnome-settings-daemon not enabling immediate shutdown + # https://unix.stackexchange.com/a/416569 + hostnamectl set-chassis vm # Do not wait for GRUB (we're headless) - sed -i "s/GRUB_TIMEOUT=.*\"\"/GRUB_TIMEOUT=10/" /etc/default/grub + sed -i "s/GRUB_TIMEOUT=.*\"\"/GRUB_TIMEOUT=5/" /etc/default/grub echo "GRUB_RECORDFAIL_TIMEOUT=\$GRUB_TIMEOUT" >> /etc/default/grub # Disable apport @@ -122,6 +121,10 @@ EOF makestep 1.0 100' >>/etc/chrony/chrony.conf fi + # Disable wifi power management in 18.04 + # https://gist.github.com/jcberthon/ea8cfe278998968ba7c5a95344bc8b55 + sed -i "s/wifi.powersave = 3/wifi.powersave = 2/" /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf + ;; abort-upgrade|abort-remove|abort-deconfigure)