Коммит
a72ef3af05
|
@ -0,0 +1,22 @@
|
|||
name: jira-link
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
jira-link:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: check pull request title and source branch name
|
||||
run: |
|
||||
echo "Checking pull request with title ${{ github.event.pull_request.title }} from source branch ${{ github.event.pull_request.head.ref }}"
|
||||
if ! [[ "${{ github.event.pull_request.title }}" =~ ^AIRO-[0-9]+[[:space:]].*$ ]] && ! [[ "${{ github.event.pull_request.head.ref }}" =~ ^AIRO-[0-9]+.*$ ]]
|
||||
then
|
||||
echo -e "Please make sure one of the following is true:\n \
|
||||
1. the pull request title starts with 'AIRO-xxxx ', e.g. 'AIRO-1024 My Pull Request'\n \
|
||||
2. the source branch starts with 'AIRO-xxx', e.g. 'AIRO-1024-my-branch'"
|
||||
exit 1
|
||||
else
|
||||
echo "Completed checking"
|
||||
fi
|
|
@ -0,0 +1,17 @@
|
|||
name: Snyk Monitor
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Snyk to check for vulnerabilities
|
||||
uses: snyk/actions/python-3.8@master
|
||||
env:
|
||||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
with:
|
||||
command: monitor
|
||||
args: --file=tutorials/ros_unity_integration/ros2_packages/unity_robotics_demo/setup.py
|
|
@ -0,0 +1,146 @@
|
|||
#!/bin/bash
|
||||
# Assuming this script is invoked from the root of the repository...
|
||||
help() {
|
||||
echo "usage: $0 [COMMAND] [ROS]"
|
||||
echo "COMMAND:"
|
||||
echo " - stop"
|
||||
echo " - build_pick_and_place"
|
||||
echo " - start_pick_and_place"
|
||||
echo " - build_ros"
|
||||
echo " - start_ros"
|
||||
echo " - run_ros_color_publisher"
|
||||
echo " - run_ros_pose_service_client"
|
||||
echo " - run_ros_position_service"
|
||||
echo "ROS"
|
||||
echo " - ros1"
|
||||
echo " - ros2"
|
||||
}
|
||||
|
||||
COMMAND=$1
|
||||
ROS=$2
|
||||
|
||||
if [ "$COMMAND" == "stop" ]; then
|
||||
echo "Terminating process $3"
|
||||
pkill -15 -P $3
|
||||
sleep 10
|
||||
|
||||
elif [ "$COMMAND" == "build_pick_and_place" ]; then
|
||||
source /opt/ros/noetic/setup.bash
|
||||
pushd $PWD
|
||||
cd tutorials/pick_and_place/ROS
|
||||
catkin_make
|
||||
source devel/setup.bash
|
||||
popd
|
||||
|
||||
elif [ "$COMMAND" == "start_pick_and_place" ]; then
|
||||
echo "Starting ROS for Pick and Place"
|
||||
source tutorials/pick_and_place/ROS/devel/setup.bash
|
||||
roslaunch niryo_moveit part_3.launch
|
||||
|
||||
elif [ "$COMMAND" == "build_ros" ]; then
|
||||
if [ "$ROS" == "ros1" ]; then
|
||||
export ROS_WORKSPACE=$(pwd)/ros1_ws
|
||||
mkdir -p $ROS_WORKSPACE/src
|
||||
cp -r tutorials/ros_unity_integration/ros_packages/ $ROS_WORKSPACE/src/
|
||||
git clone https://github.com/Unity-Technologies/ROS-TCP-Endpoint $ROS_WORKSPACE/src/ros_tcp_endpoint -b main
|
||||
/bin/bash tutorials/ros_unity_integration/ros_docker/set-up-workspace
|
||||
chmod +x $ROS_WORKSPACE/src/ros_tcp_endpoint/src/ros_tcp_endpoint/*.py
|
||||
elif [ "$ROS" == "ros2" ]; then
|
||||
export ROS_WORKSPACE=$(pwd)/ros2_ws
|
||||
mkdir -p $ROS_WORKSPACE/src
|
||||
cp -r tutorials/ros_unity_integration/ros2_packages/ $ROS_WORKSPACE/src/
|
||||
git clone https://github.com/Unity-Technologies/ROS-TCP-Endpoint $ROS_WORKSPACE/src/ros_tcp_endpoint -b main-ros2
|
||||
source /opt/ros/$ROS_DISTRO/setup.sh
|
||||
pushd $(pwd)
|
||||
cd $ROS_WORKSPACE
|
||||
colcon build
|
||||
popd
|
||||
else
|
||||
help
|
||||
fi
|
||||
|
||||
elif [ "$COMMAND" == "start_ros" ]; then
|
||||
if [ "$ROS" == "ros1" ]; then
|
||||
source ros1_ws/devel/setup.bash
|
||||
echo "Starting ROS1 master"
|
||||
roscore &
|
||||
sleep 5 # Wait ROS master to stand up
|
||||
rosparam set ROS_IP 127.0.0.1
|
||||
echo "Starting ROS1 default server endpoint"
|
||||
rosrun ros_tcp_endpoint default_server_endpoint.py
|
||||
elif [ "$ROS" == "ros2" ]; then
|
||||
source ros2_ws/install/setup.bash
|
||||
echo "Starting ROS2 default server endpoint"
|
||||
ros2 run ros_tcp_endpoint default_server_endpoint --ros-args -p ROS_IP:=127.0.0.1
|
||||
else
|
||||
help
|
||||
fi
|
||||
|
||||
elif [ "$COMMAND" == "run_ros_color_publisher" ]; then
|
||||
if [ "$ROS" == "ros1" ]; then
|
||||
source ros1_ws/devel/setup.bash
|
||||
elif [ "$ROS" == "ros2" ]; then
|
||||
source ros2_ws/install/setup.bash
|
||||
else
|
||||
help
|
||||
fi
|
||||
echo "Starting to run $ROS color publisher every 30 seconds"
|
||||
count=0
|
||||
while [[ $count -le 6 ]]
|
||||
do
|
||||
sleep 5
|
||||
if [ "$ROS" == "ros1" ]; then
|
||||
rosrun unity_robotics_demo color_publisher.py
|
||||
elif [ "$ROS" == "ros2" ]; then
|
||||
ros2 run unity_robotics_demo color_publisher
|
||||
else
|
||||
help
|
||||
fi
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
echo "Completed run: $ROS color publisher"
|
||||
|
||||
elif [ "$COMMAND" == "run_ros_pose_service_client" ]; then
|
||||
if [ "$ROS" == "ros1" ]; then
|
||||
source ros1_ws/devel/setup.bash
|
||||
elif [ "$ROS" == "ros2" ]; then
|
||||
source ros2_ws/install/setup.bash
|
||||
else
|
||||
help
|
||||
fi
|
||||
echo "Starting to run $ROS pose service client and send requests every 30 seconds"
|
||||
count=0
|
||||
while [[ $count -le 6 ]]
|
||||
do
|
||||
sleep 5
|
||||
if [ "$ROS" == "ros1" ]; then
|
||||
rosservice call /obj_pose_srv Cube
|
||||
elif [ "$ROS" == "ros2" ]; then
|
||||
ros2 service call obj_pose_srv unity_robotics_demo_msgs/ObjectPoseService "{object_name: Cube}"
|
||||
else
|
||||
help
|
||||
fi
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
echo "Completed run: $ROS pose service client"
|
||||
|
||||
elif [ "$COMMAND" == "run_ros_position_service" ]; then
|
||||
if [ "$ROS" == "ros1" ]; then
|
||||
source ros1_ws/devel/setup.bash
|
||||
elif [ "$ROS" == "ros2" ]; then
|
||||
source ros2_ws/install/setup.bash
|
||||
else
|
||||
help
|
||||
fi
|
||||
echo "Starting $ROS position service"
|
||||
if [ "$ROS" == "ros1" ]; then
|
||||
rosrun unity_robotics_demo position_service.py
|
||||
elif [ "$ROS" == "ros2" ]; then
|
||||
ros2 run unity_robotics_demo position_service
|
||||
else
|
||||
help
|
||||
fi
|
||||
|
||||
else
|
||||
help
|
||||
fi
|
|
@ -17,6 +17,7 @@ root_dir = os.path.join(script_dir, "..", "..", "tutorials", "pick_and_place")
|
|||
external_scripts_dir = os.path.join(root_dir, "Scripts")
|
||||
project_dir = os.path.join(root_dir, "PickAndPlaceProject")
|
||||
project_scripts_dir = os.path.join(project_dir, "Assets", "Scripts")
|
||||
external_ros_scripts_dir = os.path.join(script_dir, "..", "..", "tutorials", "ros_unity_integration", "unity_scripts")
|
||||
# project_settings_file = os.path.join(project_dir, "ProjectSettings", "ProjectSettings.asset")
|
||||
|
||||
scripts_to_move = glob.glob(os.path.join(external_scripts_dir, "*.cs"))
|
||||
|
@ -26,6 +27,13 @@ for external_script in scripts_to_move:
|
|||
print(f">>> Copying {external_script} to {script_destination}")
|
||||
shutil.copyfile(external_script, script_destination)
|
||||
|
||||
scripts_to_move = glob.glob(os.path.join(external_ros_scripts_dir, "*.cs"))
|
||||
for external_script in scripts_to_move:
|
||||
script_name = os.path.basename(external_script)
|
||||
script_destination = os.path.join(project_scripts_dir, script_name)
|
||||
print(f">>> Copying {external_script} to {script_destination}")
|
||||
shutil.copyfile(external_script, script_destination)
|
||||
|
||||
files_to_cat = []
|
||||
message_dir = os.path.join(project_dir, "Assets", "RosMessages")
|
||||
print(f">>> Files in {message_dir}:")
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
from unityparser import UnityDocument
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
parser = argparse.ArgumentParser(description='Add ROS define symbols')
|
||||
parser.add_argument('ros', type=str, help='ROS version: ros1 or ros2')
|
||||
|
||||
project_settings_filepath = os.path.join(".", "tutorials", "pick_and_place", "PickAndPlaceProject", "ProjectSettings", "ProjectSettings.asset")
|
||||
if not os.path.exists(project_settings_filepath):
|
||||
raise FileNotFoundError("Not found %s".format(project_settings_filepath))
|
||||
settings = UnityDocument.load_yaml(project_settings_filepath)
|
||||
symbols = settings.entries[0].scriptingDefineSymbols
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.ros == "ros1":
|
||||
if symbols[1] is None:
|
||||
symbols[1] = "ROS1"
|
||||
else:
|
||||
symbols[1] += ";ROS1"
|
||||
elif args.ros == "ros2":
|
||||
if symbols[1] is None:
|
||||
symbols[1] = "ROS2"
|
||||
else:
|
||||
symbols[1] += ";ROS2"
|
||||
else:
|
||||
raise ValueError("Invalid input ROS version. Must be either ros1 or ros2")
|
||||
settings.dump_yaml(project_settings_filepath)
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
source /opt/ros/noetic/setup.bash
|
||||
|
||||
set -e
|
||||
|
||||
# Assuming this script is invoked from the root of the repository...
|
||||
DIR_ORIGINAL=$PWD
|
||||
cd tutorials/pick_and_place/ROS
|
||||
catkin_make
|
||||
source devel/setup.bash
|
||||
cd "$DIR_ORIGINAL"
|
||||
roslaunch niryo_moveit part_3.launch &
|
|
@ -0,0 +1,52 @@
|
|||
csharp:
|
||||
name: Sonarqube C# Scan
|
||||
agent:
|
||||
type: Unity::metal::macmini
|
||||
image: package-ci/mac
|
||||
flavor: m1.mac
|
||||
variables:
|
||||
PROJECT_PATH: tutorials/pick_and_place/PickAndPlaceProject
|
||||
SONARQUBE_PROJECT_KEY: ai-robotics-hub-csharp
|
||||
SONARQUBE_PROJECT_BASE_DIR: /Users/bokken/build/output/Unity-Technologies/Unity-Robotics-Hub/tutorials/pick_and_place/PickAndPlaceProject
|
||||
MSBUILD_SLN_PATH: ./tutorials/pick_and_place/PickAndPlaceProject/PickAndPlaceProject.sln
|
||||
PROJECT_ROOT: /Users/bokken/build/output/Unity-Technologies/Unity-Robotics-Hub/
|
||||
UNITY_VERSION: 2020.3.11f1
|
||||
commands:
|
||||
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.it.unity3d.com/artifactory/api/npm/upm-npm
|
||||
- unity-downloader-cli -u $UNITY_VERSION -c Editor
|
||||
- brew install mono corretto
|
||||
- curl https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/5.2.1.31210/sonar-scanner-msbuild-5.2.1.31210-net46.zip -o sonar-scanner-msbuild-net46.zip -L
|
||||
- unzip sonar-scanner-msbuild-net46.zip -d ~/sonar-scanner-msbuild
|
||||
- chmod a+x ~/sonar-scanner-msbuild/sonar-scanner-4.6.1.2450/bin/sonar-scanner
|
||||
- .Editor/Unity.app/Contents/MacOS/Unity -projectPath $PROJECT_PATH -batchmode -quit -nographics -logFile - -executeMethod "UnityEditor.SyncVS.SyncSolution"
|
||||
- command: |
|
||||
cd $PROJECT_PATH
|
||||
for file in *.csproj; do sed -i.backup "s/^[[:blank:]]*<ReferenceOutputAssembly>false<\/ReferenceOutputAssembly>/<ReferenceOutputAssembly>true<\/ReferenceOutputAssembly>/g" $file; rm $file.backup; done
|
||||
cd $PROJECT_ROOT
|
||||
- mono ~/sonar-scanner-msbuild/SonarScanner.MSBuild.exe begin /k:$SONARQUBE_PROJECT_KEY /d:sonar.host.url=$SONARQUBE_ENDPOINT_URL_PRD /d:sonar.login=$SONARQUBE_TOKEN_PRD /d:sonar.projectBaseDir=$SONARQUBE_PROJECT_BASE_DIR
|
||||
- msbuild $MSBUILD_SLN_PATH
|
||||
- mono ~/sonar-scanner-msbuild/SonarScanner.MSBuild.exe end /d:sonar.login=$SONARQUBE_TOKEN_PRD
|
||||
triggers:
|
||||
cancel_old_ci: true
|
||||
expression: |
|
||||
((pull_request.target eq "main" OR pull_request.target eq "dev")
|
||||
AND NOT pull_request.push.changes.all match "**/*.md") OR
|
||||
(push.branch eq "main" OR push.branch eq "dev")
|
||||
standard:
|
||||
name: Sonarqube Standard Scan
|
||||
agent:
|
||||
type: Unity::metal::macmini
|
||||
image: package-ci/mac
|
||||
flavor: m1.mac
|
||||
variables:
|
||||
SONARQUBE_PROJECT_KEY: ai-robotics-hub-standard
|
||||
commands:
|
||||
- curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-macosx.zip -o sonar-scanner-macosx.zip -L
|
||||
- unzip sonar-scanner-macosx.zip -d ~/sonar-scanner
|
||||
- ~/sonar-scanner/sonar-scanner-4.6.2.2472-macosx/bin/sonar-scanner -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.sources=. -Dsonar.host.url=$SONARQUBE_ENDPOINT_URL_PRD -Dsonar.login=$SONARQUBE_TOKEN_PRD
|
||||
triggers:
|
||||
cancel_old_ci: true
|
||||
expression: |
|
||||
((pull_request.target eq "main" OR pull_request.target eq "dev")
|
||||
AND NOT pull_request.push.changes.all match "**/*.md") OR
|
||||
(push.branch eq "main" OR push.branch eq "dev")
|
|
@ -1,41 +1,144 @@
|
|||
name: Robotics Hub Tests
|
||||
agent:
|
||||
type: Unity::VM
|
||||
image: robotics/ci-ubuntu20:v0.1.0pnp-796097
|
||||
flavor: i1.large
|
||||
variables:
|
||||
PATH: /root/.local/bin:/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin
|
||||
commands:
|
||||
- git submodule update --init --recursive
|
||||
# We must remove the Demo.cs script because the System.CodeDom assembly is not in the bokken .NET sdk
|
||||
- rm ./tutorials/pick_and_place/PickAndPlaceProject/Assets/DemoScripts/Demo.*
|
||||
# Ensure audio is disabled. Unity built-in audio fails to initialize in our Bokken image.
|
||||
- "sed -i -e '/m_DisableAudio/ s/: .*/: 1/' ./tutorials/pick_and_place/PickAndPlaceProject/ProjectSettings/AudioManager.asset"
|
||||
- python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
|
||||
- unity-downloader-cli -u 2020.3.11f1 -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
|
||||
- git clone git@github.cds.internal.unity3d.com:unity/utr.git utr
|
||||
# Explicitly run MessageGeneration tests first to generate dependencies
|
||||
- utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0
|
||||
--artifacts_path=test-results --suite=editor --platform=Editor --editorTestsCategories
|
||||
MessageGeneration
|
||||
# Run each category of tests in its own process, in order of increasing complexity
|
||||
- utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0
|
||||
--artifacts_path=test-results --suite=playmode --suite=editor --platform=Editor --editorTestCategories UnitTests
|
||||
pick_and_place:
|
||||
name: Robotics Hub Pick and Place Tests
|
||||
agent:
|
||||
type: Unity::VM
|
||||
image: robotics/ci-ubuntu20:v0.1.0pnp-796097
|
||||
flavor: i1.large
|
||||
variables:
|
||||
PATH: /root/.local/bin:/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin
|
||||
commands:
|
||||
- sudo ln -s $(which python3) /usr/bin/python
|
||||
- git submodule update --init --recursive
|
||||
|
||||
# We must remove the Demo.cs script because the System.CodeDom assembly is not in the bokken .NET sdk
|
||||
- rm ./tutorials/pick_and_place/PickAndPlaceProject/Assets/DemoScripts/Demo.*
|
||||
|
||||
# Ensure audio is disabled. Unity built-in audio fails to initialize in our Bokken image.
|
||||
- "sed -i -e '/m_DisableAudio/ s/: .*/: 1/' ./tutorials/pick_and_place/PickAndPlaceProject/ProjectSettings/AudioManager.asset"
|
||||
- python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
|
||||
- unity-downloader-cli -u 2020.3.11f1 -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
|
||||
- git clone git@github.cds.internal.unity3d.com:unity/utr.git utr
|
||||
|
||||
# Explicitly run MessageGeneration tests first to generate dependencies
|
||||
- utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0
|
||||
--artifacts_path=test-results --suite=editor --platform=Editor --extra-editor-arg="-nographics"
|
||||
--category=MessageGeneration
|
||||
|
||||
# Run each category of tests in its own process, in order of increasing complexity
|
||||
- utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0
|
||||
--artifacts_path=test-results --suite=playmode --suite=editor --platform=Editor --category=UnitTests
|
||||
|
||||
# - utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0
|
||||
#--artifacts_path=test-results --suite=editor --platform=Editor --testfilter BuildTests.PlayerBuilder.BuildPlayerLinux
|
||||
- python3 .yamato/PickAndPlaceTests/set-up-integration-tests.py
|
||||
#TODO: Determine how best to capture ROS logging as test artifacts
|
||||
- /bin/bash .yamato/PickAndPlaceTests/start-ros.bash
|
||||
# NOTE: Simply specifying the testCategory is not enough to get a test marked with [Explicit] to run
|
||||
- utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0
|
||||
--artifacts_path=test-results --suite=editor --platform=Editor --testfilter IntegrationTests.RosIntegrationTests
|
||||
#TODO: Determine when it would be prudent to run BuildTests and add them here or in a new config
|
||||
triggers:
|
||||
cancel_old_ci: true
|
||||
expression: |
|
||||
(pull_request.target in ["main", "dev"] AND
|
||||
NOT pull_request.changes.all match ["**/*.md","**/*.jpg","**/*.jpeg","**/*.gif","**/*.pdf"])
|
||||
artifacts:
|
||||
logs:
|
||||
paths:
|
||||
- "test-results/**/*"
|
||||
|
||||
- python3 .yamato/PickAndPlaceTests/set-up-integration-tests.py
|
||||
|
||||
# Run Pick and Place Test
|
||||
# NOTE: Simply specifying the testCategory is not enough to get a test marked with [Explicit] to run
|
||||
# TODO: Determine how best to capture ROS logging as test artifacts
|
||||
# TODO: Determine when it would be prudent to run BuildTests and add them here or in a new config
|
||||
- |
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash build_pick_and_place
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash start_pick_and_place &
|
||||
export PID=$!
|
||||
utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=editor --platform=Editor --extra-editor-arg="-nographics" --testfilter IntegrationTests.PickAndPlaceIntegrationTests
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash stop ros1 $PID
|
||||
|
||||
triggers:
|
||||
cancel_old_ci: true
|
||||
expression: |
|
||||
(pull_request.target in ["main", "dev"] AND
|
||||
NOT pull_request.changes.all match ["**/*.md","**/*.jpg","**/*.jpeg","**/*.gif","**/*.pdf"])
|
||||
artifacts:
|
||||
logs:
|
||||
paths:
|
||||
- "test-results/**/*"
|
||||
|
||||
{% assign rosDistros = "noetic galactic" | split: " " %}
|
||||
|
||||
{% for rosDistro in rosDistros %}
|
||||
ros_{{rosDistro}}_integration:
|
||||
name: Robotics Hub ROS {{rosDistro}} Integration Tests
|
||||
agent:
|
||||
type: Unity::VM
|
||||
{% if rosDistro == "noetic" %}
|
||||
image: robotics/ci-ubuntu20:v0.1.0-795910
|
||||
{% elsif rosDistro == "galactic" %}
|
||||
image: robotics/ci-ros2-galactic-ubuntu20:v0.0.2-916903
|
||||
{% endif %}
|
||||
flavor: i1.large
|
||||
variables:
|
||||
PATH: /root/.local/bin:/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin
|
||||
commands:
|
||||
# TODO: move to image builders
|
||||
- sudo ln -s $(which python3) /usr/bin/python
|
||||
# TODO: move to galactic image builder
|
||||
- sudo apt update && sudo apt install -y build-essential
|
||||
|
||||
- git submodule update --init --recursive
|
||||
|
||||
# We must remove the Demo.cs script because the System.CodeDom assembly is not in the bokken .NET sdk
|
||||
- rm ./tutorials/pick_and_place/PickAndPlaceProject/Assets/DemoScripts/Demo.*
|
||||
|
||||
# Ensure audio is disabled. Unity built-in audio fails to initialize in our Bokken image.
|
||||
- "sed -i -e '/m_DisableAudio/ s/: .*/: 1/' ./tutorials/pick_and_place/PickAndPlaceProject/ProjectSettings/AudioManager.asset"
|
||||
- python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
|
||||
- unity-downloader-cli -u 2020.3.11f1 -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
|
||||
- git clone git@github.cds.internal.unity3d.com:unity/utr.git utr
|
||||
|
||||
# Explicitly run MessageGeneration tests first to generate dependencies
|
||||
- utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0
|
||||
--artifacts_path=test-results --suite=editor --platform=Editor --extra-editor-arg="-nographics"
|
||||
--category=MessageGeneration
|
||||
|
||||
- python3 .yamato/PickAndPlaceTests/set-up-integration-tests.py
|
||||
|
||||
# Run ROS Integration Tests
|
||||
# This step requires to execute set-up-integration-tests.py
|
||||
# TODO: move ROS_DISTRO exporting to image builder
|
||||
- |
|
||||
export ROS_DISTRO=$(ls -1 /opt/ros | head -n1)
|
||||
if [ $ROS_DISTRO == "noetic" ]; then
|
||||
ROS=ros1
|
||||
elif [ $ROS_DISTRO == "galactic" ]; then
|
||||
ROS=ros2
|
||||
fi
|
||||
|
||||
python3 .yamato/PickAndPlaceTests/set-up-ros-define.py $ROS
|
||||
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash build_ros $ROS
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash start_ros $ROS &
|
||||
export PID=$!
|
||||
sleep 10 # Wait for ROS endpoint to stand up
|
||||
|
||||
utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=editor --platform=Editor --extra-editor-arg="-nographics" --testfilter IntegrationTests.RosIntegrationTests.RosIntegration_Publisher_Success
|
||||
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash run_ros_position_service $ROS &
|
||||
export POSITION_SERVICE_PID=$!
|
||||
utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=editor --platform=Editor --extra-editor-arg="-nographics" --testfilter IntegrationTests.RosIntegrationTests.RosIntegration_ServiceClient_Success
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash stop $ROS $POSITION_SERVICE_PID
|
||||
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash run_ros_color_publisher $ROS &
|
||||
export COLOR_PUBLISHER_PID=$!
|
||||
utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=editor --platform=Editor --extra-editor-arg="-nographics" --testfilter IntegrationTests.RosIntegrationTests.RosIntegration_Subscriber_Success
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash stop $ROS $COLOR_PUBLISHER_PID
|
||||
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash run_ros_pose_service_client $ROS &
|
||||
export POSE_SERVICE_PID=$!
|
||||
utr/utr --testproject=./tutorials/pick_and_place/PickAndPlaceProject --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=editor --platform=Editor --extra-editor-arg="-nographics" --testfilter IntegrationTests.RosIntegrationTests.RosIntegration_ServiceServer_Success
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash stop $ROS $POSE_SERVICE_PID
|
||||
|
||||
/bin/bash .yamato/PickAndPlaceTests/ros.bash stop $ROS $PID
|
||||
|
||||
triggers:
|
||||
cancel_old_ci: true
|
||||
expression: |
|
||||
(pull_request.target in ["main", "dev"] AND
|
||||
NOT pull_request.changes.all match ["**/*.md","**/*.jpg","**/*.jpeg","**/*.gif","**/*.pdf"])
|
||||
OR (push.branch in ["main", "dev"])
|
||||
artifacts:
|
||||
logs:
|
||||
paths:
|
||||
- "test-results/**/*"
|
||||
{% endfor %}
|
||||
|
||||
|
|
33
CHANGELOG.md
33
CHANGELOG.md
|
@ -4,14 +4,9 @@ All notable changes to this repository will be documented in this file.
|
|||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## Unreleased
|
||||
|
||||
Fixed the ROS-Unity Integration tutorial `robo_demo.launch` to be up-to-date with file paths, and updated Pick-and-Place Part 2 ROS Settings screenshot.
|
||||
|
||||
Add the [Close Stale Issues](https://github.com/marketplace/actions/close-stale-issues) action
|
||||
|
||||
Updated Pick-and-Place scripts for style conformity, updated custom msg formats and made according script and tutorial changes.
|
||||
|
||||
### Upgrade Notes
|
||||
|
||||
### Known Issues
|
||||
|
@ -26,6 +21,32 @@ Updated Pick-and-Place scripts for style conformity, updated custom msg formats
|
|||
|
||||
### Fixed
|
||||
|
||||
|
||||
## v0.7.0
|
||||
|
||||
### Added
|
||||
|
||||
Added Sonarqube scanners.
|
||||
|
||||
### Changed
|
||||
|
||||
Updates to PickAndPlace dependencies. ROS-TCP-Connector v0.7.0, ROS-TCP-Endpoint v0.7.0, URDF-Importer v 0.5.2
|
||||
|
||||
Updated PickAndPlace project and tutorial part2 for documnentation and compilation fixes.
|
||||
|
||||
|
||||
## v0.6.0 2021-10-04
|
||||
|
||||
### Added
|
||||
|
||||
Fixed the ROS-Unity Integration tutorial `robo_demo.launch` to be up-to-date with file paths, and updated Pick-and-Place Part 2 ROS Settings screenshot.
|
||||
|
||||
Add the [Close Stale Issues](https://github.com/marketplace/actions/close-stale-issues) action
|
||||
|
||||
Updated Pick-and-Place scripts for style conformity, updated custom msg formats and made according script and tutorial changes.
|
||||
|
||||
### Fixed
|
||||
|
||||
Fixed dotnet format
|
||||
|
||||
Fixed Source Destination topic on the ROS side
|
||||
|
|
|
@ -74,26 +74,6 @@ The ROS workspace is now ready to accept commands!
|
|||
|
||||
1. If you have not already built and sourced the ROS workspace since importing the new ROS packages, navigate to your ROS workplace, and run `catkin_make && source devel/setup.bash`. Ensure there are no errors.
|
||||
|
||||
1. The ROS parameters will need to be set to your configuration in order to allow the server endpoint to fetch values for the TCP connection, stored in `src/niryo_moveit/config/params.yaml`. From your ROS workspace, assign the ROS IP in this `yaml` file:
|
||||
|
||||
```bash
|
||||
echo "ROS_IP: $(hostname -I)" > src/niryo_moveit/config/params.yaml
|
||||
```
|
||||
|
||||
> Note: You can also manually assign this value by navigating to the `params.yaml` file and opening it for editing.
|
||||
|
||||
```yaml
|
||||
ROS_IP: <your ROS IP>
|
||||
```
|
||||
|
||||
e.g.
|
||||
|
||||
```yaml
|
||||
ROS_IP: 192.168.50.149
|
||||
```
|
||||
|
||||
1. (Optional) By default, the server_endpoint will listen on port 10000, but this is also controlled by a parameter. If you need to change it, you can run the command `rosparam set ROS_TCP_PORT 10000`, replacing 10000 with the desired port number.
|
||||
|
||||
The ROS workspace is now ready to accept commands!
|
||||
|
||||
---
|
||||
|
@ -103,8 +83,6 @@ The ROS workspace is now ready to accept commands!
|
|||
|
||||
- `...failed because unknown error handler name 'rosmsg'` This is due to a bug in an outdated package version. Try running `sudo apt-get update && sudo apt-get upgrade` to upgrade packages.
|
||||
|
||||
- If the ROS TCP handshake fails (e.g. `ROS-Unity server listening...` printed on the Unity side but no `ROS-Unity Handshake received` on the ROS side), the ROS IP may not have been set correctly in the params.yaml file. Try running `echo "ROS_IP: $(hostname -I)" > src/niryo_moveit/config/params.yaml` in a terminal from your ROS workspace.
|
||||
|
||||
---
|
||||
|
||||
## Resources
|
||||
|
|
|
@ -81,7 +81,7 @@ To enable communication between Unity and ROS, a TCP endpoint running as a ROS n
|
|||
|
||||
1. In this repo, navigate to `Unity-Robotics-Hub/tutorials/pick_and_place`. Select and copy the `Scripts` folder and contents into the `Assets` folder of your Unity project. You should now find two C# scripts in your project's `Assets/Scripts`.
|
||||
|
||||
> Note: The SourceDestinationPublisher script is one of the included files. This script will communicate with ROS, grabbing the positions of the target and destination objects and sending it to the ROS Topic `"SourceDestination_input"`. The `Publish()` function is defined as follows:
|
||||
> Note: The SourceDestinationPublisher script is one of the included files. This script will communicate with ROS, grabbing the positions of the target and destination objects and sending it to the ROS Topic `"/niryo_joints"`. The `Publish()` function is defined as follows:
|
||||
|
||||
```csharp
|
||||
public void Publish()
|
||||
|
@ -108,11 +108,11 @@ To enable communication between Unity and ROS, a TCP endpoint running as a ROS n
|
|||
};
|
||||
|
||||
// Finally send the message to server_endpoint.py running in ROS
|
||||
m_Ros.Send(m_TopicName, sourceDestinationMessage);
|
||||
m_Ros.Publish(m_TopicName, sourceDestinationMessage);
|
||||
}
|
||||
```
|
||||
|
||||
> This function first takes in the current joint target values. Then, it grabs the poses of the `target` and the `targetPlacement` objects, adds them to the newly created message `sourceDestinationMessage`, and calls `Send()` to send this information to the ROS topic `topicName` (defined as `"SourceDestination_input"`).
|
||||
> This function first takes in the current joint target values. Then, it grabs the poses of the `m_Target` and the `m_TargetPlacement` objects, adds them to the newly created message `sourceDestinationMessage`, and calls `Send()` to send this information to the ROS topic `m_TopicName` (defined as `"/niryo_joints"`).
|
||||
|
||||
> Note: Going from Unity world space to ROS world space requires a conversion. Unity's coordinate space has x Right, y Up, and z Forward (hence "RUF" coordinates); ROS has x Forward, y Left and z Up (hence "FLU"). So a Unity `(x,y,z)` coordinate is equivalent to the ROS `(z,-x,y)` coordinate. These conversions are done by the `To<FLU>` function in the ROS-TCP-Connector package's [ROSGeometry component](https://github.com/Unity-Technologies/ROS-TCP-Connector/blob/main/ROSGeometry.md).
|
||||
|
||||
|
@ -174,14 +174,25 @@ Most of the ROS setup has been provided via the `niryo_moveit` package. This sec
|
|||
|
||||
> Note: Running `roslaunch` automatically starts [ROS Core](http://wiki.ros.org/roscore) if it is not already running.
|
||||
|
||||
> Note: This launch file has been copied below for reference. The server_endpoint and trajectory_subscriber nodes are launched from this file, and the ROS params (set up in [Part 0](0_ros_setup.md)) are loaded from this command. The launch files for this project are available in the package's `launch` directory, i.e. `src/niryo_moveit/launch/`.
|
||||
> Note: This launch file has been copied below for reference. The server_endpoint and trajectory_subscriber nodes are launched from this file. The launch files for this project are available in the package's `launch` directory, i.e. `src/niryo_moveit/launch/`.
|
||||
|
||||
```xml
|
||||
<launch>
|
||||
<rosparam file="$(find niryo_moveit)/config/params.yaml" command="load"/>
|
||||
<node name="server_endpoint" pkg="niryo_moveit" type="server_endpoint.py" args="--wait" output="screen" respawn="true" />
|
||||
<node name="trajectory_subscriber" pkg="niryo_moveit" type="trajectory_subscriber.py" args="--wait" output="screen"/>
|
||||
</launch>
|
||||
<launch>
|
||||
<arg name="tcp_ip" default="0.0.0.0"/>
|
||||
<arg name="tcp_port" default="10000"/>
|
||||
|
||||
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true">
|
||||
<param name="tcp_ip" type="string" value="$(arg tcp_ip)"/>
|
||||
<param name="tcp_port" type="int" value="$(arg tcp_port)"/>
|
||||
</node>
|
||||
<node name="trajectory_subscriber" pkg="niryo_moveit" type="trajectory_subscriber.py" args="--wait" output="screen"/>
|
||||
</launch>
|
||||
```
|
||||
|
||||
> Note: To use a port other than 10000, or if you want to listen on a more restrictive ip address than 0.0.0.0 (e.g. for security reasons), you can pass those arguments into the roslaunch command like this:
|
||||
|
||||
```bash
|
||||
roslaunch niryo_moveit part_2.launch tcp_ip:=127.0.0.1 tcp_port:=10005
|
||||
```
|
||||
|
||||
This launch will print various messages to the console, including the set parameters and the nodes launched.
|
||||
|
|
|
@ -170,6 +170,12 @@ def plan_trajectory(move_group, destination_pose, start_joint_angles):
|
|||
|
||||
> Note: This may print out various error messages such as `Failed to find 3D sensor plugin`. These messages are safe to ignore as long as the final message to the console is `You can start planning now!`.
|
||||
|
||||
> Note: As with part 2, you can configure this launch file with a custom IP address or port:
|
||||
```bash
|
||||
roslaunch niryo_moveit part_3.launch tcp_ip:=127.0.0.1 tcp_port:=10005
|
||||
```
|
||||
|
||||
|
||||
1. Return to the Unity Editor and press Play. Press the UI Button to send the joint configurations to ROS, and watch the robot arm pick up and place the cube!
|
||||
- The target object and placement positions can be moved around during runtime for different trajectory calculations.
|
||||
|
||||
|
|
|
@ -337,16 +337,19 @@ void Start()
|
|||
## Add niryo_moveit Package
|
||||
The Niryo One ROS stack is already installed on the robot and only the `niryo_moveit` package will need to be added.
|
||||
|
||||
1. Update the `niryo_moveit/config/params.yml` file's `ROS_IP` parameter to match that of the Niryo One.
|
||||
|
||||
1. Copy the `niryo_moveit` package to the `catkin_ws` directory on the Niryo One's catkin workspace at `/home/niryo/catkin_ws` and run the `catkin_make` command.
|
||||
|
||||
> Using the SCP command to transfer the `niryo_moveit` package might look something like, `scp -r ~/PATH/TO/niryo_moveit niryo@NIRYO_IP_ADDRESS:/home/niryo/catkin_ws/src`
|
||||
|
||||
# Execution
|
||||
1. Use the `part_4.launch` file to setup the ROS params and start the `server_endpoint` and `sim_real_pnp` scripts.
|
||||
1. Use the `part_4.launch` file to start the `server_endpoint` and `sim_real_pnp` scripts.
|
||||
- `roslaunch niryo_moveit part_4.launch`
|
||||
|
||||
> Note: As with previous parts, you can configure this launch file with a custom IP address or port:
|
||||
```bash
|
||||
roslaunch niryo_moveit part_4.launch tcp_ip:=127.0.0.1 tcp_port:=10005
|
||||
```
|
||||
|
||||
1. Return to the Unity Editor and press Play. Press the UI Button to send the joint configurations to ROS on the Niryo One, and watch the robot arm move simultaneously in simulation and real life!
|
||||
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ public class Demo : MonoBehaviour
|
|||
{
|
||||
var urdfImportSettings = new ImportSettings
|
||||
{
|
||||
choosenAxis = ImportSettings.axisType.yAxis,
|
||||
chosenAxis = ImportSettings.axisType.yAxis,
|
||||
convexMethod = ImportSettings.convexDecomposer.unity
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
"name": "Unity.Robotics.RosMessages",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:625bfc588fb96c74696858f2c467e978"
|
||||
"Unity.Robotics.ROSTCPConnector",
|
||||
"Unity.Robotics.ROSTCPConnector.MessageGeneration",
|
||||
"Unity.Robotics.ROSTCPConnector.Messages"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
"name": "Unity.Robotics.PickAndPlace",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:204b12c73a0ba074c888ec09a2713605",
|
||||
"GUID:625bfc588fb96c74696858f2c467e978",
|
||||
"GUID:b1ef917f7a8a86a4eb639ec2352edbf8"
|
||||
"Unity.Robotics.RosMessages",
|
||||
"Unity.Robotics.ROSTCPConnector",
|
||||
"Unity.Robotics.UrdfImporter",
|
||||
"Unity.Robotics.ROSTCPConnector.MessageGeneration",
|
||||
"Unity.Robotics.ROSTCPConnector.Messages"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
"name": "EditMode",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:27619889b8ba8c24980f49ee34dbb44a",
|
||||
"GUID:0acc523941302664db1f4e527237feb3",
|
||||
"GUID:1da8e23352f14494396eac5033ba9894",
|
||||
"GUID:625bfc588fb96c74696858f2c467e978",
|
||||
"GUID:204b12c73a0ba074c888ec09a2713605",
|
||||
"GUID:465c1207fffb96245a352265e7622205",
|
||||
"GUID:b1ef917f7a8a86a4eb639ec2352edbf8",
|
||||
"GUID:79169c04a5f9b014e919b69ac8df4286"
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner",
|
||||
"Unity.Robotics.ROSTCPConnector.Editor",
|
||||
"Unity.Robotics.ROSTCPConnector",
|
||||
"Unity.Robotics.RosMessages",
|
||||
"Unity.Robotics.UrdfImporter.Editor",
|
||||
"Unity.Robotics.UrdfImporter",
|
||||
"Unity.Robotics.PickAndPlace"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
|
|
|
@ -19,7 +19,8 @@ namespace MessageGenerationTests
|
|||
}
|
||||
|
||||
// Relative path to the directory containing the catkin packages
|
||||
static readonly string k_ROSDirectory = Path.GetFullPath(Path.Combine("..", "ROS", "src"));
|
||||
static readonly string k_PickAndPlaceROSDirectory = Path.GetFullPath(Path.Combine("..", "ROS", "src"));
|
||||
static readonly string k_ROSIntegrationDirectory = Path.GetFullPath(Path.Combine("..", "..", "ros_unity_integration", "ros_packages"));
|
||||
static string m_MessageGenOutputPath => MessageGenBrowserSettings.Get().outputPath;
|
||||
|
||||
static void WarnIfAlreadyExists(string path, PathType pathType)
|
||||
|
@ -40,19 +41,21 @@ namespace MessageGenerationTests
|
|||
// Define more individual messages to run generation on within this test case enumerable
|
||||
static IEnumerable<TestCaseData> IndividualMessages()
|
||||
{
|
||||
yield return new TestCaseData(Path.Combine(k_ROSDirectory, "moveit_msgs", "msg", "RobotTrajectory.msg"));
|
||||
yield return new TestCaseData(Path.Combine(k_PickAndPlaceROSDirectory, "moveit_msgs", "msg", "RobotTrajectory.msg"));
|
||||
}
|
||||
|
||||
// Define directories of message files to be generated here
|
||||
static IEnumerable<TestCaseData> MessageDirectories()
|
||||
{
|
||||
yield return new TestCaseData(Path.Combine(k_ROSDirectory, "niryo_moveit", "msg"));
|
||||
yield return new TestCaseData(Path.Combine(k_PickAndPlaceROSDirectory, "niryo_moveit", "msg"));
|
||||
yield return new TestCaseData(Path.Combine(k_ROSIntegrationDirectory, "unity_robotics_demo_msgs", "msg"));
|
||||
}
|
||||
|
||||
// Define directories of service files to be generated here
|
||||
static IEnumerable<TestCaseData> ServiceDirectories()
|
||||
{
|
||||
yield return new TestCaseData(Path.Combine(k_ROSDirectory, "niryo_moveit", "srv"));
|
||||
yield return new TestCaseData(Path.Combine(k_PickAndPlaceROSDirectory, "niryo_moveit", "srv"));
|
||||
yield return new TestCaseData(Path.Combine(k_ROSIntegrationDirectory, "unity_robotics_demo_msgs", "srv"));
|
||||
}
|
||||
|
||||
[Test]
|
|
@ -16,7 +16,7 @@ namespace IntegrationTests
|
|||
[TestFixture, Explicit, Category("IntegrationTests")]
|
||||
// IMPORTANT: In order for this category of tests to run correctly, MessageGeneration must be run first and the
|
||||
// INTEGRATION_TEST script define must be set
|
||||
public class RosIntegrationTests
|
||||
public class PickAndPlaceIntegrationTests
|
||||
{
|
||||
#region Parameters
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace IntegrationTests
|
|||
|
||||
readonly ImportSettings k_UrdfImportSettings = new ImportSettings
|
||||
{
|
||||
choosenAxis = ImportSettings.axisType.yAxis,
|
||||
chosenAxis = ImportSettings.axisType.yAxis,
|
||||
convexMethod = ImportSettings.convexDecomposer.unity
|
||||
};
|
||||
#endregion
|
|
@ -0,0 +1,133 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using NUnit.Framework;
|
||||
using Unity.Robotics.ROSTCPConnector;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace IntegrationTests
|
||||
{
|
||||
[TestFixture, Explicit, Category("IntegrationTests")]
|
||||
// IMPORTANT: In order for this category of tests to run correctly, MessageGeneration must be run first and the
|
||||
// INTEGRATION_TEST script define must be set
|
||||
public class RosIntegrationTests
|
||||
{
|
||||
GameObject m_Cube;
|
||||
ROSConnection m_Ros;
|
||||
|
||||
const float k_SimulationTime = 5f;
|
||||
const float k_SimulationTimeout = 60f;
|
||||
const string k_RosProtocolVariableName = "ROS_PROTOCOL";
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
m_Cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
m_Ros = ROSConnection.GetOrCreateInstance();
|
||||
m_Ros.listenForTFMessages = false;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator RosIntegration_Publisher_Success()
|
||||
{
|
||||
#if INTEGRATION_TEST
|
||||
m_Cube.AddComponent<RosPublisherExample>().cube = m_Cube;
|
||||
yield return new EnterPlayMode();
|
||||
while (Time.time < k_SimulationTime)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
yield return new ExitPlayMode();
|
||||
LogAssert.NoUnexpectedReceived();
|
||||
Object.DestroyImmediate(Object.FindObjectOfType<RosPublisherExample>().gameObject);
|
||||
#else
|
||||
ThrowNotImplementedException();
|
||||
yield return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator RosIntegration_Subscriber_Success()
|
||||
{
|
||||
#if INTEGRATION_TEST
|
||||
m_Cube.AddComponent<RosSubscriberExample>().cube = m_Cube;
|
||||
yield return new EnterPlayMode();
|
||||
|
||||
// Avoid cross-validation from other ros services (e.g. ROS service server test)
|
||||
LogAssert.ignoreFailingMessages = true;
|
||||
|
||||
var subscriber = Object.FindObjectOfType<RosSubscriberExample>();
|
||||
var color = subscriber.GetComponent<Renderer>().material.color;
|
||||
while (Time.time < k_SimulationTimeout && subscriber.GetComponent<Renderer>().material.color.Equals(color))
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
Assert.AreNotEqual(color, subscriber.GetComponent<Renderer>().material.color);
|
||||
LogAssert.ignoreFailingMessages = false;
|
||||
yield return new ExitPlayMode();
|
||||
Object.DestroyImmediate(Object.FindObjectOfType<RosSubscriberExample>().gameObject);
|
||||
#else
|
||||
ThrowNotImplementedException();
|
||||
yield return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator RosIntegration_ServiceServer_Success()
|
||||
{
|
||||
#if INTEGRATION_TEST
|
||||
m_Cube.AddComponent<RosUnityServiceExample>();
|
||||
yield return new EnterPlayMode();
|
||||
while (Time.time < k_SimulationTimeout)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
LogAssert.Expect(LogType.Log, new Regex(@"^Received request for object: .*$"));
|
||||
yield return new ExitPlayMode();
|
||||
Object.DestroyImmediate(Object.FindObjectOfType<RosUnityServiceExample>().gameObject);
|
||||
#else
|
||||
ThrowNotImplementedException();
|
||||
yield return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator RosIntegration_ServiceClient_Success()
|
||||
{
|
||||
#if INTEGRATION_TEST
|
||||
m_Cube.AddComponent<RosServiceCallExample>().cube = m_Cube;
|
||||
yield return new EnterPlayMode();
|
||||
while (Time.time < k_SimulationTime)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
LogAssert.Expect(LogType.Log, "Destination reached.");
|
||||
LogAssert.Expect(LogType.Log, new Regex(@"^New Destination: .*$"));
|
||||
yield return new ExitPlayMode();
|
||||
Object.DestroyImmediate(Object.FindObjectOfType<RosServiceCallExample>().gameObject);
|
||||
#else
|
||||
ThrowNotImplementedException();
|
||||
yield return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Object.DestroyImmediate(m_Cube);
|
||||
Object.DestroyImmediate(m_Ros);
|
||||
}
|
||||
|
||||
void ThrowNotImplementedException()
|
||||
{
|
||||
throw new NotImplementedException(
|
||||
"This integration test can only be executed with the INTEGRATION_TEST scripting define set. " +
|
||||
"The dependencies of this test are not guaranteed to exist in the Project by default.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 71bb8bee185194097ab364212120b9b3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -4,7 +4,7 @@
|
|||
"references": [
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner",
|
||||
"Unity.Robotics.URDFImporter",
|
||||
"Unity.Robotics.UrdfImporter",
|
||||
"Unity.Robotics.ROSTCPConnector",
|
||||
"Unity.Robotics.RosMessages",
|
||||
"Unity.Robotics.PickAndPlace"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"com.unity.ide.rider": "2.0.7",
|
||||
"com.unity.ide.visualstudio": "2.0.8",
|
||||
"com.unity.ide.vscode": "1.2.3",
|
||||
"com.unity.robotics.ros-tcp-connector": "https://github.com/Unity-Technologies/ROS-TCP-Connector.git?path=/com.unity.robotics.ros-tcp-connector#v0.6.0",
|
||||
"com.unity.robotics.urdf-importer": "https://github.com/Unity-Technologies/URDF-Importer.git?path=/com.unity.robotics.urdf-importer#v0.5.0",
|
||||
"com.unity.robotics.ros-tcp-connector": "https://github.com/Unity-Technologies/ROS-TCP-Connector.git?path=/com.unity.robotics.ros-tcp-connector#v0.7.0",
|
||||
"com.unity.robotics.urdf-importer": "https://github.com/Unity-Technologies/URDF-Importer.git?path=/com.unity.robotics.urdf-importer#v0.5.2",
|
||||
"com.unity.test-framework": "1.1.24",
|
||||
"com.unity.textmeshpro": "3.0.6",
|
||||
"com.unity.timeline": "1.4.8",
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
<launch>
|
||||
<rosparam file="$(find niryo_moveit)/config/params.yaml" command="load"/>
|
||||
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true" />
|
||||
<arg name="tcp_ip" default="0.0.0.0"/>
|
||||
<arg name="tcp_port" default="10000"/>
|
||||
|
||||
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true">
|
||||
<param name="tcp_ip" type="string" value="$(arg tcp_ip)"/>
|
||||
<param name="tcp_port" type="int" value="$(arg tcp_port)"/>
|
||||
</node>
|
||||
<node name="trajectory_subscriber" pkg="niryo_moveit" type="trajectory_subscriber.py" args="--wait" output="screen"/>
|
||||
</launch>
|
|
@ -1,6 +1,11 @@
|
|||
<launch>
|
||||
<rosparam file="$(find niryo_moveit)/config/params.yaml" command="load"/>
|
||||
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true" />
|
||||
<arg name="tcp_ip" default="0.0.0.0"/>
|
||||
<arg name="tcp_port" default="10000"/>
|
||||
|
||||
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true">
|
||||
<param name="tcp_ip" type="string" value="$(arg tcp_ip)"/>
|
||||
<param name="tcp_port" type="int" value="$(arg tcp_port)"/>
|
||||
</node>
|
||||
<node name="mover" pkg="niryo_moveit" type="mover.py" args="--wait" output="screen"/>
|
||||
<include file="$(find niryo_moveit)/launch/demo.launch" />
|
||||
</launch>
|
|
@ -1,5 +1,10 @@
|
|||
<launch>
|
||||
<rosparam file="$(find niryo_moveit)/config/params.yaml" command="load"/>
|
||||
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true" />
|
||||
<arg name="tcp_ip" default="0.0.0.0"/>
|
||||
<arg name="tcp_port" default="10000"/>
|
||||
|
||||
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true">
|
||||
<param name="tcp_ip" type="string" value="$(arg tcp_ip)"/>
|
||||
<param name="tcp_port" type="int" value="$(arg tcp_port)"/>
|
||||
</node>
|
||||
<node name="sim_real_pnp" pkg="niryo_moveit" type="sim_real_pnp.py" args="--wait" output="screen"/>
|
||||
</launch>
|
|
@ -1 +1 @@
|
|||
Subproject commit 715a402ec09ce8095faabed915e3371638b4246a
|
||||
Subproject commit 993d366b8900bf9f3d2da444fde64c0379b4dc7c
|
|
@ -1,6 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /opt/ros/melodic/setup.bash
|
||||
echo "ROS_IP: $(hostname -i)" > $ROS_WORKSPACE/src/ros-tcp-endpoint/config/params.yaml
|
||||
cd $ROS_WORKSPACE
|
||||
catkin_make
|
||||
|
|
Двоичные данные
tutorials/pick_and_place/img/2_sourcedest.gif
Двоичные данные
tutorials/pick_and_place/img/2_sourcedest.gif
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 247 KiB После Ширина: | Высота: | Размер: 234 KiB |
Двоичные данные
tutorials/pick_and_place/img/2_target.gif
Двоичные данные
tutorials/pick_and_place/img/2_target.gif
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 472 KiB После Ширина: | Высота: | Размер: 700 KiB |
|
@ -7,7 +7,7 @@ RUN mkdir -p /home/dev_ws/src
|
|||
COPY ./ros2_packages/ /home/dev_ws/src
|
||||
|
||||
#Check out ROS-TCP-Endpoint, ROS2 version
|
||||
RUN git clone https://github.com/Unity-Technologies/ROS-TCP-Endpoint /home/dev_ws/src/ros_tcp_endpoint -b ROS2v0.6.0
|
||||
RUN git clone https://github.com/Unity-Technologies/ROS-TCP-Endpoint /home/dev_ws/src/ros_tcp_endpoint -b ROS2v0.7.0
|
||||
|
||||
# Reference script with commands to source workspace
|
||||
COPY ./ros2_docker/source_ros.sh /home/dev_ws/source_ros.sh
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /opt/ros/foxy/setup.bash
|
||||
source /opt/ros/$ROS_DISTRO/setup.bash
|
||||
. install/local_setup.bash
|
||||
ros2 launch ros2_test test_launcher.py
|
||||
|
|
|
@ -5,7 +5,7 @@ ENV ROS_WORKSPACE=/catkin_ws
|
|||
# Copy packages
|
||||
COPY ./ros_packages/ $ROS_WORKSPACE/src/
|
||||
|
||||
RUN git clone https://github.com/Unity-Technologies/ROS-TCP-Endpoint $ROS_WORKSPACE/src/ros_tcp_endpoint -b v0.6.0
|
||||
RUN git clone https://github.com/Unity-Technologies/ROS-TCP-Endpoint $ROS_WORKSPACE/src/ros_tcp_endpoint -b v0.7.0
|
||||
|
||||
COPY ./ros_docker/set-up-workspace /setup.sh
|
||||
#COPY docker/tutorial /
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /opt/ros/melodic/setup.bash
|
||||
echo "ROS_IP: 0.0.0.0" > $ROS_WORKSPACE/src/ros_tcp_endpoint/config/params.yaml
|
||||
source /opt/ros/$ROS_DISTRO/setup.bash
|
||||
cd $ROS_WORKSPACE
|
||||
catkin_make
|
|
@ -24,38 +24,12 @@ Follow these steps to use ROS (melodic or noetic):
|
|||
|
||||
```bash
|
||||
source devel/setup.bash
|
||||
roscore
|
||||
```
|
||||
|
||||
Once ROS Core has started, it will print `started core service [/rosout]` to the terminal window.
|
||||
|
||||
3. In your previous terminal, run the following command, replacing the `<your IP address>` with your ROS machine's IP or hostname.
|
||||
|
||||
```bash
|
||||
rosparam set ROS_IP <your IP address>
|
||||
```
|
||||
|
||||
- If you're running ROS in a Docker container, you can just use `rosparam set ROS_IP 0.0.0.0`
|
||||
- On Linux you can find out your IP address with the command `hostname -I`
|
||||
- On MacOS you can find out your IP address with `ipconfig getifaddr en0`
|
||||
|
||||
6. (Optional) By default, the server_endpoint will listen on port 10000, but this is also controlled by a parameter. If you need to change it, you can run the command `rosparam set ROS_TCP_PORT 10000`, replacing 10000 with the desired port number.
|
||||
|
||||
7. Start the server endpoint with the following command:
|
||||
|
||||
```bash
|
||||
rosrun ros_tcp_endpoint default_server_endpoint.py
|
||||
roslaunch ros_tcp_endpoint endpoint.launch
|
||||
```
|
||||
|
||||
Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`.
|
||||
|
||||
> Note, for this tutorial we have illustrated how to do everything manually, but for day-to-day use, we recommend starting the endpoint with a launch file. Replace all the above (including the roscore step) with the following command: `roslaunch ros_tcp_endpoint endpoint.launch`.
|
||||
> While using this launch file, your ROS_IP and ROS_TCP_PORT parameters are read from the file src/ros_tcp_endpoint/config/params.yaml. You can edit this file to adjust your settings - for example, this command will set the appropriate IP address for your machine:
|
||||
> `echo "ROS_IP: $(hostname -i)" > src/ros-tcp-endpoint/config/params.yaml`
|
||||
|
||||
> Read more about rosparam YAML options [here](http://wiki.ros.org/rosparam).
|
||||
>
|
||||
> Read more about the ROS Parameter Server [here](http://wiki.ros.org/Parameter%20Server).
|
||||
> Note, By default, the server_endpoint will listen on ip 0.0.0.0 (i.e. allowing all incoming addresses) and port 10000, but these settings are configurable. To override them, you can change the command to `roslaunch ros_tcp_endpoint endpoint.launch tcp_ip:=127.0.0.1 tcp_port:=10000` (obviously replacing 127.0.0.1 with your desired IP and 10000 with your desired port number.)
|
||||
|
||||
## <img src="images/ros2_icon.png" alt="ros2" width="46" height="28"/> ROS2 Environment
|
||||
|
||||
|
@ -71,7 +45,7 @@ Follow these steps if using ROS2:
|
|||
|
||||
This should build a docker image and start it.
|
||||
|
||||
b) Alternatively, if you're not going to use the Docker image, download the [ROS2 branch of the ROS-TCP-Endpoint](https://github.com/Unity-Technologies/ROS-TCP-Endpoint/tree/ROS2) repository and copy it into the `src` folder in your Colcon workspace. Then navigate to your Colcon workspace and run the following commands:
|
||||
b) Alternatively, if you're not going to use the Docker image, download the [ROS2 branch of the ROS-TCP-Endpoint](https://github.com/Unity-Technologies/ROS-TCP-Endpoint/tree/main-ros2) repository and copy it into the `src` folder in your Colcon workspace. Then navigate to your Colcon workspace and run the following commands:
|
||||
|
||||
```bash
|
||||
source install/setup.bash
|
||||
|
|
Загрузка…
Ссылка в новой задаче