Skip to content

Commit

Permalink
Merge pull request #273 from JdeRobot/Follow_person_bugs
Browse files Browse the repository at this point in the history
Follow person bugs
  • Loading branch information
Blancasr committed May 26, 2023
2 parents cc82131 + 1e2e507 commit 04980e2
Show file tree
Hide file tree
Showing 544 changed files with 2,762 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CustomRobots/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ install(DIRECTORY
amazon_hospital/models
amazon_hospital/hospital_world/launch
amazon_hospital/hospital_world/worlds
amazon_hospital/fuel_models
amazon_hospital/worlds
amazon_hospital/launch

DESTINATION share/${PROJECT_NAME}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<visual>
<geometry>
<!-- new mesh -->
<mesh filename="package://kobuki_description/meshes/main_body.dae"/>
<mesh filename="package://custom_robots/meshes/main_body.dae"/>
</geometry>
<origin rpy="0 0 0" xyz="0.001 0 0.05199"/>
</visual>
Expand Down Expand Up @@ -59,7 +59,7 @@
<link name="wheel_left_link">
<visual>
<geometry>
<mesh filename="package://kobuki_description/meshes/wheel.dae"/>
<mesh filename="package://custom_robots/meshes/wheel.dae"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
Expand All @@ -84,7 +84,7 @@
<link name="wheel_right_link">
<visual>
<geometry>
<mesh filename="package://kobuki_description/meshes/wheel.dae"/>
<mesh filename="package://custom_robots/meshes/wheel.dae"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
Expand Down
1 change: 0 additions & 1 deletion CustomRobots/amazon_hospital/fuel_models/Readme.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@
from launch.conditions import IfCondition
from launch.substitutions import PythonExpression
from ament_index_python.packages import get_package_share_directory
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():

# Set the path to the Turtlebot2 ROS package
pkg_share_dir = FindPackageShare(package='custom_robots').find('custom_robots')

world_file_name = "hospital.world"
world = os.path.join(get_package_share_directory('hospital_world'), 'worlds', world_file_name)
world = os.path.join(pkg_share_dir, 'worlds', world_file_name)

gazebo_models_path = os.path.join(pkg_share_dir, 'models')
gazebo_fuel_models_path = os.path.join(pkg_share_dir, 'fuel_models')
os.environ["GAZEBO_MODEL_PATH"] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
os.environ["GAZEBO_MODEL_PATH"] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_fuel_models_path)}"

gazebo_ros = get_package_share_directory('gazebo_ros')
gazebo_client = launch.actions.IncludeLaunchDescription(
Expand Down
99 changes: 99 additions & 0 deletions CustomRobots/amazon_hospital/launch/follow_person.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import os
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.conditions import IfCondition, UnlessCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import Command, LaunchConfiguration, PythonExpression
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare

def generate_launch_description():

# Set the path to the Gazebo ROS package
pkg_gazebo_ros = FindPackageShare(package='gazebo_ros').find('gazebo_ros')

# Set the path to the Turtlebot2 ROS package
pkg_share_dir = FindPackageShare(package='custom_robots').find('custom_robots')

# Set Turtlebot2 Arguments
x_turtlebot2_position = '0'
y_turtlebot2_position = '10'
z_turtlebot2_position = '1'

declare_x_position_cmd = DeclareLaunchArgument(
'-x', default_value=x_turtlebot2_position,
description="Position on the axis x of Turtlebot2"
)
declare_y_position_cmd = DeclareLaunchArgument(
'-y', default_value=y_turtlebot2_position,
description="Position on the axis y of Turtlebot2"
)
declare_z_position_cmd = DeclareLaunchArgument(
'-z', default_value=z_turtlebot2_position,
description="Position on the axis z of Turtlebot2"
)

world_name = "hospital_follow_person_followingcam.world"
current_dir = os.path.join(pkg_share_dir, 'launch')
world_path = os.path.join(current_dir, world_name)

# Set the path to the SDF model files
gazebo_models_path = os.path.join(pkg_share_dir, 'models')
os.environ["GAZEBO_MODEL_PATH"] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"

########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
# Launch configuration variables specific to simulation
headless = LaunchConfiguration('headless')
use_sim_time = LaunchConfiguration('use_sim_time')
use_simulator = LaunchConfiguration('use_simulator')
world = LaunchConfiguration('world')

declare_simulator_cmd = DeclareLaunchArgument(
name='headless',
default_value='False',
description='Whether to execute gzclient')

declare_use_sim_time_cmd = DeclareLaunchArgument(
name='use_sim_time',
default_value='true',
description='Use simulation (Gazebo) clock if true')

declare_use_simulator_cmd = DeclareLaunchArgument(
name='use_simulator',
default_value='True',
description='Whether to start the simulator')

declare_world_cmd = DeclareLaunchArgument(
name='world',
default_value=world_path,
description='Full path to the world model file to load')

# Specify the actions

# Start Gazebo server
start_gazebo_server_cmd = IncludeLaunchDescription(
PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzserver.launch.py')),
condition=IfCondition(use_simulator),
launch_arguments={'world': world}.items())

start_turtlebot2_cmd = IncludeLaunchDescription(
PythonLaunchDescriptionSource(os.path.join(pkg_share_dir, 'launch', 'spawn_model.launch.py')),
launch_arguments = {'-x': x_turtlebot2_position, '-y': y_turtlebot2_position, '-z': z_turtlebot2_position}.items())

# Create the launch description and populate
ld = LaunchDescription()

# Declare the launch options
ld.add_action(declare_simulator_cmd)
ld.add_action(declare_use_sim_time_cmd)
ld.add_action(declare_use_simulator_cmd)
ld.add_action(declare_world_cmd)
ld.add_action(declare_x_position_cmd)
ld.add_action(declare_y_position_cmd)
ld.add_action(declare_z_position_cmd)

# Add any actions
ld.add_action(start_gazebo_server_cmd)
ld.add_action(start_turtlebot2_cmd)

return ld
Loading

0 comments on commit 04980e2

Please sign in to comment.