-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ros2' into caguero/diff_drive_demo_v2
- Loading branch information
Showing
3 changed files
with
31 additions
and
24 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Battery configuration. | ||
- topic_name: "/model/vehicle_blue/cmd_vel" | ||
ros_type_name: "geometry_msgs/msg/Twist" | ||
gz_type_name: "gz.msgs.Twist" | ||
lazy: true | ||
direction: ROS_TO_GZ | ||
|
||
- topic_name: "/model/vehicle_blue/battery/linear_battery/state" | ||
ros_type_name: "sensor_msgs/msg/BatteryState" | ||
gz_type_name: "gz.msgs.BatteryState" | ||
lazy: true | ||
direction: GZ_TO_ROS |
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 |
---|---|---|
|
@@ -15,20 +15,20 @@ | |
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 IncludeLaunchDescription | ||
from launch.conditions import IfCondition | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from launch.substitutions import LaunchConfiguration | ||
|
||
from launch_ros.actions import Node | ||
from ros_gz_bridge.actions import RosGzBridge | ||
|
||
|
||
def generate_launch_description(): | ||
|
||
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim') | ||
pkg_ros_gz_sim_demos = get_package_share_directory('ros_gz_sim_demos') | ||
|
||
# RQt | ||
rqt = Node( | ||
|
@@ -40,6 +40,7 @@ def generate_launch_description(): | |
condition=IfCondition(LaunchConfiguration('rqt')) | ||
) | ||
|
||
# Gazebo | ||
gz_sim = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource( | ||
os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')), | ||
|
@@ -49,21 +50,15 @@ def generate_launch_description(): | |
) | ||
|
||
# Bridge | ||
bridge = Node( | ||
package='ros_gz_bridge', | ||
executable='parameter_bridge', | ||
arguments=[ | ||
'/model/vehicle_blue/cmd_vel@geometry_msgs/msg/[email protected]', | ||
'/model/vehicle_blue/battery/linear_battery/state@sensor_msgs/msg/BatteryState@' | ||
'gz.msgs.BatteryState' | ||
], | ||
output='screen' | ||
ros_gz_bridge = RosGzBridge( | ||
bridge_name='ros_gz_bridge', | ||
config_file=os.path.join(pkg_ros_gz_sim_demos, 'config', 'battery.yaml'), | ||
) | ||
|
||
return LaunchDescription([ | ||
gz_sim, | ||
DeclareLaunchArgument('rqt', default_value='true', | ||
description='Open RQt.'), | ||
bridge, | ||
ros_gz_bridge, | ||
rqt | ||
]) |