Skip to content

Commit

Permalink
feat: task 1 added CL
Browse files Browse the repository at this point in the history
  • Loading branch information
JaisonJose241 committed Sep 19, 2023
1 parent 175115f commit 8e7a585
Show file tree
Hide file tree
Showing 580 changed files with 161,405 additions and 297 deletions.
3 changes: 0 additions & 3 deletions aws-robomaker-small-warehouse-world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,3 @@ ros2 launch aws_robomaker_small_warehouse_world small_warehouse.launch.py
## Notes
- Lighting might vary on different system(s) (e.g brighter on system without CPU and darker on system with GPU)
- Adjust lighting parameters in .world file as you need


## We have delinked this repo for solely eYRC-23-24 purpose
11 changes: 11 additions & 0 deletions ebot_description/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,23 @@ endif()
install(
DIRECTORY
launch
worlds
models
meshes
plugins
DESTINATION
share/${PROJECT_NAME}/
)

install(
PROGRAMS
launch/spawn_robot.py
DESTINATION lib/${PROJECT_NAME}
)

install(PROGRAMS

DESTINATION lib/${PROJECT_NAME}
)

ament_package()
47 changes: 29 additions & 18 deletions ebot_description/launch/ebot_gazebo_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,82 @@
*****************************************************************************************
*
* =============================================
* Cosmo Logistic (CL) Theme (eYRC 2023-24)
* CL Theme (eYRC 2023-24)
* =============================================
*
*
* Filename: ebot_gazebo_launch.py
* Description: Use this file to spawn ebot inside e-yantra warehouse world in the gazebo simulator and publish robot states.
* Created: 16/07/2023
* Last Modified: 16/07/2023
* Modified by: Archit
* Last Modified: 16/09/2023
* Modified by: Ravikumar
* Author: e-Yantra Team
* Copyright (c): 2023 eYantra IITB
*
*****************************************************************************************
'''

import os
import xacro
import launch
import launch_ros
from launch.actions import IncludeLaunchDescription
from launch.substitutions import Command, LaunchConfiguration
import os
import xacro
from ament_index_python.packages import get_package_share_directory
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource

def get_package_file(package, file_path):
"""Get the location of a file installed in an ament package"""
package_path = get_package_share_directory(package)
absolute_file_path = os.path.join(package_path, file_path)
return absolute_file_path

def generate_launch_description():

# Getting package share directory
pkg_share = launch_ros.substitutions.FindPackageShare(package='ebot_description').find('ebot_description')

# Loading xacro as robot description
xacro_file_ebot = os.path.join(pkg_share, 'models/','ebot/', 'ebot_description.xacro')
assert os.path.exists(xacro_file_ebot), "The ebot_bot.xacro doesnt exist in "+str(xacro_file_ebot)
xacro_file_ebot = os.path.join(pkg_share, 'models/','ebot/', 'ebot_trolley.xacro')
assert os.path.exists(xacro_file_ebot), "The box_bot.xacro doesnt exist in "+str(xacro_file_ebot)
robot_description_config_ebot = xacro.process_file(xacro_file_ebot)
robot_description_ebot = robot_description_config_ebot.toxml()



start_world = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('ebot_description'), 'launch', 'start_world_launch.py'),
)
)

# Publishing robot state
robot_state_publisher_node_ebot = launch_ros.actions.Node(
package='robot_state_publisher',
name='ebot_RD',
executable='robot_state_publisher',
parameters=[{"robot_description": robot_description_ebot}],
remappings=[('robot_description', 'robot_description_ebot')]

)
# Spawn mobile robot (ebot) at xyz location in gazebo environment

static_transform = launch_ros.actions.Node(
package='tf2_ros',
executable='static_transform_publisher',
name='static_transform_publisher',
arguments = ["1.6", "-2.4", "-0.8", "3.14", "0", "0", "world", "odom"],
output='screen')

spawn_ebot = launch_ros.actions.Node(
package='gazebo_ros',
name='ebot_spawner',
executable='spawn_entity.py',
arguments=['-entity', 'ebot', '-topic', 'robot_description_ebot'],
# arguments=['-entity', 'ebot', '-topic', 'robot_description_ebot', '-x', '1.1', '-y', '4.35', '-z', '0.1', '-Y', '3.14'],
arguments=['-entity', 'ebot', '-topic', 'robot_description_ebot', '-x', '0.0', '-y', '0.0', '-z', '0.1', '-Y', '0.0'],
output='screen'
)


return launch.LaunchDescription([
launch.actions.DeclareLaunchArgument(name='gui', default_value='True',
description='Flag to enable joint_state_publisher_gui'),
launch.actions.DeclareLaunchArgument(name='use_sim_time', default_value='True',
description='Flag to enable use_sim_time'),
start_world,
robot_state_publisher_node_ebot,
spawn_ebot
spawn_ebot,
static_transform
])
38 changes: 38 additions & 0 deletions ebot_description/launch/spawn_robot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
import rclpy
from gazebo_msgs.srv import SpawnEntity

def main(args=None):
rclpy.init(args=args)
node = rclpy.create_node('minimal_client')
cli = node.create_client(SpawnEntity, '/spawn_entity')

content = sys.argv[1]

req = SpawnEntity.Request()
req.name = "ebot"
req.xml = content
req.robot_namespace = ""
req.reference_frame = "world"

while not cli.wait_for_service(timeout_sec=1.0):
node.get_logger().info('service not available, waiting again...')

future = cli.call_async(req)
rclpy.spin_until_future_complete(node, future)

if future.result() is not None:
node.get_logger().info(
'Result ' + str(future.result().success) + " " + future.result().status_message)
else:
node.get_logger().info('Service call failed %r' % (future.exception(),))

node.destroy_node()
rclpy.shutdown()


if __name__ == '__main__':
main()
21 changes: 12 additions & 9 deletions ebot_description/launch/start_world_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*****************************************************************************************
*
* =============================================
* Cosmo Logistic (CL) Theme (eYRC 2023-24)
* TBD Theme (eYRC 2023-24)
* =============================================
*
*
Expand All @@ -15,22 +15,23 @@
* Last Modified: 12/07/2023
* Modified by: Amit
* Author: e-Yantra Team
* Copyright (c): 2023 eYantra IITB
*
*****************************************************************************************
'''


import os
from launch_ros.actions import Node

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.conditions import IfCondition
from launch.actions import ExecuteProcess
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 launch.actions import ExecuteProcess
from ament_index_python.packages import get_package_prefix
from ament_index_python.packages import get_package_share_directory
from launch.launch_description_sources import PythonLaunchDescriptionSource

pkg_name='eyantra_warehouse'

Expand All @@ -40,6 +41,7 @@ def generate_launch_description():
pkg_models_dir = get_package_share_directory(pkg_name)

install_dir = get_package_prefix(pkg_name)

if 'GAZEBO_MODEL_PATH' in os.environ:
gazebo_models_path = os.path.join(pkg_models_dir, 'models')
os.environ['GAZEBO_MODEL_PATH'] = gazebo_models_path
Expand All @@ -51,7 +53,7 @@ def generate_launch_description():
else:
os.environ['GAZEBO_PLUGIN_PATH'] = install_dir + '/lib'

# Launch gazebo
# Gazebo launch
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_gazebo_ros, 'launch', 'gazebo.launch.py'),
Expand All @@ -61,7 +63,8 @@ def generate_launch_description():
return LaunchDescription([
DeclareLaunchArgument(
'world',
default_value=[os.path.join(pkg_models_dir, 'worlds', 'eyantra_warehouse.world'), ''],
default_value=[os.path.join(pkg_models_dir, 'worlds', 'eyantra_warehouse.world'), ''], # Change name of world file if required.
description='SDF world file'),
gazebo
# ExecuteProcess(cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'], output='screen'),
])
Binary file added ebot_description/meshes/FRS.STL
Binary file not shown.
Binary file added ebot_description/meshes/LANT.STL
Binary file not shown.
Binary file added ebot_description/meshes/LIDAR.STL
Binary file not shown.
Binary file added ebot_description/meshes/NAVRS.STL
Binary file not shown.
Binary file added ebot_description/meshes/RANT.STL
Binary file not shown.
Binary file added ebot_description/meshes/RRS.STL
Binary file not shown.
Loading

0 comments on commit 8e7a585

Please sign in to comment.