forked from space-ros/demos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add canadarm_gazebo package for ignition gazebo integration
resolves space-ros/space-ros#178 - Add canadarm_description package - Move earth and iss world models to canadarm_gazebo
- Loading branch information
1 parent
013df12
commit b2806a8
Showing
10 changed files
with
210 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
install/ | ||
log/ |
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,31 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(canadarm_gazebo) | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
endif() | ||
|
||
# find dependencies | ||
find_package(ament_cmake REQUIRED) | ||
find_package(canadarm_description REQUIRED) | ||
|
||
install(DIRECTORY | ||
launch | ||
models | ||
worlds | ||
DESTINATION share/${PROJECT_NAME} | ||
) | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_lint_auto REQUIRED) | ||
# the following line skips the linter which checks for copyrights | ||
# comment the line when a copyright and license is added to all source files | ||
set(ament_cmake_copyright_FOUND TRUE) | ||
# the following line skips cpplint (only works in a git repo) | ||
# comment the line when this package is in a git repo and when | ||
# a copyright and license is added to all source files | ||
set(ament_cmake_cpplint_FOUND TRUE) | ||
ament_lint_auto_find_test_dependencies() | ||
endif() | ||
|
||
ament_package() |
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,118 @@ | ||
"""Canadarm2 Gazebo launch file.""" | ||
|
||
import os | ||
from launch import LaunchDescription # type: ignore | ||
from launch.actions import ExecuteProcess, RegisterEventHandler # type: ignore | ||
from launch.event_handlers import OnProcessExit # type: ignore | ||
from launch_ros.actions import Node # type: ignore | ||
|
||
from ament_index_python.packages import get_package_share_directory # type: ignore | ||
|
||
import xacro # type: ignore | ||
|
||
|
||
def generate_launch_description(): | ||
"""Generate launch description with multiple components.""" | ||
|
||
canadarm_gazebo_path = get_package_share_directory("canadarm_gazebo") | ||
simulation_models_path = get_package_share_directory("canadarm_description") | ||
|
||
env = { | ||
"IGN_GAZEBO_SYSTEM_PLUGIN_PATH": ":".join( | ||
[ | ||
os.environ.get("IGN_GAZEBO_SYSTEM_PLUGIN_PATH", default=""), | ||
os.environ.get("LD_LIBRARY_PATH", default=""), | ||
] | ||
), | ||
"IGN_GAZEBO_RESOURCE_PATH": ":".join( | ||
[ | ||
os.environ.get("IGN_GAZEBO_RESOURCE_PATH", default=""), | ||
canadarm_gazebo_path + "/models", | ||
] | ||
), | ||
} | ||
|
||
urdf_model_path = os.path.join( | ||
simulation_models_path, | ||
"models", | ||
"urdf", | ||
"SSRMS_Canadarm2.urdf.xacro", | ||
) | ||
leo_model = os.path.join(canadarm_gazebo_path, "worlds", "simple.world") | ||
|
||
doc = xacro.process_file( | ||
urdf_model_path, mappings={"xyz": "1.0 0.0 1.5", "rpy": "3.1416 0.0 0.0"} | ||
) | ||
robot_description = {"robot_description": doc.toxml()} | ||
|
||
start_world = ExecuteProcess( | ||
cmd=["ign gazebo", leo_model, "-r"], | ||
output="screen", | ||
additional_env=env, | ||
shell=True, | ||
) | ||
|
||
robot_state_publisher = Node( | ||
package="robot_state_publisher", | ||
executable="robot_state_publisher", | ||
name="robot_state_publisher", | ||
output="screen", | ||
parameters=[robot_description], | ||
) | ||
|
||
spawn = Node( | ||
package="ros_ign_gazebo", | ||
executable="create", | ||
arguments=[ | ||
"-name", | ||
"canadarm", | ||
"-topic", | ||
robot_description, | ||
], | ||
output="screen", | ||
) | ||
|
||
# Control | ||
load_joint_state_broadcaster = ExecuteProcess( | ||
cmd=[ | ||
"ros2", | ||
"control", | ||
"load_controller", | ||
"--set-state", | ||
"active", | ||
"joint_state_broadcaster", | ||
], | ||
output="screen", | ||
) | ||
|
||
load_canadarm_joint_controller = ExecuteProcess( | ||
cmd=[ | ||
"ros2", | ||
"control", | ||
"load_controller", | ||
"--set-state", | ||
"active", | ||
"canadarm_joint_trajectory_controller", | ||
], | ||
output="screen", | ||
) | ||
|
||
return LaunchDescription( | ||
[ | ||
start_world, | ||
robot_state_publisher, | ||
spawn, | ||
RegisterEventHandler( | ||
OnProcessExit( | ||
target_action=spawn, | ||
on_exit=[load_joint_state_broadcaster], | ||
) | ||
), | ||
RegisterEventHandler( | ||
OnProcessExit( | ||
target_action=load_joint_state_broadcaster, | ||
on_exit=[load_canadarm_joint_controller], | ||
) | ||
), | ||
] | ||
) |
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,27 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>canadarm_gazebo</name> | ||
<version>0.0.0</version> | ||
<description>TODO: Package description</description> | ||
<maintainer email="franklinselva10@gmail.com">franklinselva</maintainer> | ||
<license>TODO: License declaration</license> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
<depend>canadarm_description</depend> | ||
<depend>ros_gz</depend> | ||
|
||
<exec_depend>ign_ros2_control</exec_depend> | ||
<exec_depend>ros2_control</exec_depend> | ||
<exec_depend>ros2_controllers</exec_depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
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