All Projects → rt-net → raspimouse_ros2_examples

rt-net / raspimouse_ros2_examples

Licence: Apache-2.0 License
ROS 2 examples for Raspberry Pi Mouse

Programming Languages

C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language
CMake
9771 projects
c
50402 projects - #5 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to raspimouse ros2 examples

raspimouse2
ROS 2 node for Raspberry Pi Mouse
Stars: ✭ 23 (-20.69%)
Mutual labels:  raspberry-pi-mouse, ros2
ROS
ROS机器人操作系统 学习(写于2020年夏)
Stars: ✭ 102 (+251.72%)
Mutual labels:  ros2
tello ros
C++ ROS2 driver for DJI Tello drones
Stars: ✭ 110 (+279.31%)
Mutual labels:  ros2
linorobot2
Autonomous mobile robots (2WD, 4WD, Mecanum Drive)
Stars: ✭ 97 (+234.48%)
Mutual labels:  ros2
raspimouse sim
ROS package suite for Raspberry Pi Mouse Simulator
Stars: ✭ 23 (-20.69%)
Mutual labels:  raspberry-pi-mouse
mros2
agent-less and lightweight communication library compatible with rclcpp for embedded devices
Stars: ✭ 72 (+148.28%)
Mutual labels:  ros2
aztarna
aztarna, a footprinting tool for robots.
Stars: ✭ 85 (+193.1%)
Mutual labels:  ros2
astuff sensor msgs
A set of messages specific to each sensor supported by AutonomouStuff.
Stars: ✭ 37 (+27.59%)
Mutual labels:  ros2
rclshark
Tool for ROS 2 IP Discovery + System Monitoring
Stars: ✭ 32 (+10.34%)
Mutual labels:  ros2
SMARTmBOT
The goal of this repository is to introduce a new, customizable, scalable, and fully opensource mobile robot platform, called SMARTmBOT. This repository provides a guide, and all design files and source codes so that you can build your own SMARTmBOT. SMARTmBOT can be useful for studying the basics of robotics, especially mobile robotics. It can …
Stars: ✭ 29 (+0%)
Mutual labels:  ros2
ros-gst-bridge
a bidirectional ros to gstreamer bridge and utilities for dynamic pipelines
Stars: ✭ 46 (+58.62%)
Mutual labels:  ros2
SMACC2
An Event-Driven, Asynchronous, Behavioral State Machine Library for ROS2 (Robotic Operating System) applications written in C++
Stars: ✭ 58 (+100%)
Mutual labels:  ros2
navigation2 tutorials
Tutorial code referenced in https://navigation.ros.org/
Stars: ✭ 60 (+106.9%)
Mutual labels:  ros2
zenoh-plugin-dds
A zenoh plug-in that allows to transparently route DDS data. This plugin can be used by DDS applications, such as ROS2 robotic applications and others, to leverage the zenoh for geographical routing or for better scaling discovery.
Stars: ✭ 60 (+106.9%)
Mutual labels:  ros2
ros2-ORB SLAM2
ROS2 node wrapping the ORB_SLAM2 library
Stars: ✭ 41 (+41.38%)
Mutual labels:  ros2
NuttX
Official micro-ROS RTOS
Stars: ✭ 63 (+117.24%)
Mutual labels:  ros2
zhe
Lighter-than-air, peer-to-peer, bounded, non-blocking, non-threaded, etc., publish-subscribe networking
Stars: ✭ 44 (+51.72%)
Mutual labels:  ros2
rmw ecal
ROS2 middleware based on eCAL
Stars: ✭ 30 (+3.45%)
Mutual labels:  ros2
isaac ros visual odometry
Visual odometry package based on hardware-accelerated NVIDIA Elbrus library with world class quality and performance.
Stars: ✭ 101 (+248.28%)
Mutual labels:  ros2
trac ik
ROS 2 port of `trac_ik`, an alternative Inverse Kinematics solver to the popular inverse Jacobian methods in KDL.
Stars: ✭ 14 (-51.72%)
Mutual labels:  ros2

English | 日本語

raspimouse_ros2_examples

industrial_ci

Raspberry Pi MouseのROS 2サンプルコード集です。

ROS1のサンプルコード集はこちら

Requirements

Installation

$ cd ~/ros2_ws/src
# Clone package
$ git clone -b $ROS_DISTRO-devel https://github.com/rt-net/raspimouse_ros2_examples

# Install dependencies
$ rosdep install -r -y --from-paths . --ignore-src

# Build & Install
$ cd ~/ros2_ws
$ colcon build --symlink-install
$ source ~/ros2_ws/install/setup.bash

License

このリポジトリはApache 2.0ライセンスの元、公開されています。 ライセンスについてはLICENSEを参照ください。

How To Use Examples


joystick_control

ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。

Requirements

How to use

次のコマンドでノードを起動します。

# Use F710
$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true

# Use DUALSHOCK 3
$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true

# Control from remote computer
## on RaspberryPiMouse
$ ros2 run raspimouse raspimouse
## on remote computer
$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false

デフォルトのキー割り当てはこちらです。

Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを D (DirectInput Mode)に設定します。

Configure

./config/joy_f710.yml./config/joy_dualshock3.yml のキー番号を編集することで、キー割り当てを変更できます。

button_shutdown_1       : 8
button_shutdown_2       : 9

button_motor_off        : 8
button_motor_on         : 9

button_cmd_enable       : 4

Videos

joystick_control

back to example list


object_tracking

色情報をもとにオレンジ色のボールの追跡を行うコード例です。 USB接続のWebカメラとOpenCVを使ってボール追跡をします。

Requirements

Installation

Raspberry Pi Mouseにカメラマウントを取り付け、WebカメラをRaspberry Piに接続します。

How to use

次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。

$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config
$ ./configure_camera.bash

次のコマンドでノードを起動します。

$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py

カメラ画像はraw_image、物体検出画像はresult_imageというトピックとして発行されます。 これらの画像はRVizrqt_image_view で表示できます。

画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。

Configure

追跡対象の色を変更するには ./src/object_tracking_component.cpp を編集します。

物体検出精度が悪い時にはカメラの露光や関数内のパラメータを調整して下さい。

void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame)
{
  cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin);  // Orange
  // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin);  // Green
  // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin);  // Blue

Videos

object_tracking

back to example list


line_follower

ライントレースのコード例です。

Requirements

Installation

Raspberry Pi Mouseにライントレースセンサを取り付けます。

How to use

次のコマンドでノードを起動します。

$ ros2 launch raspimouse_ros2_examples line_follower.launch.py

Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド上のセンサ値をサンプリングします。

次に、センサとラインが重なるようにRaspberry Pi Mouseを置き、SW1を押してライン上のセンサ値をサンプリングします。

最後に、ライン上にRaspberry Pi Mouseを置き、SW0を押してライントレースを開始します。

もう一度SW0を押すとライントレースを停止します。

Configure

走行速度を変更するには./src/line_follower_component.cppを編集します。

void Follower::publish_cmdvel_for_line_following(void)
{
  const double VEL_LINEAR_X = 0.08;  // m/s
  const double VEL_ANGULAR_Z = 0.8;  // rad/s
  const double LOW_VEL_ANGULAR_Z = 0.5;  // rad/s

Videos

line_follower

back to example list


SLAM

LiDARとslam_toolbox を使ってSLAM(自己位置推定と地図作成)を行うサンプルです。

Requirements

Installation

Raspberry Pi MouseにLiDARを取り付けます。

  • LDS-01

How to use

Raspberry Pi Mouse上で次のコマンドでノードを起動します。

# LDS
$ ros2 launch raspimouse_ros2_examples mouse_with_lidar.launch.py lidar:=lds

Raspberry Pi Mouseを動かすためteleop_joy.launch.pyを起動します

# Use DUALSHOCK 3
$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=false

次のコマンドでslam_toolboxパッケージを起動します。(Remote computerでの実行推奨)

$ ros2 launch raspimouse_ros2_examples slam.launch.py

Raspberry Pi Mouseを動かして地図を作成します。

次のコマンドで作成した地図を保存します。

$ mkdir ~/maps
$ ros2 run nav2_map_server map_saver_cli -f ~/maps/mymap --ros-args -p save_map_timeout:=10000

Configure SLAM parameters

./config/mapper_params_offline.yamlslam_toolboxパッケージのパラメータを調節します。

Configure Odometry calculation

下記のようにmouse.ymlを編集し、use_pulse_counterstrueに(初期値: false)することで、 raspimouseノードがモータの制御パルス数からオドメトリ(/odom)を計算します。

これは自己位置推定の精度を向上させます。

raspimouse:
  ros__parameters:
    odometry_scale_left_wheel : 1.0
    odometry_scale_right_wheel: 1.0
    use_light_sensors         : true
    use_pulse_counters        : true

back to example list


direction_controller

IMUセンサを使用した角度制御のコード例です。

Requirements

Installation

LiDAR MountにIMUセンサモジュールを取り付けます。

Raspberry Pi Mouse にLiDAR Mountを取り付けます。

How to use

次のコマンドでノードを起動します。

$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py

SW0 ~ SW2を押して動作モードを切り替えます。

  • SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を0 radにリセットします
  • SW1: 方位角を0 radに維持する角度制御を開始します
    • SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します
  • SW2: 方位角を-π ~ π radに変化させる角度制御を開始します
    • SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します

Configure

パラメータで角度制御に使うPIDゲインを変更できます。

$ ros2 param set /direction_controller p_gain 10.0
Set parameter successful

$ ros2 param set /direction_controller i_gain 0.5
Set parameter successful

$ ros2 param set /direction_controller d_gain 0.0
Set parameter successful

Parameters

  • p_gain
    • Proportional gain of a PID controller for the direction control
    • default: 10.0, min:0.0, max:30.0
    • type: double
  • i_gain
    • Integral gain of a PID controller for the direction control
    • default: 0.0, min:0.0, max:5.0
    • type: double
  • d_gain
    • Derivative gain of a PID controller for the direction control
    • default: 20.0, min:0.0, max:30.0
    • type: double
  • target_angle
    • Target angle for the SW1 control mode.
    • default: 0.0, min:-π, max:+π
    • type: double

Publish topics

  • heading_angle
    • Heading angle of the robot that calculated from the IMU module sensor values.
    • type: std_msgs/Float64

Videos

back to example list

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].