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 2, 2022
2 parents 7f05510 + 84fe88f commit c27f00c
Show file tree
Hide file tree
Showing 84 changed files with 1,715 additions and 235 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
32 changes: 32 additions & 0 deletions .yamato/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Sonarqube Scan
agent:
type: Unity::metal::macmini
image: package-ci/mac
flavor: m1.mac
variables:
PROJECT_PATH: TestRosTcpConnector
SONARQUBE_PROJECT_KEY: ai-robotics-ros-tcp-connector
SONARQUBE_PROJECT_BASE_DIR: /Users/bokken/build/output/Unity-Technologies/ROS-TCP-Connector/com.unity.robotics.ros-tcp-connector
MSBUILD_SLN_PATH: ./TestRosTcpConnector/TestRosTcpConnector.sln
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 ~
- chmod a+x ~/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 ../
- mono ~/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 ~/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")
15 changes: 9 additions & 6 deletions .yamato/yamato-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@ agent:
image: robotics/ci-ubuntu20:v0.1.0-795910
flavor: i1.large
variables:
# Coverage is defined in a percentage (out of 100)
COVERAGE_EXPECTED: 2.5
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:
- 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.2.0b9 -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
- git clone [email protected]:unity/utr.git utr
- utr/utr --testproject=./TestRosTcpConnector --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=playmode --suite=editor --platform=Editor --enable-code-coverage --coverage-results-path=../test-results --coverage-options="assemblyFilters:+Unity.Robotics.ROSTCPConnector,+Unity.Robotics.ROSTCPConnector.Editor;generateHtmlReport;generateBadgeReport;generateAdditionalMetrics"
- utr/utr --testproject=./TestRosTcpConnector --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=playmode --suite=editor --platform=Editor --enable-code-coverage --coverage-results-path=../test-results --coverage-options="assemblyFilters:+Unity.Robotics.ROSTCPConnector,+Unity.Robotics.ROSTCPConnector.Editor,+Unity.Robotics.ROSTCPConnector.MessageGeneration;generateHtmlReport;generateBadgeReport;generateAdditionalMetrics"
# check test coverage
- command: |
linecoverage=$(cat test-results/Report/Summary.xml | grep Linecoverage | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')
echo "Line coverage: $linecoverage%"
if (( $(echo "$linecoverage < 0" | bc -l) )); then exit 1; fi
if (( $(echo "$linecoverage < $COVERAGE_EXPECTED" | bc -l) ))
then echo "ERROR: Code coverage is under threshold of $COVERAGE_EXPECTED%" && exit 1
fi
triggers:
cancel_old_ci: true
expression: |
(pull_request.target eq "main" AND
NOT pull_request.push.changes.all match "**/*.md") OR
(pull_request.target eq "dev" AND
NOT pull_request.push.changes.all match "**/*.md")
((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")
artifacts:
logs:
paths:
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

[![Version](https://img.shields.io/github/v/tag/Unity-Technologies/ROS-TCP-Connector)](https://github.com/Unity-Technologies/ROS-TCP-Connector/releases)
[![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE.md)
![ROS](https://img.shields.io/badge/ros-melodic-brightgreen)
![ROS](https://img.shields.io/badge/ros-noetic-brightgreen)
![ROS](https://img.shields.io/badge/ros2-foxy-brightgreen)
![ROS](https://img.shields.io/badge/ros-melodic,noetic-brightgreen)
![ROS](https://img.shields.io/badge/ros2-foxy,galactic-brightgreen)
![Unity](https://img.shields.io/badge/unity-2020.2+-brightgreen)

---

We're currently working on lots of things! Please take a short moment fill out our [survey](https://unitysoftware.co1.qualtrics.com/jfe/form/SV_0ojVkDVW0nNrHkW) to help us identify what products and packages to build next.

---

## Introduction

This repository contains two Unity packages: the ROS TCP Connector, for sending/receiving messages from ROS, and the Visualizations Package, for adding visualizations of incoming and outgoing messages in the Unity scene.
Expand Down
10 changes: 10 additions & 0 deletions ROSGeometry.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,13 @@ Or, if you need to work with it in the FLU coordinate space for now, you can wri
(Note, the As function does NOT do any coordinate conversion. It simply assumes the point is in the FLU coordinate frame already, and transfers it into an appropriate container.)

And again, the same goes for converting a Quaternion message into a Unity Quaternion or `Quaternion<C>`.

# Geographical Coordinates

The geographical coordinate systems NED and ENU are more complicated than the rest: besides the obvious "north" direction, they also provide a convention for which direction is "forward", which is not even consistent between them - In NED, forward (i.e. yaw 0) is north, whereas in ENU forward is east. Because of this inconsistency, there's no universal convention that we could establish for which direction is north in Unity. Instead, we're forced to make a distinction between local and world rotations.

To correctly convert a *world* position or rotation to or from NED or ENU coordinates, you should use the standard NED or ENU coordinate space - for example, `To<NED>()`. This conversion will respect what direction you have set as North. By default, the Unity Z axis points north, but this is a configuration option that you can change in the Robotics/ROS Settings menu.

If you have a *local* rotation represented in NED or ENU coordinates, you should convert it using the coordinate space NEDLocal or ENULocal: for example, `To<NEDLocal>()`. These conversions are not appropriate for handling world rotations, because they don't respect the north direction, only what direction is forward (i.e. the Unity Z axis). In other words, with NEDLocal and ENULocal, an identity quaternion is still identity. This is not necessarily true for NED or ENU. NEDLocal is a synonym for the FRD coordinate space (north = forward, east = right, down = down) and ENULocal is a synonym for the FLU coordinate space (east = forward, north = left, up = up).

If you only care about NED coordinates, you can avoid having to deal with this distinction by setting the Z axis direction to North (the default) - this will make the NED coordinate space equal to NEDLocal. Similarly, if you only care about ENU coordinates, setting the Z axis direction to East will make ENU equal to ENULocal.
1 change: 1 addition & 0 deletions TestRosTcpConnector/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/[Bb]uild.app/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
/[Cc]ode[Cc]overage/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions TestRosTcpConnector/Assets/Resources/GeometryCompassSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6ad8cf01110e54df290b36a418e91285, type: 3}
m_Name: GeometryCompassSettings
m_EditorClassIdentifier:
m_ZAxisDirection: 3

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions TestRosTcpConnector/Assets/Settings/ForwardRenderer.asset
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ MonoBehaviour:
copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3}
screenSpaceShadowPS: {fileID: 4800000, guid: 0f854b35a0cf61a429bd5dcfea30eddd, type: 3}
samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3}
tileDepthInfoPS: {fileID: 0}
tileDeferredPS: {fileID: 0}
stencilDeferredPS: {fileID: 4800000, guid: e9155b26e1bc55942a41e518703fe304, type: 3}
fallbackErrorPS: {fileID: 4800000, guid: e6e9a19c3678ded42a3bc431ebef7dbd, type: 3}
materialErrorPS: {fileID: 4800000, guid: 5fd9a8feb75a4b5894c241777f519d4e, type: 3}
m_OpaqueLayerMask:
serializedVersion: 2
m_Bits: 4294967295
Expand All @@ -36,3 +40,5 @@ MonoBehaviour:
failOperation: 0
zFailOperation: 0
m_ShadowTransparentReceive: 1
m_RenderingMode: 0
m_AccurateGbufferNormals: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"m_Name": "Settings",
"m_Path": "ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json",
"m_Dictionary": {
"m_DictionaryValues": [
{
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "Path",
"value": "{\"m_Value\":\"{ProjectPath}\"}"
},
{
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "HistoryPath",
"value": "{\"m_Value\":\"{ProjectPath}\"}"
},
{
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "IncludeAssemblies",
"value": "{\"m_Value\":\"Unity.Robotics.ROSTCPConnector,Unity.Robotics.ROSTCPConnector.Editor,Unity.Robotics.ROSTCPConnector.MessageGeneration\"}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "EnableCodeCoverage",
"value": "{\"m_Value\":true}"
}
]
}
}
32 changes: 32 additions & 0 deletions com.unity.robotics.ros-tcp-connector/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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

### Upgrade Notes
Expand All @@ -21,6 +22,35 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
### Fixed


## [0.7.0-preview] - 2022-02-01

### Added

Added "Listen for TF Messages" to Settings

Enabled Android and IOS builds

Added Sonarqube scanner

Added more tests

Add support for cloud rendering

Added MessagePool<T> to enable message reuse and reduce garbage collection

Can configure what direction is "north" for NED and ENU coordinates

### Changed

CameraInfo.msg field names are different in ROS2

Bug fix - cope with tab character in a .msg file

Bug fix - no padding when serializing an empty array

Can publish messages from threads other than main


## [0.6.0-preview] - 2021-09-30

Add the [Close Stale Issues](https://github.com/marketplace/actions/close-stale-issues) action
Expand Down Expand Up @@ -49,6 +79,8 @@ Upgrade the TestRosTcpConnector project to use Unity LTS version 2020.3.11f1

- Unity service implementations can be async

- Added geographical world coordinate transformation by a Compass component

### Changed
- Publishing a message to an unregistered topic will show an error.
- Registering a service now requires both the request and response message type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ public void WrapActionSections(string type)

writer.Write(GenerateSerializationStatements(type));

// Omit the subtype because subtype is baked into the class name
writer.Write(MsgAutoGenUtilities.InitializeOnLoad());

// Close class
writer.Write(ONE_TAB + "}\n");
// Close namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,10 @@ public void Parse()
// Write ToString override
writer.Write(GenerateToString());

string subtopicParameter = subtopic == MessageSubtopic.Default ? "" : $", MessageSubtopic.{subtopic}";
var subtopicParameter =
subtopic == MessageSubtopic.Default ? "" : $", MessageSubtopic.{subtopic}";

writer.Write(
"\n" +
"#if UNITY_EDITOR\n" +
TWO_TABS + "[UnityEditor.InitializeOnLoadMethod]\n" +
"#else\n" +
TWO_TABS + "[UnityEngine.RuntimeInitializeOnLoadMethod]\n" +
"#endif\n" +
TWO_TABS + "public static void Register()\n" +
TWO_TABS + "{\n" +
THREE_TABS + $"MessageRegistry.Register(k_RosMessageName, Deserialize{subtopicParameter});\n" +
TWO_TABS + "}\n"
);
writer.Write(InitializeOnLoad(subtopicParameter));

// Close class
writer.Write(MsgAutoGenUtilities.ONE_TAB + "}\n");
Expand Down Expand Up @@ -319,7 +309,7 @@ private void Declaration()
// Check if identifier is a ROS message built-in type
if (builtInTypeMapping.ContainsKey(identifier))
{
throw new MessageParserException(
Debug.LogWarning(
"Invalid field identifier '" + identifier +
"' at " + inFilePath + ":" + lineNum +
". '" + identifier + "' is a ROS message built-in type.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private MessageToken NextTypeIdentifierToken()
}

// Otherwise, consume input until seperator, EOF or '['
while (reader.Peek() != ' ' && reader.Peek() != '[' && !reader.EndOfStream)
while (reader.Peek() != ' ' && reader.Peek() != '[' && reader.Peek() != '\t' && !reader.EndOfStream)
{
if (!Char.IsLetterOrDigit((char)reader.Peek()) && !allowedSpecialCharacterForTypeIdentifier.Contains((char)reader.Peek()))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,17 @@ public class MsgAutoGenUtilities

public static bool HasHandwrittenMessage(string rosPackageName, string inFileName)
{
if (!rosPackageName.Equals("std_msgs"))
return false;

return inFileName.Equals("Time") || inFileName.Equals("Duration") || inFileName.Equals("Header");
switch (inFileName)
{
case "Header":
case "Time":
case "Duration":
return rosPackageName == "std_msgs";
case "CameraInfo":
return rosPackageName == "sensor_msgs";
default:
return false;
}
}

public static string CapitalizeFirstLetter(string s)
Expand All @@ -129,6 +136,7 @@ public static string PascalCase(string s)

public static string ResolvePackageName(string s)
{
s = s.Replace('-', '_');
if (s.Contains("_msgs") || s.Contains("_srvs") || s.Contains("_actions"))
{
return PascalCase(s.Substring(0, s.LastIndexOf('_')));
Expand All @@ -139,5 +147,19 @@ public static string ResolvePackageName(string s)
}
return CapitalizeFirstLetter(s);
}

public static string InitializeOnLoad(string subtopicArgument = "")
{
return "\n" +
"#if UNITY_EDITOR\n" +
TWO_TABS + "[UnityEditor.InitializeOnLoadMethod]\n" +
"#else\n" +
TWO_TABS + "[UnityEngine.RuntimeInitializeOnLoadMethod]\n" +
"#endif\n" +
TWO_TABS + "public static void Register()\n" +
TWO_TABS + "{\n" +
THREE_TABS + $"MessageRegistry.Register(k_RosMessageName, Deserialize{subtopicArgument});\n" +
TWO_TABS + "}\n";
}
}
}
Loading

0 comments on commit c27f00c

Please sign in to comment.