diff --git a/additional_repos.repos b/additional_repos.repos
index 56f46b6..2657f93 100644
--- a/additional_repos.repos
+++ b/additional_repos.repos
@@ -1 +1,13 @@
repositories:
+ gazebo_ros_pkgs:
+ type: git
+ url: https://github.com/ros-simulation/gazebo_ros_pkgs.git
+ version: ros2
+ image_common:
+ type: git
+ url: https://github.com/ros-perception/image_common.git
+ version: ros2
+ vision_opencv:
+ type: git
+ url: https://github.com/ros-perception/vision_opencv.git
+ version: ros2
diff --git a/confbot_bringup/launch/confbot_state_publisher.launch.py b/confbot_bringup/launch/confbot_state_publisher.launch.py
new file mode 100644
index 0000000..1069ba6
--- /dev/null
+++ b/confbot_bringup/launch/confbot_state_publisher.launch.py
@@ -0,0 +1,43 @@
+# Copyright 2019 ROBOTIS CO., LTD.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# /* Author: Darby Lim */
+
+import os
+
+from ament_index_python.packages import get_package_share_directory
+from launch import LaunchDescription
+from launch.actions import DeclareLaunchArgument
+from launch.substitutions import LaunchConfiguration
+from launch_ros.actions import Node
+
+
+def generate_launch_description():
+ urdf_file_name = 'confbot.urdf'
+ urdf = os.path.join(get_package_share_directory('confbot_description'), 'urdf', urdf_file_name)
+
+ return LaunchDescription([
+ DeclareLaunchArgument(
+ 'use_sim_time',
+ default_value='True',
+ description='Use simulation (Gazebo) clock if true'),
+
+ Node(
+ package='robot_state_publisher',
+ node_executable='robot_state_publisher',
+ node_name='robot_state_publisher',
+ output='screen',
+ parameters=[{'use_sim_time': LaunchConfiguration('use_sim_time')}],
+ arguments=[urdf])
+ ])
diff --git a/confbot_description/urdf/confbot.urdf b/confbot_description/urdf/confbot.urdf
index 6382c82..7359232 100644
--- a/confbot_description/urdf/confbot.urdf
+++ b/confbot_description/urdf/confbot.urdf
@@ -11,6 +11,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -19,11 +32,23 @@
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -32,33 +57,242 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /
+ cmd_vel:=cmd_vel
+ odom:=odom
+
+
+
+ wheel_l_joint
+ wheel_r_joint
+
+
+ 1.2
+ 0.6
+
+ 20
+ 1.0
+
+
+ true
+ true
+ true
+
+ odom
+ base_link
+
+
+
+
+
+
+
+ true
+ 3
+
+
+
+ 1875
+ 1
+ -2.0943951023931953
+ 2.0943951023931953
+
+
+
+ 0.1
+ 30.0
+ 0.001
+
+
+ gaussian
+ 0.0
+ 0.008
+
+
+
+
+ sensor_msgs/LaserScan
+
+
+ /
+ ~/out:=scan
+
+
+
+
+
+
+
+ 30
+ true
+
+ 1.3962634
+
+ 640
+ 480
+ R8G8B8
+
+
+ 0.02
+ 300
+
+
+ gaussian
+
+ 0.0
+ 0.007
+
+
+
+ camera_optical_frame
+
+
+
+
+
+
+
+
diff --git a/confbot_simulation/CMakeLists.txt b/confbot_simulation/CMakeLists.txt
new file mode 100644
index 0000000..107dad3
--- /dev/null
+++ b/confbot_simulation/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.5)
+project(confbot_simulation)
+
+# find dependencies
+find_package(ament_cmake REQUIRED)
+
+install(DIRECTORY config launch world
+ DESTINATION share/${PROJECT_NAME})
+install(PROGRAMS ${PROJECT_NAME}/urdf_spawner.py
+ DESTINATION lib/${PROJECT_NAME})
+
+if(BUILD_TESTING)
+ find_package(ament_lint_auto REQUIRED)
+ ament_lint_auto_find_test_dependencies()
+endif()
+
+ament_package()
diff --git a/confbot_simulation/confbot_simulation/urdf_spawner.py b/confbot_simulation/confbot_simulation/urdf_spawner.py
new file mode 100755
index 0000000..16be221
--- /dev/null
+++ b/confbot_simulation/confbot_simulation/urdf_spawner.py
@@ -0,0 +1,48 @@
+#! /usr/bin/env python3
+
+# Copyright 2019 Open Source Robotics Foundation, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+
+from gazebo_msgs.srv import SpawnEntity
+import rclpy
+
+
+def request_spawn(xml: str):
+ rclpy.init()
+ node = rclpy.create_node('spawn_entity')
+ client = node.create_client(SpawnEntity, 'spawn_entity')
+ if not client.service_is_ready():
+ print('waiting for service')
+ client.wait_for_service()
+ print('service ready, making request')
+ request = SpawnEntity.Request()
+ request.xml = xml
+ future = client.call_async(request)
+ rclpy.spin_until_future_complete(node, future)
+ if future.result() is not None:
+ print('response: %r' % future.result())
+ else:
+ raise RuntimeError('exception while calling service: %r' % future.exception())
+ node.destroy_node()
+ rclpy.shutdown()
+
+
+if len(sys.argv) < 2:
+ print('usage: ros2 run my_package my_node.py -- example.urdf')
+ sys.exit(1)
+
+f = open(sys.argv[1], 'r')
+request_spawn(f.read())
diff --git a/confbot_simulation/config/config_gazebo.rviz b/confbot_simulation/config/config_gazebo.rviz
new file mode 100644
index 0000000..d6f97e4
--- /dev/null
+++ b/confbot_simulation/config/config_gazebo.rviz
@@ -0,0 +1,204 @@
+Panels:
+ - Class: rviz_common/Displays
+ Help Height: 78
+ Name: Displays
+ Property Tree Widget:
+ Expanded:
+ - /Global Options1
+ - /Status1
+ - /TF1
+ - /LaserScan1
+ - /Image1
+ Splitter Ratio: 0.38277512788772583
+ Tree Height: 587
+ - Class: rviz_common/Views
+ Expanded:
+ - /Current View1
+ Name: Views
+ Splitter Ratio: 0.5
+Visualization Manager:
+ Class: ""
+ Displays:
+ - Alpha: 0.5
+ Cell Size: 1
+ Class: rviz_default_plugins/Grid
+ Color: 160; 160; 164
+ Enabled: true
+ Line Style:
+ Line Width: 0.029999999329447746
+ Value: Lines
+ Name: Grid
+ Normal Cell Count: 0
+ Offset:
+ X: 0
+ Y: 0
+ Z: 0
+ Plane: XY
+ Plane Cell Count: 10
+ Reference Frame:
+ Value: true
+ - Class: rviz_default_plugins/TF
+ Enabled: true
+ Frame Timeout: 15
+ Frames:
+ All Enabled: true
+ base_link:
+ Value: true
+ camera_frame:
+ Value: true
+ camera_optical_frame:
+ Value: true
+ laser_frame:
+ Value: true
+ odom:
+ Value: true
+ wheel_l_link:
+ Value: true
+ wheel_r_link:
+ Value: true
+ Marker Scale: 0.5
+ Name: TF
+ Show Arrows: true
+ Show Axes: true
+ Show Names: true
+ Tree:
+ odom:
+ base_link:
+ camera_frame:
+ camera_optical_frame:
+ {}
+ laser_frame:
+ {}
+ wheel_l_link:
+ {}
+ wheel_r_link:
+ {}
+ Update Interval: 0
+ Value: true
+ - Alpha: 1
+ Class: rviz_default_plugins/RobotModel
+ Collision Enabled: false
+ Description File: /Users/karsten/workspace/osrf/roscon2018_ws/src/roscon2018/confbot_description/urdf/confbot.urdf
+ Description Source: File
+ Description Topic: /robot_description
+ Enabled: true
+ Links:
+ All Links Enabled: true
+ Expand Joint Details: false
+ Expand Link Details: false
+ Expand Tree: false
+ Link Tree Style: Links in Alphabetic Order
+ Name: RobotModel
+ TF Prefix: ""
+ Unreliable: false
+ Update Interval: 0
+ Value: true
+ Visual Enabled: true
+ - Alpha: 1
+ Autocompute Intensity Bounds: true
+ Autocompute Value Bounds:
+ Max Value: 10
+ Min Value: -10
+ Value: true
+ Axis: Z
+ Channel Name: intensity
+ Class: rviz_default_plugins/LaserScan
+ Color: 255; 255; 255
+ Color Transformer: Intensity
+ Decay Time: 0
+ Enabled: true
+ Invert Rainbow: false
+ Max Color: 255; 255; 255
+ Max Intensity: 0
+ Min Color: 0; 0; 0
+ Min Intensity: 0
+ Name: LaserScan
+ Position Transformer: XYZ
+ Queue Size: 10
+ Selectable: true
+ Size (Pixels): 3
+ Size (m): 0.05000000074505806
+ Style: Flat Squares
+ Topic: /scan
+ Unreliable: true
+ Use Fixed Frame: true
+ Use rainbow: true
+ Value: true
+ - Class: rviz_default_plugins/Marker
+ Enabled: true
+ Name: Marker
+ Namespaces:
+ {}
+ Queue Size: 10
+ Topic: /danger_zone
+ Unreliable: false
+ Value: true
+ - Class: rviz_default_plugins/Marker
+ Enabled: true
+ Name: Marker
+ Namespaces:
+ {}
+ Queue Size: 10
+ Topic: /safe_zone
+ Unreliable: false
+ Value: true
+ - Class: rviz_default_plugins/Image
+ Enabled: true
+ Max Value: 1
+ Median window: 5
+ Min Value: 0
+ Name: Image
+ Normalize Range: true
+ Queue Size: 10
+ Topic: /confbot_camera/image_raw
+ Unreliable: false
+ Value: true
+ Enabled: true
+ Global Options:
+ Background Color: 48; 48; 48
+ Fixed Frame: laser_frame
+ Frame Rate: 30
+ Name: root
+ Tools:
+ - Class: rviz_default_plugins/MoveCamera
+ Transformation:
+ Current:
+ Class: rviz_default_plugins/TF
+ Value: true
+ Views:
+ Current:
+ Class: rviz_default_plugins/Orbit
+ Distance: 13.815640449523926
+ Enable Stereo Rendering:
+ Stereo Eye Separation: 0.05999999865889549
+ Stereo Focal Distance: 1
+ Swap Stereo Eyes: false
+ Value: false
+ Focal Point:
+ X: 2.1995294970601542e-18
+ Y: -1.4232764294392875e-39
+ Z: 2.2182833359079564e-18
+ Focal Shape Fixed Size: true
+ Focal Shape Size: 0.05000000074505806
+ Invert Z Axis: false
+ Name: Current View
+ Near Clip Distance: 0.009999999776482582
+ Pitch: 1.5297963619232178
+ Target Frame:
+ Value: Orbit (rviz)
+ Yaw: 3.1467127799987793
+ Saved: ~
+Window Geometry:
+ Displays:
+ collapsed: false
+ Height: 1025
+ Hide Left Dock: false
+ Hide Right Dock: true
+ Image:
+ collapsed: false
+ QMainWindow State: 000000ff00000000fd000000040000000000000275000003a7fc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000000000000000fb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000002d6000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d0061006700650000000304000000ce0000000000000000fb0000000a0049006d0061006700650100000319000000cb0000002800ffffff000000010000010f000003a6fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000002c000003a6000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000004c2000003a700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
+ Views:
+ collapsed: true
+ Width: 1853
+ X: 67
+ Y: 27
diff --git a/confbot_simulation/launch/empty_world.launch.py b/confbot_simulation/launch/empty_world.launch.py
new file mode 100644
index 0000000..825b8a8
--- /dev/null
+++ b/confbot_simulation/launch/empty_world.launch.py
@@ -0,0 +1,50 @@
+# Copyright 2019 ROBOTIS CO., LTD.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# /* Author: Darby Lim */
+
+import os
+
+from ament_index_python.packages import get_package_share_directory
+from launch import LaunchDescription
+from launch.actions import DeclareLaunchArgument
+from launch.actions import ExecuteProcess
+from launch.actions import IncludeLaunchDescription
+from launch.launch_description_sources import PythonLaunchDescriptionSource
+from launch.substitutions import LaunchConfiguration
+
+
+def generate_launch_description():
+ use_sim_time = True
+ world = os.path.join(
+ get_package_share_directory('confbot_simulation'), 'world', 'basic_world.world')
+ launch_file_dir = os.path.join(get_package_share_directory('confbot_bringup'), 'launch')
+
+ return LaunchDescription([
+ DeclareLaunchArgument(
+ 'use_sim_time',
+ default_value=str(use_sim_time),
+ description='Use simulation (Gazebo) clock if true'),
+ ExecuteProcess(
+ cmd=[
+ 'gazebo', '--verbose', world,
+ '-s', 'libgazebo_ros_factory.so', '-s', 'libgazebo_ros_init.so'
+ ],
+ output='screen'),
+
+ IncludeLaunchDescription(
+ PythonLaunchDescriptionSource([launch_file_dir, '/confbot_state_publisher.launch.py']),
+ launch_arguments={'use_sim_time': LaunchConfiguration('use_sim_time')}.items(),
+ ),
+ ])
diff --git a/confbot_simulation/package.xml b/confbot_simulation/package.xml
new file mode 100644
index 0000000..769cc3f
--- /dev/null
+++ b/confbot_simulation/package.xml
@@ -0,0 +1,21 @@
+
+
+
+ confbot_simulation
+ 0.0.0
+ resources for simulating confbot
+ Mikael Arguedas
+ Apache 2.0
+
+ ament_cmake
+
+ gazebo_plugins
+ gazebo_ros
+
+ ament_lint_auto
+ ament_lint_common
+
+
+ ament_cmake
+
+
diff --git a/confbot_simulation/world/basic_world.world b/confbot_simulation/world/basic_world.world
new file mode 100644
index 0000000..d1e0b6e
--- /dev/null
+++ b/confbot_simulation/world/basic_world.world
@@ -0,0 +1,302 @@
+
+
+
+ 1
+ 0 0 10 0 -0 0
+ 0.8 0.8 0.8 1
+ 0.2 0.2 0.2 1
+
+ 1000
+ 0.9
+ 0.01
+ 0.001
+
+ -0.5 0.1 -0.9
+
+
+ 1
+
+
+
+
+ 0 0 1
+ 100 100
+
+
+
+
+
+ 100
+ 50
+
+
+
+
+
+
+
+
+
+
+ 10
+
+
+ 0
+
+
+ 0 0 1
+ 100 100
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+ 0 0 -9.8
+ 6e-06 2.3e-05 -4.2e-05
+
+
+ 0.001
+ 1
+ 1000
+
+
+ 0.4 0.4 0.4 1
+ 0.7 0.7 0.7 1
+ 1
+
+
+
+
+ EARTH_WGS84
+ 0
+ 0
+ 0
+ 0
+
+
+ -3.60012 0.192366 0.5 0 -0 0
+
+
+ 1
+
+ 0.166667
+ 0
+ 0
+ 0.166667
+ 0
+ 0.166667
+
+
+
+
+
+ 1 1 1
+
+
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1 1 1
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+ -0.041537 4.12064 0.5 0 -0 0
+
+
+ 1
+
+ 0.1
+ 0
+ 0
+ 0.1
+ 0
+ 0.1
+
+
+
+
+
+ 0.5
+
+
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+ -0.137958 -2.96108 0.5 0 -0 0
+
+
+ 1
+
+ 0.145833
+ 0
+ 0
+ 0.145833
+ 0
+ 0.125
+
+
+
+
+
+ 0.5
+ 1
+
+
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+ 1
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+ 61 6000000
+ 61 188312274
+ 1554235878 394463354
+ 61006
+
+ 0 0 0 0 -0 0
+ 1 1 1
+
+ 0 0 0 0 -0 0
+ 0 0 0 0 -0 0
+ 0 0 0 0 -0 0
+ 0 0 0 0 -0 0
+
+
+
+ -3.60012 0.192366 0.499995 0 1e-05 0
+ 1 1 1
+
+ -3.60012 0.192366 0.499995 0 1e-05 0
+ 0 0 0 0 -0 0
+ 0.010615 -0.006191 -9.78231 0.012424 0.021225 1.8e-05
+ 0.010615 -0.006191 -9.78231 0 -0 0
+
+
+
+ -0.137956 -2.96108 0.499997 3e-06 4e-06 -0
+ 1 1 1
+
+ -0.137956 -2.96108 0.499997 3e-06 4e-06 -0
+ 0 0 0 0 -0 0
+ 0 0 -9.8 0 -0 0
+ 0 0 -9.8 0 -0 0
+
+
+
+ -0.041537 4.12064 0.5 0 -0 0
+ 1 1 1
+
+ -0.041537 4.12064 0.5 0 -0 0
+ 0 0 0 0 -0 0
+ 0 0 0 0 -0 0
+ 0 0 0 0 -0 0
+
+
+
+ 0 0 10 0 -0 0
+
+
+
+
+ 5 -5 2 0 0.275643 2.35619
+ orbit
+ perspective
+
+
+
+
diff --git a/tutorial/Linux_Tutorial.md b/tutorial/Linux_Tutorial.md
index 7bba785..533250a 100644
--- a/tutorial/Linux_Tutorial.md
+++ b/tutorial/Linux_Tutorial.md
@@ -386,3 +386,34 @@ $ python3 safe_zone_publisher.py
```
Here it fails with `rt/cmd_vel topic not found in allow rule.` meaning that the not is not allowed to publish on the ROS topic `/cmd_vel`.
+
+
+##### Simulating the robot in Gazebo
+
+Make sure to kill all the running nodes.
+
+Shell 1: Set up Gazebo environment variables and launch the simulation
+```bash
+source /usr/share/gazebo/setup.sh
+export GAZEBO_MODEL_PATH=$CONFBOT_WS/install/share/:$GAZEBO_MODEL_PATH
+ros2 launch confbot_simulation empty_world.launch.py
+```
+
+Shell 2: Spawn our robot in Gazebo
+```bash
+ros2 run confbot_simulation urdf_spawner.py `ros2 pkg prefix confbot_description --share`/urdf/confbot.urdf
+```
+Then we give a velocity command to our robot
+```bash
+ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "{angular: {z: 1}}" -1
+```
+
+Shell 3: monitor our robot with RViz
+```bash
+ros2 run rviz2 rviz2 -d `ros2 pkg prefix confbot_simulation --share`/config/config_gazebo.rviz
+```
+
+TODO: remove following lines and place them in an RViz config file
+Toggle off and on the `Image` plugin
+
+We can see our robot using a differential drive controller, a simulated laser scanner and a simulated camera!