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.
related to space-ros/space-ros#178 - Cleaned up canadarm launch file for the demo - Updated comments for demo node - Strip Moveit Redundant Node - Cleanup packages.xml - Remove ros control parameters for gazebo
- Loading branch information
1 parent
c4b3dec
commit 5a30311
Showing
12 changed files
with
192 additions
and
290 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,7 @@ | ||
{ | ||
"build": | ||
{ | ||
"symlink-install": true, | ||
"cmake_args": "-DCMAKE_BUILD_TYPE=Release -Wno-dev", | ||
}, | ||
} |
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,23 @@ | ||
FROM osrf/space-ros:core | ||
|
||
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp | ||
|
||
# Install dependencies | ||
RUN sudo apt update && sudo apt install -y ros-${ROS_DISTRO}-control-msgs \ | ||
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp | ||
|
||
# Prepare the workspace | ||
SHELL ["bash", "-c"] | ||
RUN mkdir -p ${HOME}/canadarm_ws/src | ||
WORKDIR ${HOME}/canadarm_ws | ||
|
||
COPY ./canadarm_demo src/canadarm_demo | ||
COPY .defaults.yaml .defaults.yaml | ||
|
||
# Build the workspace | ||
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ | ||
&& source /opt/spaceros/setup.bash \ | ||
&& colcon build | ||
|
||
# Source the workspace | ||
RUN echo "source ${HOME}/canadarm_ws/install/setup.bash" >> ${HOME}/.bashrc |
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,60 @@ | ||
# Define variables | ||
DOCKER_IMAGE = osrf/space-ros:canadarm_demo | ||
WORKSPACE = ${HOME}/canadarm_ws | ||
LOCAL_WORKSPACE = $(shell pwd) | ||
SHELL := /bin/bash | ||
XTERM_CONFIG = -bg black -fg white -fa 'Monospace' -fs 11 | ||
|
||
# Help target to describe each target | ||
.PHONY: help | ||
help: | ||
@echo "CanadArm2 Makefile" | ||
@echo " make build - Build the Docker image and the Gazebo workspace locally" | ||
@echo " make build-docker - Build the Docker image" | ||
@echo " make build-gazebo - Build the Gazebo workspace locally" | ||
@echo " make run-gazebo - Run the CanadArm2 Gazebo simulation locally" | ||
@echo " make run-demo - Run the CanadArm2 demo within Docker" | ||
@echo " make clean - Clean the local workspace" | ||
@echo " make all - Build and run everything" | ||
|
||
# Build all | ||
.PHONY: build | ||
build: build-docker build-gazebo | ||
|
||
# Build the Docker image | ||
.PHONY: build-docker | ||
build-docker: | ||
docker build -t $(DOCKER_IMAGE) . | ||
|
||
# Run the CanadArm Gazebo simulation locally | ||
.PHONY: run-gazebo | ||
run-gazebo: | ||
xterm $(XTERM_CONFIG) -T 'CanadArm2 Gazebo' -e 'source /opt/ros/${ROS_DISTRO}/setup.bash \ | ||
&& source $(LOCAL_WORKSPACE)/install/setup.bash \ | ||
&& ros2 launch canadarm_gazebo canadarm.launch.py' & | ||
|
||
# Build the Gazebo workspace locally | ||
.PHONY: build-gazebo | ||
build-gazebo: | ||
@source /opt/ros/${ROS_DISTRO}/setup.bash && \ | ||
rosdep install --from-paths canadarm_gazebo --ignore-src -r -y && \ | ||
rosdep install --from-paths canadarm_description --ignore-src -r -y && \ | ||
colcon build --symlink-install --base-paths $(LOCAL_WORKSPACE) --install-base $(LOCAL_WORKSPACE)/install \ | ||
--cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
--packages-select canadarm_description canadarm_gazebo | ||
|
||
# Run the CanadArm demo within Docker | ||
.PHONY: run-docker | ||
run-docker: | ||
xterm $(XTERM_CONFIG) -T 'CanadArm2 Demo' -e "docker run -it --rm \ | ||
-e RMW_IMPLEMENTATION=rmw_cyclonedds_cpp \ | ||
$(DOCKER_IMAGE) \ | ||
bash -c 'source ~/.bashrc && ros2 launch canadarm_demo canadarm.launch.py'" & | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf $(LOCAL_WORKSPACE)/install $(LOCAL_WORKSPACE)/log $(LOCAL_WORKSPACE)/build | ||
|
||
# Build and run everything | ||
.PHONY: run | ||
run: build run-gazebo run-docker |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,109 +1,24 @@ | ||
from http.server import executable | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, ExecuteProcess, RegisterEventHandler | ||
from launch.substitutions import TextSubstitution, PathJoinSubstitution, LaunchConfiguration, Command | ||
from launch_ros.actions import Node | ||
from launch_ros.substitutions import FindPackageShare | ||
from launch.event_handlers import OnProcessExit, OnExecutionComplete | ||
import os | ||
from os import environ | ||
"""Canadarm2 demo launch file.""" | ||
|
||
from ament_index_python.packages import get_package_share_directory | ||
from launch import LaunchDescription # type: ignore | ||
|
||
import xacro | ||
from launch_ros.actions import Node # type: ignore | ||
|
||
|
||
def generate_launch_description(): | ||
# ld = LaunchDescription() | ||
"""Generate launch description with multiple components.""" | ||
|
||
canadarm_demos_path = get_package_share_directory('canadarm') | ||
simulation_models_path = get_package_share_directory('simulation') | ||
|
||
env = {'IGN_GAZEBO_SYSTEM_PLUGIN_PATH': | ||
':'.join([environ.get('IGN_GAZEBO_SYSTEM_PLUGIN_PATH', default=''), | ||
environ.get('LD_LIBRARY_PATH', default='')]), | ||
'IGN_GAZEBO_RESOURCE_PATH': | ||
':'.join([environ.get('IGN_GAZEBO_RESOURCE_PATH', default=''), canadarm_demos_path])} | ||
|
||
|
||
urdf_model_path = os.path.join(simulation_models_path, 'models', 'canadarm', 'urdf', 'SSRMS_Canadarm2.urdf.xacro') | ||
leo_model = os.path.join(canadarm_demos_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()} | ||
|
||
|
||
#run_node = Node( | ||
# run_node = Node( | ||
# package="canadarm", | ||
# executable="move_joint_server", | ||
# output='screen' | ||
#) | ||
|
||
run_move_arm = Node( | ||
package="canadarm", | ||
executable="move_arm", | ||
output='screen' | ||
) | ||
|
||
|
||
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' | ||
) | ||
# ) | ||
|
||
run_move_arm = Node(package="canadarm_demo", executable="move_arm", output="screen") | ||
|
||
# Control | ||
load_joint_state_broadcaster = ExecuteProcess( | ||
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', | ||
'joint_state_broadcaster'], | ||
output='screen' | ||
return LaunchDescription( | ||
[ | ||
# run_node, | ||
run_move_arm, | ||
] | ||
) | ||
|
||
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, | ||
#run_node, | ||
run_move_arm, | ||
|
||
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], | ||
) | ||
), | ||
]) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.