BEIKE blog

備忘録です

ros2 基本 メモ

パッケージ作成

ros2 pkg create hoge_pkg --dependencies rclcpp --build-type ament_cmake --license Apache-2.0
ros2 pkg create inverted_pendulum_robot_imu_filter_ros2 --dependencies rclcpp --build-type ament_cmake --license Apache-2.0 --maintainer-name "Tatsuhiro Ikebe" --maintainer-email "beike315@icloud.com"
ros2 pkg create diff_bot_description --build-type ament_cmake --dependencies urdf xacro --license Apache-2.0 --description "The diff_bot_description package" --maintainer-name "Tatsuhiro Ikebe" --maintainer-email "beike315@icloud.com" --package-format 3

参考元

docs.ros.org

gbiggs.github.io

qiita.com

ubuntu起動時に自動で立ち上がるアプリの設定を変更

概要

インターンの面接の時にTeamsが必要でインストールをしました。 そしたら、自動で立ち上がるようになって毎回見るだけでも辛くなってきたので(使わないのに立ち上がるので)自動で立ち上がらないようにするためのメモです。

以下のコマンドを打って、出てくるGUIを操作するとアプリ単位で自動起動を解除できます。

gnome-session-properties

参考

https://offlinememory.livedoor.blog/archives/8690658.html

メモ ubuntu エイリアス

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi
if [ -f /etc/bash_completion.d/git-prompt ]; then
    export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w$(__git_ps1)\[\033[00m\](\t)\$ '
else
    export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w \$ '
fi

if [ "$0" = "bash" ]; then
  /usr/bin/wmctrl -r :ACTIVE: -b add,above;
fi

## Docker
xhost +local:docker

## Alias set by yourself
alias sb='source ~/.bashrc'
alias vs='vim ~/.bashrc'
alias lo='gnome-screensaver-command -l'
alias x="perl -pe 's/\n/ /' | xsel --clipboard --input"
alias gs='git status'
alias gp='$(git push |& grep "git push")'

WSLでRVizを使用する

概要

WSL(ubuntu 18.04)でRVizを使用する際にエラーが出たので 上手く行った方法を備ぼる。

結論

WSL2を使おう docs.microsoft.com

手順

①WSLを入れる

②ros melodic desktopを入れる

X Window Systemのインストール

④RVizを立ち上げるために設定を行う

xming Serverを立ち上げる必要があるので XLaunchを起動します。

立ち上げるとこんな感じの画面がでてくる そのまま次へを選択

Image from Gyazo

この画面では一番上を選択して次へを選択

Image from Gyazo

この画面ではDisable access controlをチェックするのと パラメータとして-nowglを追加する必要がある

終わったら次へを選択する

Image from Gyazo

この画面ではそのまま完了を押せば良い

これでxming serverの立ち上げは完了

Image from Gyazo

続いてmesa-utilsをインストールする

sudo apt install mesa-utils

続いて設定を~/.bashrcに書きます

export DISPLAY=localhost:0.0   #0.0は上の絵のポップアップで出てくる数字に合わせる
export LIBGL_ALWAYS_INDIRECT=
export GAZEBO_IP=127.0.0.1

追加し終えたらsource ~/.bashrcを実行

④RVizを起動 これで上手くRVizを立ち上げることができると思います

ターミナルが一つのみの場合
roscore &
rosrun rviz rviz

確認が終わったら killall -9 rosmasterでrosmasterのプロセスを落とす

複数ターミナルの場合
roscore
rosrun rviz rviz

こちらはctl+cでroscoreを落とせば良い

micro-ROSの調査

概要

micro-ROSっていうのがあるけど、ros serialとどっちが良いのとか悩み始めたが 両方とも全く知らんので少し調べる。

micro-ROS

  • ROS2をマイコン上で使用するためのもの。ROS2ノードをマイコン上で立ち上げることができる。

  • micro-ROSで開発したものはバイナリ化できる。

追記予定