feat(slam): add cartographer_ros

This commit is contained in:
X-lanni
2025-07-04 14:39:48 +08:00
parent df9cee5779
commit 5cf886315d
825 changed files with 92220 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Copyright 2016 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o verbose
. /opt/ros/${ROS_DISTRO}/setup.sh
cd catkin_ws
catkin_test_results $@
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
# Usage: ./check_access_token.sh ACCESS_TOKEN
# Returns non-zero exit code if ACCESS_TOKEN is invalid.
if [ "$#" -ne 1 ]; then
echo "Please provide an access token to $0" 1>&2
exit 1
fi
token=$1
set -e
function on_error {
echo "Failed to validate GitHub access token!" 1>&2
exit 1
}
trap on_error ERR
test_response=$(curl -s https://api.github.com/?access_token=${token})
echo $test_response | grep -ivq "bad credentials"
echo $"GitHub access token is valid."
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
# Copyright 2016 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o verbose
. /opt/ros/${ROS_DISTRO}/setup.sh
cd catkin_ws
# Build, install, and test.
#
# It's necessary to use the '--install' flag for every call to
# 'catkin_make_isolated' in order to avoid the use of 'devel_isolated' as the
# 'CMAKE_INSTALL_PREFIX' for non-test targets. This in itself is important to
# avoid any issues caused by using 'CMAKE_INSTALL_PREFIX' during the
# configuration phase of the build (e.g. cartographer/common/config.h.cmake).
export BUILD_FLAGS="--use-ninja --install-space /opt/cartographer_ros --install"
catkin_make_isolated ${BUILD_FLAGS} $@
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# Copyright 2016 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o verbose
# Install CMake, Ninja, stow.
sudo apt-get update
sudo apt-get install -y lsb-release cmake ninja-build stow
# Install GMock library and header files for newer distributions.
if [[ "$(lsb_release -sc)" = "focal" || "$(lsb_release -sc)" = "buster" ]]
then
sudo apt-get install -y libgmock-dev
fi
. /opt/ros/${ROS_DISTRO}/setup.sh
cd catkin_ws
# Install rosdep dependencies.
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
# Update rosconsole-bridge to fix build issue with Docker image for Kinetic
sudo apt-get install ros-${ROS_DISTRO}-rosconsole-bridge -y
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
# Copyright 2016 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Cache intermediate Docker layers. For a description of how this works, see:
# https://giorgos.sealabs.net/docker-cache-on-travis-and-docker-112.html
set -o errexit
set -o verbose
set -o pipefail
if [ -f ${DOCKER_CACHE_FILE} ]; then
gunzip -c ${DOCKER_CACHE_FILE} | docker load;
fi
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
# Copyright 2016 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o verbose
. /opt/ros/${ROS_DISTRO}/setup.sh
# Create a new workspace in 'catkin_ws'.
mkdir -p catkin_ws/src
cd catkin_ws/src
wstool init
# Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
wstool merge ../../cartographer_ros/cartographer_ros.rosinstall
# We default to master and wstool seems to have a bug when it's being set twice.
# TODO(MichaelGrupp): wstool is unmaintained, use vcstool.
if [ ${CARTOGRAPHER_VERSION} != "master" ]; then
wstool set cartographer -v ${CARTOGRAPHER_VERSION} -y
fi
wstool remove cartographer_ros
wstool update
@@ -0,0 +1,33 @@
#!/bin/sh
# Copyright 2016 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o verbose
. /opt/ros/${ROS_DISTRO}/setup.sh
# Create a new workspace in 'catkin_ws'.
mkdir -p catkin_ws/src
cd catkin_ws/src
wstool init
# Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
wstool merge ../../cartographer_ros/cartographer_ros.rosinstall
wstool merge -y https://raw.githubusercontent.com/cartographer-project/cartographer_fetch/master/cartographer_fetch.rosinstall
wstool merge -y https://raw.githubusercontent.com/magazino/cartographer_magazino/master/cartographer_magazino.rosinstall
wstool set cartographer -v ${CARTOGRAPHER_VERSION} -y
wstool remove cartographer_ros
wstool update
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# Copyright 2016 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
source "/opt/ros/${ROS_DISTRO}/setup.bash"
source "/opt/cartographer_ros/setup.bash"
exec "$@"
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# Copyright 2016 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Cache intermediate Docker layers. For a description of how this works, see:
# https://giorgos.sealabs.net/docker-cache-on-travis-and-docker-112.html
set -o errexit
set -o verbose
set -o pipefail
if [[ ${TRAVIS_BRANCH} == "master" ]] &&
[[ ${TRAVIS_PULL_REQUEST} == "false" ]]; then
mkdir -p $(dirname ${DOCKER_CACHE_FILE})
IMAGE_NAMES=$(docker history -q cartographer_ros:${ROS_RELEASE} | grep -v '<missing>')
docker save ${IMAGE_NAMES} | gzip > ${DOCKER_CACHE_FILE}.new
mv ${DOCKER_CACHE_FILE}.new ${DOCKER_CACHE_FILE}
fi