-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* parser compatible model and launch framework Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * added ground plane, common gz plugins, demo commands and cleaned install paths Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * unique collision names and cleared flake Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * updating model config Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * building parser from source Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * fix flake and update deb dependency for garden Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * Move packages and files to gz Signed-off-by: methylDragon <methylDragon@gmail.com> * feedback and ign->gz Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * Support ros_ign migration Clean up shared libraries, and tick-tock RosGzPointCloud Tick-tock launch args Hard-tock ign_ in sources Migrate ign, ign_, IGN_ for sources, launch, and test files Migrate IGN_XXX_VER, IGN_T, header guards Migrate launchfile, launchfile args, and test source references Migrate ros_ign_XXX and gz_gazebo -> gz_sim Migrate ros_ign_XXX project names Migrate Ign, ign-, IGN_DEPS, ign-gazebo Migrate ignitionrobotics, ignitionrobotics/ros_ign, osrf/ros_ign Migrate ignition-version, IGNITION_VERSION, Ignition <LIB>, ros_ign_ci Signed-off-by: methylDragon <methylDragon@gmail.com> * renaming and flake Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * added ros commands Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * gz-version Signed-off-by: Louise Poubel <louise@openrobotics.org> * feedback and ci trial Signed-off-by: Dharini Dutia <dharini@openrobotics.org> * removing garden condition Signed-off-by: Dharini Dutia <dharini@openrobotics.org> Signed-off-by: Dharini Dutia <dharini@openrobotics.org> Signed-off-by: Michael Carroll <michael@openrobotics.org> Signed-off-by: methylDragon <methylDragon@gmail.com> Signed-off-by: Louise Poubel <louise@openrobotics.org> Co-authored-by: Michael Carroll <michael@openrobotics.org> Co-authored-by: methylDragon <methylDragon@gmail.com> Co-authored-by: Louise Poubel <louise@openrobotics.org>
- Loading branch information
1 parent
d8d0441
commit 6b05462
Showing
10 changed files
with
570 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;@CMAKE_INSTALL_PREFIX@/share |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Copyright 2022 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 os | ||
|
||
from ament_index_python.packages import get_package_share_directory | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription | ||
from launch.conditions import IfCondition | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution | ||
from launch_ros.actions import Node | ||
|
||
|
||
def generate_launch_description(): | ||
|
||
pkg_ros_gz_sim_demos = get_package_share_directory('ros_gz_sim_demos') | ||
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim') | ||
|
||
sdf_file = os.path.join(pkg_ros_gz_sim_demos, 'models', 'vehicle', 'model.sdf') | ||
|
||
with open(sdf_file, 'r') as infp: | ||
robot_desc = infp.read() | ||
|
||
rviz_launch_arg = DeclareLaunchArgument( | ||
'rviz', default_value='true', | ||
description='Open RViz.' | ||
) | ||
|
||
gazebo = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource( | ||
os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py'), | ||
), | ||
launch_arguments={'gz_args': PathJoinSubstitution([ | ||
pkg_ros_gz_sim_demos, | ||
'worlds', | ||
'vehicle.sdf' | ||
])}.items(), | ||
) | ||
|
||
# Bridge to forward tf and joint states to ros2 | ||
gz_topic = '/model/vehicle' | ||
joint_state_gz_topic = '/world/demo' + gz_topic + '/joint_state' | ||
link_pose_gz_topic = gz_topic + '/pose' | ||
bridge = Node( | ||
package='ros_gz_bridge', | ||
executable='parameter_bridge', | ||
arguments=[ | ||
# Clock (Gazebo -> ROS2) | ||
'/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock', | ||
# Joint states (Gazebo -> ROS2) | ||
joint_state_gz_topic + '@sensor_msgs/msg/JointState[ignition.msgs.Model', | ||
# Link poses (Gazebo -> ROS2) | ||
link_pose_gz_topic + '@tf2_msgs/msg/TFMessage[ignition.msgs.Pose_V', | ||
link_pose_gz_topic + '_static@tf2_msgs/msg/TFMessage[ignition.msgs.Pose_V', | ||
# Velocity and odometry (Gazebo -> ROS2) | ||
gz_topic + '/cmd_vel@geometry_msgs/msg/Twist@ignition.msgs.Twist', | ||
gz_topic + '/odometry@nav_msgs/msg/Odometry@ignition.msgs.Odometry', | ||
], | ||
remappings=[ | ||
(joint_state_gz_topic, 'joint_states'), | ||
(link_pose_gz_topic, '/tf'), | ||
(link_pose_gz_topic + '_static', '/tf_static'), | ||
], | ||
parameters=[{'qos_overrides./tf_static.publisher.durability': 'transient_local'}], | ||
output='screen' | ||
) | ||
|
||
# Get the parser plugin convert sdf to urdf using robot_description topic | ||
robot_state_publisher = Node( | ||
package='robot_state_publisher', | ||
executable='robot_state_publisher', | ||
name='robot_state_publisher', | ||
output='both', | ||
parameters=[ | ||
{'use_sim_time': True}, | ||
{'robot_description': robot_desc}, | ||
] | ||
) | ||
|
||
# Launch rviz | ||
rviz = Node( | ||
package='rviz2', | ||
executable='rviz2', | ||
arguments=['-d', os.path.join(pkg_ros_gz_sim_demos, 'rviz', 'vehicle.rviz')], | ||
condition=IfCondition(LaunchConfiguration('rviz')), | ||
parameters=[ | ||
{'use_sim_time': True}, | ||
] | ||
) | ||
|
||
return LaunchDescription([ | ||
rviz_launch_arg, | ||
gazebo, | ||
bridge, | ||
robot_state_publisher, | ||
rviz | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<model> | ||
<name>vehicle</name> | ||
<version>1.0</version> | ||
<sdf version="1.8">model.sdf</sdf> | ||
|
||
<author> | ||
<name>Dharini Dutia</name> | ||
<email>dharini@openrobotics.org</email> | ||
</author> | ||
|
||
<description> | ||
Parser plugin `sdformat_urdf` compatible differential drive vehicle model. Used to read | ||
models described in SDFormat and outputs URDF C++ DOM structures. | ||
</description> | ||
</model> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
<?xml version="1.0" ?> | ||
<sdf version="1.8"> | ||
<model name='vehicle'> | ||
<link name='chassis'> | ||
<pose>-0.151427 -0 0.175 0 -0 0</pose> | ||
<inertial> | ||
<mass>1.14395</mass> | ||
<inertia> | ||
<ixx>0.126164</ixx> | ||
<ixy>0</ixy> | ||
<ixz>0</ixz> | ||
<iyy>0.416519</iyy> | ||
<iyz>0</iyz> | ||
<izz>0.481014</izz> | ||
</inertia> | ||
</inertial> | ||
<visual name='visual_chassis'> | ||
<geometry> | ||
<box> | ||
<size>2.01142 1 0.568726</size> | ||
</box> | ||
</geometry> | ||
<material> | ||
<ambient>0.5 0.5 1.0 1</ambient> | ||
<diffuse>0.5 0.5 1.0 1</diffuse> | ||
<specular>0.0 0.0 1.0 1</specular> | ||
</material> | ||
</visual> | ||
<collision name='collision_chassis'> | ||
<geometry> | ||
<box> | ||
<size>2.01142 1 0.568726</size> | ||
</box> | ||
</geometry> | ||
</collision> | ||
</link> | ||
|
||
<link name='left_wheel'> | ||
<pose>0.554283 0.625029 -0.025 -1.5707 0 0</pose> | ||
<inertial> | ||
<mass>2</mass> | ||
<inertia> | ||
<ixx>0.145833</ixx> | ||
<ixy>0</ixy> | ||
<ixz>0</ixz> | ||
<iyy>0.145833</iyy> | ||
<iyz>0</iyz> | ||
<izz>0.125</izz> | ||
</inertia> | ||
</inertial> | ||
<visual name='visual_left_wheel'> | ||
<geometry> | ||
<sphere> | ||
<radius>0.3</radius> | ||
</sphere> | ||
</geometry> | ||
<material> | ||
<ambient>0.2 0.2 0.2 1</ambient> | ||
<diffuse>0.2 0.2 0.2 1</diffuse> | ||
<specular>0.2 0.2 0.2 1</specular> | ||
</material> | ||
</visual> | ||
<collision name='collision_left_wheel'> | ||
<geometry> | ||
<sphere> | ||
<radius>0.3</radius> | ||
</sphere> | ||
</geometry> | ||
</collision> | ||
</link> | ||
|
||
<link name='right_wheel'> | ||
<pose>0.554282 -0.625029 -0.025 -1.5707 0 0</pose> | ||
<inertial> | ||
<mass>2</mass> | ||
<inertia> | ||
<ixx>0.145833</ixx> | ||
<ixy>0</ixy> | ||
<ixz>0</ixz> | ||
<iyy>0.145833</iyy> | ||
<iyz>0</iyz> | ||
<izz>0.125</izz> | ||
</inertia> | ||
</inertial> | ||
<visual name='visual_right_wheel'> | ||
<geometry> | ||
<sphere> | ||
<radius>0.3</radius> | ||
</sphere> | ||
</geometry> | ||
<material> | ||
<ambient>0.2 0.2 0.2 1</ambient> | ||
<diffuse>0.2 0.2 0.2 1</diffuse> | ||
<specular>0.2 0.2 0.2 1</specular> | ||
</material> | ||
</visual> | ||
<collision name='collision_right_wheel'> | ||
<geometry> | ||
<sphere> | ||
<radius>0.3</radius> | ||
</sphere> | ||
</geometry> | ||
</collision> | ||
</link> | ||
|
||
<link name='caster'> | ||
<pose>-0.957138 -0 -0.125 0 -0 0</pose> | ||
<inertial> | ||
<mass>1</mass> | ||
<inertia> | ||
<ixx>0.1</ixx> | ||
<ixy>0</ixy> | ||
<ixz>0</ixz> | ||
<iyy>0.1</iyy> | ||
<iyz>0</iyz> | ||
<izz>0.1</izz> | ||
</inertia> | ||
</inertial> | ||
<visual name='visual_caster'> | ||
<geometry> | ||
<sphere> | ||
<radius>0.2</radius> | ||
</sphere> | ||
</geometry> | ||
<material> | ||
<ambient>0.2 0.2 0.2 1</ambient> | ||
<diffuse>0.2 0.2 0.2 1</diffuse> | ||
<specular>0.2 0.2 0.2 1</specular> | ||
</material> | ||
</visual> | ||
<collision name='collision_caster'> | ||
<geometry> | ||
<sphere> | ||
<radius>0.2</radius> | ||
</sphere> | ||
</geometry> | ||
</collision> | ||
</link> | ||
|
||
<joint name='left_wheel_joint' type='revolute'> | ||
<parent>chassis</parent> | ||
<child>left_wheel</child> | ||
<axis> | ||
<xyz>0 0 1</xyz> | ||
<limit> | ||
<lower>-1.79769e+308</lower> | ||
<upper>1.79769e+308</upper> | ||
</limit> | ||
</axis> | ||
</joint> | ||
|
||
<joint name='right_wheel_joint' type='revolute'> | ||
<parent>chassis</parent> | ||
<child>right_wheel</child> | ||
<axis> | ||
<xyz>0 0 1</xyz> | ||
<limit> | ||
<lower>-1.79769e+308</lower> | ||
<upper>1.79769e+308</upper> | ||
</limit> | ||
</axis> | ||
</joint> | ||
|
||
<joint name='caster_wheel' type='ball'> | ||
<parent>chassis</parent> | ||
<child>caster</child> | ||
</joint> | ||
|
||
<plugin | ||
filename="ignition-gazebo-diff-drive-system" | ||
name="ignition::gazebo::systems::DiffDrive"> | ||
<left_joint>left_wheel_joint</left_joint> | ||
<right_joint>right_wheel_joint</right_joint> | ||
<wheel_separation>1.25</wheel_separation> | ||
<wheel_radius>0.3</wheel_radius> | ||
<odom_publish_frequency>1</odom_publish_frequency> | ||
<max_linear_acceleration>1</max_linear_acceleration> | ||
<min_linear_acceleration>-1</min_linear_acceleration> | ||
<max_angular_acceleration>2</max_angular_acceleration> | ||
<min_angular_acceleration>-2</min_angular_acceleration> | ||
<max_linear_velocity>0.5</max_linear_velocity> | ||
<min_linear_velocity>-0.5</min_linear_velocity> | ||
<max_angular_velocity>1</max_angular_velocity> | ||
<min_angular_velocity>-1</min_angular_velocity> | ||
</plugin> | ||
|
||
</model> | ||
</sdf> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.