Skip to content

Commit

Permalink
ライントレース用のコースを作成 (#74)
Browse files Browse the repository at this point in the history
* ライントレース用のコースを作成

* コースを地面より0.01浮かせる

* 動作周期を修正

Co-authored-by: Shota Aoki <[email protected]>

* ラズパイマウスの初期位置を指定する引数を追加

* ラズパイマウスの初期位置をlaunchファイルから指定できるように変更

* モデル作成者の名前を変更

* blenderのモデルの作成者を変更

* コースモデルの大きさを修正

* コースモデルのスケールを修正

* コースモデルの作成者名を変更

* パネルの寸法が分かる名称に変更

* ワールド名を柔軟なものに変更

* 線の幅を4cmに変更

* READMEにモデル一覧を追加

---------

Co-authored-by: Shota Aoki <[email protected]>
  • Loading branch information
YusukeKato and Shota Aoki authored Nov 17, 2023
1 parent 1c9901b commit 78b5a51
Show file tree
Hide file tree
Showing 13 changed files with 523 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,29 @@ ros2 launch raspimouse_ros2_examples object_tracking.launch.py mouse:=false use_

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_object_tracking.gif)

## Model data list

### course_curve_50x50cm
Curve course panel for line following.
Panel size is 50 cm x 50 cm and line width is 4 cm.

![](./raspimouse_gazebo/models/course_curve_50x50cm/meshes/course_curve.jpg)

### course_straight_50x50cm
Straight course panel for line following.
Panel size is 50 cm x 50 cm and line width is 4 cm.

![](./raspimouse_gazebo/models/course_straight_50x50cm/meshes/course_straight.jpg)

### cube_*cm_color-name
Each cube is 5 cm, 7.5 cm, 10 cm, and 15 cm on a side.
The cube colors are red, yellow, blue, and green.

![](https://rt-net.github.io/images/raspberry-pi-mouse/color_objects.png)

### daeファイルについて
The dae file is edited in Blender 4.0.

## License

This repository is licensed under the MIT license, see [LICENSE]( ./LICENSE ).
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,31 @@ ros2 launch raspimouse_ros2_examples object_tracking.launch.py mouse:=false use_

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_object_tracking.gif)

## モデルデータ一覧

### course_curve_50x50cm

ライントレース用の曲線コースパネルです。
パネルサイズは50cm x 50cm、線の幅は4cmです。

![](./raspimouse_gazebo/models/course_curve_50x50cm/meshes/course_curve.jpg)

### course_straight_50x50cm

ライントレース用の直線コースパネルです。
パネルサイズは50cm x 50cm、線の幅は4cmです。

![](./raspimouse_gazebo/models/course_straight_50x50cm/meshes/course_straight.jpg)

### cube_*cm_color-name
それぞれ一辺5cm、7.5cm、10cm、15cmの立方体です。
色は赤、黄、青、緑です。

![](https://rt-net.github.io/images/raspberry-pi-mouse/color_objects.png)

### daeファイルについて
daeファイルはBlender 4.0で編集しています。

## ライセンス

このリポジトリはMITライセンスに基づいて公開されています。
Expand Down
18 changes: 18 additions & 0 deletions raspimouse_gazebo/launch/raspimouse_with_emptyworld.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ def generate_launch_description():
'world_name',
default_value=get_package_share_directory('raspimouse_gazebo')+'/worlds/empty_world.sdf',
description='Set world name.')
declare_arg_spawn_x = DeclareLaunchArgument(
'spawn_x',
default_value='0.0',
description='Set initial position x.')
declare_arg_spawn_y = DeclareLaunchArgument(
'spawn_y',
default_value='0.0',
description='Set initial position y.')
declare_arg_spawn_z = DeclareLaunchArgument(
'spawn_z',
default_value='0.02',
description='Set initial position z.')

env = {'IGN_GAZEBO_SYSTEM_PLUGIN_PATH': os.environ['LD_LIBRARY_PATH'],
'IGN_GAZEBO_RESOURCE_PATH': os.path.dirname(
Expand All @@ -71,6 +83,9 @@ def generate_launch_description():
output='screen',
arguments=['-topic', '/robot_description',
'-name', 'raspimouse',
'-x', LaunchConfiguration('spawn_x'),
'-y', LaunchConfiguration('spawn_y'),
'-z', LaunchConfiguration('spawn_z'),
'-allow_renaming', 'true'],
)

Expand Down Expand Up @@ -140,6 +155,9 @@ def generate_launch_description():
declare_arg_lidar_frame,
declare_arg_use_rgb_camera,
declare_arg_world_name,
declare_arg_spawn_x,
declare_arg_spawn_y,
declare_arg_spawn_z,
ign_gazebo,
ignition_spawn_entity,
robot_state_publisher,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# The MIT License (MIT)
#
# Copyright 2023 RT Corporation <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch_ros.actions import SetParameter
from launch.launch_description_sources import PythonLaunchDescriptionSource


def generate_launch_description():
world_file = os.path.join(
get_package_share_directory('raspimouse_gazebo'),
'worlds',
'line_follower_field1.sdf')
world_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([
get_package_share_directory('raspimouse_gazebo'),
'/launch/raspimouse_with_emptyworld.launch.py']),
launch_arguments={
'world_name': world_file,
'spawn_x': '0.0',
'spawn_y': '0.0',
'spawn_z': '0.02'
}.items()
)

return LaunchDescription([
SetParameter(name='use_sim_time', value=True),
world_launch
])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<asset>
<contributor>
<author>YusukeKato</author>
<authoring_tool>Blender 4.0.0 commit date:2023-11-13, commit time:17:26, hash:878f71061b8e</authoring_tool>
</contributor>
<created>2023-11-16T14:58:23</created>
<modified>2023-11-16T14:58:23</modified>
<unit name="meter" meter="1"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_effects>
<effect id="Material_001-effect">
<profile_COMMON>
<newparam sid="course_curve_jpg-surface">
<surface type="2D">
<init_from>course_curve_jpg</init_from>
</surface>
</newparam>
<newparam sid="course_curve_jpg-sampler">
<sampler2D>
<source>course_curve_jpg-surface</source>
</sampler2D>
</newparam>
<technique sid="common">
<lambert>
<emission>
<color sid="emission">0 0 0 1</color>
</emission>
<diffuse>
<texture texture="course_curve_jpg-sampler" texcoord="Plane-mesh-map-0"/>
</diffuse>
<index_of_refraction>
<float sid="ior">1.45</float>
</index_of_refraction>
</lambert>
</technique>
</profile_COMMON>
</effect>
</library_effects>
<library_images>
<image id="course_curve_jpg" name="course_curve_jpg">
<init_from>course_curve.jpg</init_from>
</image>
</library_images>
<library_materials>
<material id="Material_001-material" name="Material.001">
<instance_effect url="#Material_001-effect"/>
</material>
</library_materials>
<library_geometries>
<geometry id="Plane-mesh" name="Plane">
<mesh>
<source id="Plane-mesh-positions">
<float_array id="Plane-mesh-positions-array" count="12">-0.5 -0.5 0 0.5 -0.5 0 -0.5 0.5 0 0.5 0.5 0</float_array>
<technique_common>
<accessor source="#Plane-mesh-positions-array" count="4" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="Plane-mesh-normals">
<float_array id="Plane-mesh-normals-array" count="3">0 0 1</float_array>
<technique_common>
<accessor source="#Plane-mesh-normals-array" count="1" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="Plane-mesh-map-0">
<float_array id="Plane-mesh-map-0-array" count="12">1.00069e-4 0.9999001 0.9998998 9.998e-5 0.9998999 0.9998998 1.00069e-4 0.9999001 9.998e-5 1.00131e-4 0.9998998 9.998e-5</float_array>
<technique_common>
<accessor source="#Plane-mesh-map-0-array" count="6" stride="2">
<param name="S" type="float"/>
<param name="T" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Plane-mesh-vertices">
<input semantic="POSITION" source="#Plane-mesh-positions"/>
</vertices>
<triangles material="Material_001-material" count="2">
<input semantic="VERTEX" source="#Plane-mesh-vertices" offset="0"/>
<input semantic="NORMAL" source="#Plane-mesh-normals" offset="1"/>
<input semantic="TEXCOORD" source="#Plane-mesh-map-0" offset="2" set="0"/>
<p>1 0 0 2 0 1 0 0 2 1 0 3 3 0 4 2 0 5</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Plane" name="Plane" type="NODE">
<matrix sid="transform">0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 1</matrix>
<instance_geometry url="#Plane-mesh" name="Plane">
<bind_material>
<technique_common>
<instance_material symbol="Material_001-material" target="#Material_001-material">
<bind_vertex_input semantic="Plane-mesh-map-0" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
</instance_geometry>
</node>
</visual_scene>
</library_visual_scenes>
<scene>
<instance_visual_scene url="#Scene"/>
</scene>
</COLLADA>
16 changes: 16 additions & 0 deletions raspimouse_gazebo/models/course_curve_50x50cm/model.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>

<model>
<name>course_curve_50x50cm</name>
<version>1.0</version>
<sdf version="1.5">model.sdf</sdf>

<author>
<name>YusukeKato</name>
<email>[email protected]</email>
</author>

<description>
line follower course
</description>
</model>
34 changes: 34 additions & 0 deletions raspimouse_gazebo/models/course_curve_50x50cm/model.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" ?>
<sdf version="1.5">
<model name="course_curve_50x50cm">
<static>true</static>
<link name="link">
<collision name="collision">
<pose>0 0 0 0 0 0</pose>
<geometry>
<mesh>
<uri>model://course_curve_50x50cm/meshes/course_curve_50x50cm.dae</uri>
<scale>1 1 1</scale>
</mesh>
</geometry>
<surface>
<friction>
<ode>
<mu>0.9</mu>
<mu2>0.9</mu2>
</ode>
</friction>
</surface>
</collision>
<visual name="visual">
<pose>0 0 0 0 0 0</pose>
<geometry>
<mesh>
<uri>model://course_curve_50x50cm/meshes/course_curve_50x50cm.dae</uri>
<scale>1 1 1</scale>
</mesh>
</geometry>
</visual>
</link>
</model>
</sdf>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 78b5a51

Please sign in to comment.