Skip to content

Commit

Permalink
feat: support iron (#175)
Browse files Browse the repository at this point in the history
* added repos for iron

Signed-off-by: ymski <[email protected]>

* added installation files for iron

Signed-off-by: ymski <[email protected]>

* add setup shell for iron

Signed-off-by: ymski <[email protected]>

* update ros distribution

Signed-off-by: ymski <[email protected]>

* update ros distribution

Signed-off-by: ymski <[email protected]>

* update humble to iron

Signed-off-by: ymski <[email protected]>

* remove redundant setup files

Signed-off-by: ymski <[email protected]>

* install latest lttng to avoid version mispatching

Signed-off-by: ymski <[email protected]>

* install latest to avoid version mispatching

Signed-off-by: ymski <[email protected]>

* add -d option

Signed-off-by: ymski <[email protected]>

* ci(pre-commit): autofix

* integrate setup scripts

Signed-off-by: ymski <[email protected]>

* fix shell check

Signed-off-by: ymski <[email protected]>

* fix shell check

Signed-off-by: ymski <[email protected]>

* added lttng role to playbook for iron

Signed-off-by: ymski <[email protected]>

* fix condition

Signed-off-by: ymski <[email protected]>

* ci(pre-commit): autofix

* ignore nchd

Signed-off-by: ymski <[email protected]>

---------

Signed-off-by: ymski <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ymski and pre-commit-ci[bot] authored Dec 13, 2023
1 parent c89e0c8 commit 13125af
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 2 deletions.
20 changes: 20 additions & 0 deletions ansible/playbook_iron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- hosts: localhost
connection: local
become: false
vars_prompt:
- name: package_install
prompt: Would you like to install the require packages[y/n]
default: y
private: false
pre_tasks:
- name: Verify OS
ansible.builtin.fail:
msg: Only Ubuntu 22.04 is supported for this branch. Please refer to https://tier4.github.io/caret_doc/latest/installation/installation/
when: ansible_distribution_version != '22.04'

roles:
- { role: lttng, tags: [lttng], when: package_install == 'y' }
- { role: ros-tracing, rosdistro: iron, tags: [ros-tracing], when: package_install == 'y' }
- { role: visualizer, tags: [visualizer], when: package_install == 'y' }
- { role: caret_iron, rosdistro: iron, tags: [caret] }
- { role: cyclonedds, rosdistro: iron, tags: [cyclonedds] }
5 changes: 5 additions & 0 deletions ansible/roles/caret_iron/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rosdistro: iron
targeted_skip_keys: console_bridge fastcdr fastrtps rti-connext-dds-6.0.1 urdfdom_headers
setenv_caret_script_template: setenv_caret.bash.jinja2
caret_topic_filter_template: caret_topic_filter.bash.jinja2
requirements_path: requirements.txt
58 changes: 58 additions & 0 deletions ansible/roles/caret_iron/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
- name: ROS2 (check rosdep file)
stat:
path: /etc/ros/rosdep/sources.list.d/20-default.list
register: ros_repository

- name: ROS2 (install rosdep)
apt:
name: python3-rosdep
state: latest
update_cache: true
become: true

- name: ROS2 (initialize rosdep)
command: rosdep init
when: ros_repository.stat.exists == false
become: true

- name: ROS2 (update rosdep)
command: rosdep update
become: false

- name: caret (rosdep install dependencies)
shell: |
rosdep install -y --from-paths src --ignore-src --rosdistro {{ rosdistro }} -y --skip-keys "{{ targeted_skip_keys }}"
args:
chdir: "{{ WORKSPACE_ROOT }}"

- name: caret (install some packages for build)
apt:
name:
- ros-{{ rosdistro }}-osrf-testing-tools-cpp
- ros-{{ rosdistro }}-performance-test-fixture
- ros-{{ rosdistro }}-mimick-vendor
- ros-{{ rosdistro }}-test-msgs
- ros-{{ rosdistro }}-cyclonedds
become: true

- name: caret (install python module)
pip:
requirements: "{{ requirements_path }}"
executable: pip3
become: true
args:
chdir: "{{ WORKSPACE_ROOT }}"

- name: caret (copy CARET setenv template as reference)
ansible.builtin.template:
src: "{{ setenv_caret_script_template }}"
dest: "{{ WORKSPACE_ROOT }}/setenv_caret.bash"
mode: 0755
become: false

- name: caret (copy topic filter as reference)
ansible.builtin.template:
src: "{{ caret_topic_filter_template }}"
dest: "{{ WORKSPACE_ROOT }}/caret_topic_filter.bash"
mode: 0755
become: false
25 changes: 25 additions & 0 deletions ansible/roles/caret_iron/templates/caret_topic_filter.bash.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

export CARET_IGNORE_NODES=\
"\
/rviz*\
"

export CARET_IGNORE_TOPICS=\
"\
/clock:\
/parameter_events\
"

# if you want to select nodes or topics,
# please remove comment out of the followings.
# export CARET_SELECT_NODES=\
# "\
# /rviz*\
# "

# export CARET_SELECT_TOPICS=\
# "\
# /clock:\
# /parameter_events\
# "
22 changes: 22 additions & 0 deletions ansible/roles/caret_iron/templates/setenv_caret.bash.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

source /opt/ros/{{ rosdistro }}/setup.bash
source {{ WORKSPACE_ROOT }}/install/local_setup.bash
source {{ WORKSPACE_ROOT }}/caret_topic_filter.bash

export LD_PRELOAD=$(readlink -f {{ WORKSPACE_ROOT}}/install/caret_trace/lib/libcaret.so)

USERNAME=$(whoami)
ps -axo user:32,command | grep lttng-sessiond | grep $USERNAME | grep -v grep > /dev/null
if [ $? -ne 0 ]; then
lttng-sessiond --daemonize
fi

# If you want to apply CARET to a large application,
# it is recommended to increase the maximum number of
# file descriptors to avoid data loss.
# Execute ulimit command as below.
# ulimit -n 16384

# Add user application built with caret/rclcpp
# source /path/to/your/application/install/setup.bash
2 changes: 2 additions & 0 deletions ansible/roles/lttng/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
name:
- lttng-tools
- liblttng-ust-dev
state: latest
become: true

- name: LTTng (install babeltrace)
apt:
name:
- python3-babeltrace
- python3-lttng
state: latest
become: true
26 changes: 26 additions & 0 deletions caret_iron.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repositories:
CARET/caret_trace:
type: git
url: https://github.com/tier4/caret_trace.git
version: main
CARET/caret_analyze:
type: git
url: https://github.com/tier4/caret_analyze.git
version: main
CARET/caret_analyze_cpp_impl:
type: git
url: https://github.com/tier4/caret_analyze_cpp_impl.git
version: main
CARET/ros2caret:
type: git
url: https://github.com/tier4/ros2caret.git
version: main
# Dependency for CI/CD
CARET/caret_common:
type: git
url: https://github.com/tier4/caret_common.git
version: main
eclipse-cyclonedds/cyclonedds:
type: git
url: https://github.com/eclipse-cyclonedds/cyclonedds.git
version: releases/0.10.x
30 changes: 28 additions & 2 deletions setup_caret.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,29 @@ function show_usage() {
echo " -h or --help: show help message"
echo " -c or --no-interactive"
echo " -n or --no-package-install"
echo " -d or --ros-distro"
exit 0
}

ALLOWED_ROS_DISTRO=("humble" "iron")

function validate_ros_distro() {
if [[ " ${ALLOWED_ROS_DISTRO[*]} " != *" $1 "* ]]; then
echo "error: $1 is not supported ROS Distribution." >&2
echo "Supported ROS Distributions are ${ALLOWED_ROS_DISTRO[*]}" >&2
exit 1
fi
}

# parse command options.
OPT=$(getopt -o nch -l no-interactive,no-package-install,help -- "$@")
OPT=$(getopt -o nchd: -l no-interactive,no-package-install,help,ros-distro: -- "$@") # cSpell:ignore nchd

eval set -- "$OPT"

# Parse args
noninteractive=0
package_install=1
ros_distro=humble

while true; do
case $1 in
Expand All @@ -35,13 +47,21 @@ while true; do
package_install=0
shift
;;
-d | --ros-distro)
shift
ros_distro=$1
shift
;;
--)
shift
break
;;
esac
done

# Check ROS Distribution
validate_ros_distro "$ros_distro"

# Confirm whether to start installation
if [ $noninteractive -eq 0 ]; then
# Prevent root execution in interactive mode
Expand Down Expand Up @@ -93,8 +113,14 @@ if [ $package_install -eq 0 ]; then
options=("--extra-vars" "package_install=n")
fi

# Select playbook
PLAYBOOK="playbook.yml"
if [ "$ros_distro" = "iron" ]; then
PLAYBOOK="playbook_iron.yml"
fi

# Run ansible
if ansible-playbook "$SCRIPT_DIR/ansible/playbook.yml" -e WORKSPACE_ROOT="$SCRIPT_DIR" "${options[@]}"; then
if ansible-playbook "$SCRIPT_DIR/ansible/$PLAYBOOK" -e WORKSPACE_ROOT="$SCRIPT_DIR" "${options[@]}"; then
echo -e "\e[32mCompleted.\e[0m"
exit 0
else
Expand Down

0 comments on commit 13125af

Please sign in to comment.