Skip to content

Commit

Permalink
Release 0.7.0
Browse files Browse the repository at this point in the history
AIRO-1696
  • Loading branch information
hyounesy authored Feb 3, 2022
2 parents d324209 + e1bf935 commit a72ef3a
Show file tree
Hide file tree
Showing 37 changed files with 677 additions and 154 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/jira-link.yaml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .github/workflows/snyk.yaml
Original file line number Diff line number Diff line change
@@ -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
146 changes: 146 additions & 0 deletions .yamato/PickAndPlaceTests/ros.bash
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .yamato/PickAndPlaceTests/set-up-integration-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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"))
Expand All @@ -26,6 +27,13 @@
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}:")
Expand Down
29 changes: 29 additions & 0 deletions .yamato/PickAndPlaceTests/set-up-ros-define.py
Original file line number Diff line number Diff line change
@@ -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)

11 changes: 0 additions & 11 deletions .yamato/PickAndPlaceTests/start-ros.bash

This file was deleted.

52 changes: 52 additions & 0 deletions .yamato/sonar.yml
Original file line number Diff line number Diff line change
@@ -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")
Loading

0 comments on commit a72ef3a

Please sign in to comment.