Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated launch file to use ros_ign_gazebo #82

Merged
merged 23 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ sudo: required

env:
matrix:
- DOCKER_IMAGE=ubuntu:18.04 IGN_COLLECTION="blueprint" ROS_DISTRO="dashing"
- DOCKER_IMAGE=ubuntu:18.04 IGN_COLLECTION="blueprint" ROS_DISTRO="eloquent"
- DOCKER_IMAGE=ubuntu:18.04 IGN_COLLECTION="citadel" ROS_DISTRO="dashing"
- DOCKER_IMAGE=ubuntu:18.04 IGN_COLLECTION="citadel" ROS_DISTRO="eloquent"
- DOCKER_IMAGE=ubuntu:20.04 IGN_COLLECTION="citadel" ROS_DISTRO="foxy"

services:
- docker
Expand Down
14 changes: 5 additions & 9 deletions .travis/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,23 @@ set -ev
export COLCON_WS=~/ws
export COLCON_WS_SRC=${COLCON_WS}/src
export DEBIAN_FRONTEND=noninteractive

if [ "$IGN_COLLECTION" == "blueprint" ]; then
IGN_DEPS="libignition-msgs4-dev libignition-transport7-dev libignition-gazebo2-dev"
elif [ "$IGN_COLLECTION" == "citadel" ]; then
export ROS_PYTHON_VERSION=3
if [ "$IGN_COLLECTION" == "citadel" ]; then
IGN_DEPS="libignition-msgs5-dev libignition-transport8-dev libignition-gazebo3-dev"
else
exit 1
fi

# Dependencies.
echo "deb [trusted=yes] http://packages.osrfoundation.org/gazebo/ubuntu-stable bionic main" > /etc/apt/sources.list.d/gazebo-stable.list
echo "deb [trusted=yes] http://packages.osrfoundation.org/gazebo/ubuntu-prerelease bionic main" > /etc/apt/sources.list.d/gazebo-prerelease.list
echo "deb [trusted=yes] http://packages.ros.org/ros2/ubuntu bionic main" > /etc/apt/sources.list.d/ros2-latest.list
echo "deb [trusted=yes] http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources.list.d/ros2-latest.list
apt-get update -qq
apt-get install -qq -y $IGN_DEPS \
python3-colcon-common-extensions \
python-rosdep
python3-rosdep

rosdep init
rosdep update
rosdep install --from-paths ./ -i -y \
rosdep install --from-paths ./ -i -y --rosdistro $ROS_DISTRO \
--skip-keys=ignition-gazebo2 \
--skip-keys=ignition-gazebo3 \
--skip-keys=ignition-math6 \
Expand Down
13 changes: 7 additions & 6 deletions ros_ign_bridge/include/ros_ign_bridge/factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ class Factory : public FactoryInterface
size_t queue_size,
ignition::transport::Node::Publisher & ign_pub)
{
std::function<void(std::shared_ptr<const ROS_T>)> fn = std::bind(&Factory<ROS_T,
IGN_T>::ros_callback,
std::placeholders::_1, ign_pub,
ros_type_name_, ign_type_name_,
ros_node);
std::function<void(std::shared_ptr<const ROS_T>)> fn = std::bind(
&Factory<ROS_T, IGN_T>::ros_callback,
std::placeholders::_1, ign_pub,
ros_type_name_, ign_type_name_,
ros_node);
std::shared_ptr<rclcpp::Subscription<ROS_T>> subscription =
ros_node->create_subscription<ROS_T>(
topic_name, rclcpp::QoS(rclcpp::KeepLast(queue_size)), fn);
Expand Down Expand Up @@ -110,7 +110,8 @@ class Factory : public FactoryInterface
IGN_T ign_msg;
convert_ros_to_ign(*ros_msg, ign_msg);
ign_pub.Publish(ign_msg);
RCLCPP_INFO_ONCE(ros_node->get_logger(),
RCLCPP_INFO_ONCE(
ros_node->get_logger(),
"Passing message from ROS %s to Ignition %s (showing msg only once per type",
ros_type_name.c_str(), ign_type_name.c_str());
}
Expand Down
3 changes: 2 additions & 1 deletion ros_ign_gazebo/src/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ int main(int _argc, char ** _argv)
}

if (!executed) {
RCLCPP_INFO(ros2_node->get_logger(),
RCLCPP_INFO(
ros2_node->get_logger(),
"Timed out when getting world names.");
return -1;
}
Expand Down
32 changes: 13 additions & 19 deletions ros_ign_gazebo_demos/launch/air_pressure.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription

from launch.actions import DeclareLaunchArgument
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.actions import ExecuteProcess
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration

from launch_ros.actions import Node

# TODO; execution broken
Expand All @@ -33,41 +34,34 @@

def generate_launch_description():

pkg_ros_ign_gazebo_demos = get_package_share_directory('ros_ign_gazebo_demos')
pkg_ros_ign_gazebo = get_package_share_directory('ros_ign_gazebo')

# Ignition Gazebo
ign_gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py'),
)
)

# Bridge
# TODO: Needs sensor_msgs/msg/FluidPressure to be supported on bridge
# bridge = Node(
# package='ros_ign_bridge',
# node_executable='parameter_bridge',
# executable='parameter_bridge',
# arguments=["/air_pressure@sensor_msgs/msg/FluidPressure@ignition.msgs.FluidPressure"],
# output='screen'
# )

ign_gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py')),
launch_arguments={'ign_args': '-r sensors.sdf'}.items(),
)

# RQt
rqt = Node(
package='rqt_topic',
node_executable='rqt_topic',
executable='rqt_topic',
arguments=['-t'],
condition=IfCondition(LaunchConfiguration('rqt'))
)

return LaunchDescription([
DeclareLaunchArgument(
'ign_args',
default_value=['sensors.sdf'],
description='Ignition Gazebo arguments'),
ign_gazebo,
DeclareLaunchArgument('rqt', default_value='true',
description='Open RQt.'),
ign_gazebo,
# bridge,
# bridge,
rqt
])
32 changes: 16 additions & 16 deletions ros_ign_gazebo_demos/launch/battery.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,52 @@
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


def generate_launch_description():

pkg_ros_ign_gazebo_demos = get_package_share_directory('ros_ign_gazebo_demos')
pkg_ros_ign_gazebo = get_package_share_directory('ros_ign_gazebo')

# Ignition Gazebo
ign_gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py'),
)
)
chapulina marked this conversation as resolved.
Show resolved Hide resolved

# RQt
rqt = Node(
package='rqt_plot',
node_executable='rqt_plot',
executable='rqt_plot',
# FIXME: Why isn't the topic being populated on the UI? RQt issue?
arguments=['--force-discover', '/model/vehicle_blue/battery/linear_battery/state/percentage'],
arguments=['--force-discover',
'/model/vehicle_blue/battery/linear_battery/state/percentage'],
condition=IfCondition(LaunchConfiguration('rqt'))
)

ign_gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py')),
launch_arguments={
'ign_args': '-r -z 1000000 linear_battery_demo.sdf'
}.items(),
)

# Bridge
bridge = Node(
package='ros_ign_bridge',
node_executable='parameter_bridge',
executable='parameter_bridge',
arguments=['/model/vehicle_blue/cmd_vel@geometry_msgs/msg/Twist@ignition.msgs.Twist',
'/model/vehicle_blue/battery/linear_battery/state@sensor_msgs/msg/BatteryState@ignition.msgs.BatteryState'],
output='screen'
)

return LaunchDescription([
DeclareLaunchArgument(
'ign_args',
default_value=['-r -z 1000000 linear_battery_demo.sdf'],
description='Ignition Gazebo arguments'),
ign_gazebo,
DeclareLaunchArgument('rqt', default_value='true',
description='Open RQt.'),
ign_gazebo,
bridge,
rqt
])
18 changes: 8 additions & 10 deletions ros_ign_gazebo_demos/launch/camera.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,48 @@
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


def generate_launch_description():

pkg_ros_ign_gazebo_demos = get_package_share_directory('ros_ign_gazebo_demos')
pkg_ros_ign_gazebo = get_package_share_directory('ros_ign_gazebo')

# Ignition Gazebo
ign_gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py'),
)
os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py')),
launch_arguments={'ign_args': '-r camera_sensor.sdf'}.items(),
)

# RViz
rviz = Node(
package='rviz2',
node_executable='rviz2',
executable='rviz2',
arguments=['-d', os.path.join(pkg_ros_ign_gazebo_demos, 'rviz', 'camera.rviz')],
condition=IfCondition(LaunchConfiguration('rviz'))
)

# Bridge
bridge = Node(
package='ros_ign_bridge',
node_executable='parameter_bridge',
executable='parameter_bridge',
arguments=['/camera@sensor_msgs/msg/Image@ignition.msgs.Image',
'/camera_info@sensor_msgs/msg/CameraInfo@ignition.msgs.CameraInfo'],
output='screen'
)

return LaunchDescription([
DeclareLaunchArgument(
'ign_args',
default_value=['-r camera_sensor.sdf'],
description='Ignition Gazebo arguments'),
DeclareLaunchArgument('rviz', default_value='true',
description='Open RViz.'),
description='Open RViz.'),
ign_gazebo,
bridge,
rviz
Expand Down
28 changes: 14 additions & 14 deletions ros_ign_gazebo_demos/launch/depth_camera.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,61 @@
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


def generate_launch_description():

pkg_ros_ign_gazebo_demos = get_package_share_directory('ros_ign_gazebo_demos')
pkg_ros_ign_gazebo = get_package_share_directory('ros_ign_gazebo')

# Ignition Gazebo
ign_gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py'),
)
os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py')),
# launch_arguments={
# 'ign_args': '-r depth_camera.sdf'
# }.items(),
)

# RQt
rqt = Node(
package='rqt_image_view',
node_executable='rqt_image_view',
executable='rqt_image_view',
arguments=['/camera'],
condition=IfCondition(LaunchConfiguration('rqt'))
)

# RViz
rviz = Node(
package='rviz2',
node_executable='rviz2',
executable='rviz2',
# FIXME: Generate new RViz config once this demo is usable again
#arguments=['-d', os.path.join(pkg_ros_ign_gazebo_demos, 'rviz', 'depth_camera.rviz')],
# arguments=['-d', os.path.join(pkg_ros_ign_gazebo_demos, 'rviz', 'depth_camera.rviz')],
condition=IfCondition(LaunchConfiguration('rviz'))
)

# Bridge
bridge = Node(
package='ros_ign_bridge',
node_executable='parameter_bridge',
executable='parameter_bridge',
arguments=['/depth_camera@sensor_msgs/msg/Image@ignition.msgs.Image'],
output='screen'
)

# FIXME: need a SDF file (depth_camera.sdf) inside ros_ign_point_cloud
return LaunchDescription([
DeclareLaunchArgument(
'ign_args',
default_value=[],
#default_value=['depth_camera.sdf'],
description='Ignition Gazebo arguments'),
ign_gazebo,
DeclareLaunchArgument('rviz', default_value='true',
description='Open RViz.'),
ign_gazebo,
DeclareLaunchArgument('rqt', default_value='true',
description='Open RQt.'),
bridge,
rviz,
rqt
Expand Down
Loading