2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SROS2スイッチングスクリプト

Posted at

ROS2の動作環境がある場合、SROS2のセットアップは環境変数を設定するだけなので大したことはないのですが、SROS2をon/offするたびに、いちいち3つ設定するのも面倒なのでスクリプトを作りました。

使い方

SROS2をオンにするときは
source sros_switch.sh on

SROS2をオフにするときは
source sros_switch.sh off

コード

sros_switch.sh
#!/bin/bash


if [ $# -eq 1 ]; then
	if [ $1 = "on" ]; then
		echo "set environment variables"
		export ROS_SECURITY_ROOT_DIRECTORY=~/sros2_demo/demo_keys #適当なディレクトリに変えてください
		export ROS_SECURITY_ENABLE=true
		export ROS_SECURITY_STRATEGY=Enforce
	elif [ $1 = "off" ]; then
		echo "clear environment variables"
		unset ROS_SECURITY_ROOT_DIRECTORY
		unset ROS_SECURITY_ENABLE
		unset ROS_SECURITY_STRATEGY
	else
		echo "check argment"
	fi
else
	echo "check argment"
fi
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?