Giter VIP home page Giter VIP logo

raspimouse_sim's Introduction

English | 日本語

raspimouse_sim

Gazebo上でシミュレートできるRaspberry Pi MouseのROSパッケージ一式です。

詳細なセットアップ方法はWikiにまとめています。

ROS Package Status

main develop
(master)
Noetic + Ubuntu Focal
(noetic-devel)
industrial_ci industrial_ci

以下のブランチのメンテナンスは終了しています。

  • rpim_book_version
  • indigo-devel
  • kinetic-devel
  • melodic-devel

動作環境

以下の環境を前提として動作確認しています。

  • Ubuntu
    • Ubuntu Focal Fossa 20.04.*
  • ROS
    • ROS Noetic Ninjemys
  • Gazebo
    • Gazebo 11.x
  • ROS Package
    • ros-noetic-desktop-full

インストール方法

このROSパッケージをダウンロードします。

cd ~/catkin_ws/src
git clone https://github.com/rt-net/raspimouse_sim.git

依存しているROSパッケージをインストールします。

cd ~/catkin_ws/src
git clone https://github.com/ryuichiueda/raspimouse_ros_2.git
git clone https://github.com/rt-net/raspimouse_description.git
rosdep install -r -y -i --from-paths raspimouse*

catkin_makeを使用してパッケージをビルドします。

cd ~/catkin_ws && catkin_make
source ~/catkin_ws/devel/setup.bash

Gazeboで使用するハードウェアモデルデータをダウンロードします。

rosrun raspimouse_gazebo download_gazebo_models.sh

QuickStart

シミュレータのインストール後、次のコマンドを入力して起動してください。

roslaunch raspimouse_gazebo raspimouse_with_samplemaze.launch

詳細はこのページをお読みください。

スクリーンショット

サンプル迷路での動作例

roslaunch raspimouse_gazebo raspimouse_with_samplemaze.launch

URG付きモデルでの動作例

roslaunch raspimouse_gazebo raspimouse_with_gasstand.launch

URG付きモデルでSLAM動作例

# 1つ目の端末で
roslaunch raspimouse_gazebo raspimouse_with_willowgarage.launch
# 2つ目の端末で
roslaunch raspimouse_ros_examples slam_gmapping.launch
# 3つ目の端末で
roslaunch raspimouse_ros_examples teleop.launch key:=true mouse:=false

※raspimouse_ros_examplesを使う際にはrt-net/raspimouse_ros_examplesのインストールが必要です。

以下のコマンドでインストールができます。

cd ~/catkin_ws/src
git clone https://github.com/rt-net/raspimouse_ros_examples.git
rosdep install -r -y -i --from-paths raspimouse*
cd ~/catkin_ws && catkin_make
source ~/catkin_ws/devel/setup.bash

ライセンス

このリポジトリはMITライセンスに基づいて公開されています。
MITライセンスについてはLICENSEを確認してください。

※このソフトウェアは基本的にオープンソースソフトウェアとして「AS IS」(現状有姿のまま)で提供しています。本ソフトウェアに関する無償サポートはありません。
バグの修正や誤字脱字の修正に関するリクエストは常に受け付けていますが、それ以外の機能追加等のリクエストについては社内のガイドラインを優先します。

謝辞

以下のリポジトリのファイルをベースに開発されています。

raspimouse_sim's People

Contributors

shotaak avatar shotahirama avatar shu-13 avatar tiryoh avatar yusukekato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

raspimouse_sim's Issues

バーチャルデバイスファイル機能をオプションにする

現在、テキストファイルを仮想のデバイスファイルとして/dev/以下に作成して、実機のロボットと同じようにraspimouse_ros_2パッケージを経由してセンサやモータへアクセスしている。
ほかのロボットのシミュレータと同様に、本シミュレータにはROSのインターフェースのみ(/cmd_vel/lightsensorsなどのトピックの配信/購読)を用意し、仮想のデバイスファイルはオプションとして分割して提供する。この場合、raspimouse_ros_2なしでもROSトピックのやりとりが可能となる。

def write_to_file(data):
try:
with open("/dev/rtlightsensor0", "w") as f:
print("%d %d %d %d" % tuple(data), file=f)

odom.rvizについて

現状の問題点

odom.rvizにラズパイマウスと関係ないステレオカメラのトピックが追加されている。
また、laser scanのトピックが追加されていないので追加したい。

改善案

pointcloud2を消去して、laserscanを足す。

ROS Noeticでpythonノードが「 /usr/bin/env: `python': そのようなファイルやディレクトリはありません」と出力する

不具合の概要

Ubuntu 20.04, ROS Noetic環境でroslaunch raspimouse_gazebo raspimouse_with_samplemaze.launchを実行すると、
/usr/bin/env: 'python': そのようなファイルやディレクトリはありませんというメッセージが出力され、
distance_sensor_simulatorノードが強制終了します。

実行環境

  • OS: Ubuntu 20.04, ROS Noetic
  • ソフトのバージョン: 3b63a4b

再現方法

  1. roslaunch raspimouse_gazebo raspimouse_with_samplemaze.launchを実行する
  2. エラーが表示される

その他

CMakeLists.txtでcatkin_install_python()を実行すると、環境に合わせてpythonスクリプトのshebangをpython2やpython3に書き換えてインストールしてくれます。

参考情報:http://wiki.ros.org/UsingPython3/SourceCodeChanges

raspimouse_gazebo/CMakeLists.txtの修正が必要だと思われます。

install(PROGRAMS
scripts/download_gazebo_models.sh
scripts/distance_sensor_simulator.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

ブランチ構成の変更

kinetic-develブランチをmelodic-develブランチをmasterブランチに統合して、メンテナンスのしやすさを向上させる。

noetic対応について

現状の問題点

ROS Noeticに未対応

改善案

パッケージ内のPythonスクリプトをPython 2からPython 3へ移行させます。

変更前

#!/usr/bin/env python

変更後

#!/usr/bin/env python3

以上の方法でnoetic環境でシミュレータが動作することを確認しました。

代替案

その他

motion with cmd_vel

The robot should not stop after subscribing cmd_vel. The values should be explicitly given when the robot stops.

Or should I fix the side of the actual robot? In the viewpoint of safety, I also think that the robot should stop when subscribing of cmd_vel is stopped.

collisionモデルの簡略化

モデルのcollisionにmeshデータを使用している。

<collision>
<geometry>
<mesh filename="package://raspimouse_description/meshes/dae/body/RasPiMouse_body.dae"/>
</geometry>
</collision>

しかし、シミュレーション時に演算量が多く、シミュレーション速度の低下に繋がっている。実際にはここまで細かいデータである必要はなく、例えばTurtleBot3では近似した形状でcollisionを定義している。

    <collision>
      <origin xyz="-0.064 0 0.047" rpy="0 0 0"/>
      <geometry>
        <box size="0.266 0.266 0.094"/>
      </geometry>
    </collision>

https://github.com/ROBOTIS-GIT/turtlebot3/blob/c2e272faf915e6cb416d50fa16ef971c6f402d9a/turtlebot3_description/urdf/turtlebot3_waffle_pi.urdf.xacro#L23-L28

collisionモデルの簡略化によってシミュレーション速度の向上が期待できる。

xacro warnings

  • ENV
    • Ubuntu 16.04
    • ROS Kinetic
    • kinetic-devel
ubuntu@ubuntu:~/catkin_ws/src/raspimouse_sim$ rosrun xacro xacro raspimouse_gazebo/materials/sample_maze.world.xacro 
xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
deprecated: xacro tags should be prepended with 'xacro' xml namespace.
Use the following script to fix incorrect usage:
        find . -iname "*.xacro" | xargs sed -i 's#<\([/]\?\)\(if\|unless\|include\|arg\|property\|macro\|insert_block\)#<\1xacro:\2#g'
when processing file: raspimouse_gazebo/materials/sample_maze.world.xacro

...

xacro.py is deprecated; please use xacro instead

lightsensors not working on ROS Kinetic

lightsensors are not working on ROS Kinetic.

$ rostopic echo /raspimouse_gazebo/lf_scan                                                                                                                                        
header:                                                                                                                                                                           
  seq: 0                                                                                                                                                                          
  stamp:                                                                                                                                                                          
    secs: 3                                                                                                                                                                       
    nsecs:  51000000                                                                                                                                                              
  frame_id: lf                                                                                                                                                                    
angle_min: -0.15000000596                                                                                                                                                         
angle_max: 0.15000000596                                                                                                                                                          
angle_increment: -0.300000011921                                                                                                                                                  
time_increment: 0.0                                                                                                                                                               
scan_time: 0.0                                                                                                                                                                    
range_min: 0.00999999977648                                                                                                                                                       
range_max: 0.600000023842                                                                                                                                                         
ranges: []                                                                                                                                                                        
intensities: []                                                                                                                                                                   
---                                                                                                                                                                               
header:                                                                                                                                                                           
  seq: 1                                                                                                                                                                          
  stamp:                                                                                                                                                                          
    secs: 3                                                                                                                                                                       
    nsecs: 101000000                                                                                                                                                              
  frame_id: lf                                                                                                                                                                    
angle_min: -0.15000000596                                                                                                                                                         
angle_max: 0.15000000596                                                                                                                                                          
angle_increment: -0.300000011921            
time_increment: 0.0                         
scan_time: 0.0                              
range_min: 0.00999999977648                 
range_max: 0.600000023842                   
ranges: []
intensities: []

It should be like this.

ubuntu@ubuntu:~$ rostopic echo /raw_raspimouse/lf/scan 
header: 
  seq: 43
  stamp: 
    secs: 2
    nsecs: 202000000
  frame_id: lf
angle_min: -0.15000000596
angle_max: 0.15000000596
angle_increment: -0.300000011921
time_increment: 0.0
scan_time: 0.0
range_min: 0.00999999977648
range_max: 0.600000023842
ranges: [0.5359607934951782]
intensities: [0.0]
---
header: 
  seq: 44
  stamp: 
    secs: 2
    nsecs: 252000000
  frame_id: lf
angle_min: -0.15000000596
angle_max: 0.15000000596
angle_increment: -0.300000011921
time_increment: 0.0
scan_time: 0.0
range_min: 0.00999999977648
range_max: 0.600000023842
ranges: [0.6000000238418579]
intensities: [0.0]
---
header: 
  seq: 45
  stamp: 
    secs: 2
    nsecs: 302000000
  frame_id: lf
angle_min: -0.15000000596
angle_max: 0.15000000596
angle_increment: -0.300000011921
time_increment: 0.0
scan_time: 0.0
range_min: 0.00999999977648
range_max: 0.600000023842
ranges: [0.6000000238418579]
intensities: [0.0]

motor_power_status == "1"のときにdiff_drive_controllerを直接操作できないことを明記する

motor_power_status == "1" のときに controller_vel_publisher.py が使えない

if motor_power_status == "1":
with open(lfile, "r") as lf, \
open(rfile, "r") as rf:
lhz_str = lf.readline().rstrip()
rhz_str = rf.readline().rstrip()
if len(lhz_str) == 0:
lhz = 0
else:
try:
lhz = int(lhz_str)
except:
lhz = 0
if len(rhz_str) == 0:
rhz = 0
else:
try:
rhz = int(rhz_str)
except:
rhz = 0
vel.linear.x = (lhz + rhz) * 9 * math.pi / 160000.0
vel.angular.z = (rhz - lhz) * math.pi / 800.0
print(vel)
pub.publish(vel)

warning : deprecated syntax

  • ENV
    • Ubuntu 16.04
    • ROS Kinetic
    • kinetic-devel
[ WARN] [1528119763.853185696, 0.360000000]: Deprecated syntax, please prepend 'hardware_interface/' to 'VelocityJointInterface' within the <hardwareInterface> tag in joint 'right_wheel_joint'.
[ WARN] [1528119763.854255049, 0.360000000]: Deprecated syntax, please prepend 'hardware_interface/' to 'VelocityJointInterface' within the <hardwareInterface> tag in joint 'left_wheel_joint'.

with the device files

To actualize the perfect compatibility, the simulated robot should send and receive its data. But it will be constructed as another simulator.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.