Skip to content

Commit 7f05510

Browse files
Merge pull request #197 from Unity-Technologies/dev
Version 0.6.0
2 parents f7f669f + 8f443da commit 7f05510

File tree

454 files changed

+20496
-580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

454 files changed

+20496
-580
lines changed

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ jobs:
1313
python-version: 3.7.x
1414
- uses: actions/setup-dotnet@v1
1515
with:
16-
dotnet-version: '3.1.x'
16+
dotnet-version: '6.0.x'
17+
include-prerelease: true
1718
- uses: pre-commit/[email protected]

.github/workflows/stale.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'Stale issue handler'
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 17 * * *' # 17:00 UTC; 10:00 PDT
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
stale:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/[email protected]
15+
id: stale
16+
with:
17+
stale-issue-label: 'stale'
18+
stale-issue-message: 'This issue has been marked stale because it has been open for 14 days with no activity. Please remove the stale label or comment on this issue, or the issue will be automatically closed in the next 14 days.'
19+
days-before-stale: 14
20+
days-before-pr-stale: -1
21+
days-before-close: 14
22+
days-before-pr-close: -1
23+
exempt-issue-labels: 'blocked,must,should,keep,pinned,work-in-progress,request,announcement'
24+
close-issue-message: 'This issue has been marked stale for 14 days and will now be closed. If this issue is still valid, please ping a maintainer.'
25+
- name: Print outputs
26+
run: echo ${{ join(steps.stale.outputs.*, ',') }}
27+

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ repos:
2525

2626

2727
- repo: https://github.com/dotnet/format
28-
rev: "7e343070a0355c86f72bdee226b5e19ffcbac931"
28+
rev: v5.1.225507
2929
hooks:
3030
- id: dotnet-format
31+
entry: dotnet-format whitespace
3132
args: [--folder, --include]

.yamato/yamato-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Connector Unit Tests
22
agent:
33
type: Unity::VM
4-
image: robotics/ci-ubuntu20:latest
4+
image: robotics/ci-ubuntu20:v0.1.0-795910
55
flavor: i1.large
66
variables:
77
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

CONTRIBUTING.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,20 @@ does the following:
3030
- Has corresponding changes to documentation, unit tests and sample environments (if
3131
applicable)
3232
- Contains a summary of the tests performed to validate your changes
33+
- Updates the [Changelog](com.unity.robotics.ros-tcp-connector/CHANGELOG.md) and describes changes in the Unreleased section
3334
- Links to issue numbers that the PR resolves (if any)
3435

36+
## Workflow
37+
38+
This project is provided as a package to be imported into a Unity project. In order to avoid common issues regarding version control and unmanaged files, the suggested workflow for contributing to the package is as follows:
39+
40+
1. Clone this repository to a known location on your local machine (e.g. Documents).
41+
2. Git checkout the `dev` branch to ensure you have the latest staged changes.
42+
3. In a development Unity project (e.g. a new project created from the Unity Hub of the minimum Unity [version](README.md) or above), open the `Window > Package Manager`.
43+
4. Click the `+` in the top-left of the Package Manager window and select `Add package from disk...`.
44+
5. Navigate to the cloned repository, and select the `com.unity.<package>/package.json` file. Click `Open`.
45+
6. The local version of the package is now added to your Unity project! Changes made to your cloned directory will update in your Unity project.
46+
3547
<!-- ## Continuous Integration (CI)
3648
3749
We run continuous integration on all PRs; all tests must be passing before the PR is merged. -->
@@ -41,13 +53,10 @@ We run continuous integration on all PRs; all tests must be passing before the P
4153
All Python code should follow the [PEP 8 style guidelines](https://pep8.org/).
4254

4355
All C# code should follow the [Microsoft C# Coding Conventions](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions).
44-
Additionally, the [Unity Coding package](https://docs.unity3d.com/Packages/[email protected]/manual/index.html)
45-
can be used to format, encode, and lint your code according to the standard Unity
46-
development conventions. Be aware that these Unity conventions will supersede the
47-
Microsoft C# Coding Conventions where applicable.
56+
(Code may be reformatted to Unity coding standards where applicable.)
4857

49-
Please note that even if the code you are changing does not adhere to these guidelines,
50-
we expect your submissions to follow these conventions.
58+
Please note that even if the code you are changing does not follow these conventions,
59+
we expect your submissions to do so.
5160

5261
## Contributor License Agreements
5362

README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ROS-TCP-Connector
1+
# ROS TCP Connector
22

33
[![Version](https://img.shields.io/github/v/tag/Unity-Technologies/ROS-TCP-Connector)](https://github.com/Unity-Technologies/ROS-TCP-Connector/releases)
44
[![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE.md)
@@ -7,24 +7,37 @@
77
![ROS](https://img.shields.io/badge/ros2-foxy-brightgreen)
88
![Unity](https://img.shields.io/badge/unity-2020.2+-brightgreen)
99

10+
## Introduction
11+
12+
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.
13+
1014
## Installation
11-
1. Using Unity 2020.2 or later, open the package manager from `Window` -> `Package Manager` and select "Add package from git URL..."
12-
![image](https://user-images.githubusercontent.com/29758400/110989310-8ea36180-8326-11eb-8318-f67ee200a23d.png)
13-
2. Enter the following URL. If you don't want to use the latest version, substitute your desired version tag where we've put `v0.5.0` in this example:
14-
`https://github.com/Unity-Technologies/ROS-TCP-Connector.git?path=/com.unity.robotics.ros-tcp-connector#v0.5.0`
15-
3. Click `Add`.
15+
1. Using Unity 2020.2 or later, open the Package Manager from `Window` -> `Package Manager`.
16+
2. In the Package Manager window, find and click the + button in the upper lefthand corner of the window. Select `Add package from git URL....`
17+
18+
![image](https://user-images.githubusercontent.com/29758400/110989310-8ea36180-8326-11eb-8318-f67ee200a23d.png)
1619

20+
3. Enter the git URL for the desired package. Note: you can append a version tag to the end of the git url, like `#v0.4.0` or `#v0.5.0`, to declare a specific package version, or exclude the tag to get the latest from the package's `main` branch.
21+
1. For the ROS-TCP-Connector, enter `https://github.com/Unity-Technologies/ROS-TCP-Connector.git?path=/com.unity.robotics.ros-tcp-connector`.
22+
2. For Visualizations, enter `https://github.com/Unity-Technologies/ROS-TCP-Connector.git?path=/com.unity.robotics.visualizations`.
23+
4. Click `Add`.
24+
25+
To install from a local clone of the repository, see [installing a local package](https://docs.unity3d.com/Manual/upm-ui-local.html) in the Unity manual.
1726

1827
## Tutorials
19-
Scripts used to send [ROS](https://www.ros.org/) messages to an [TCP endpoint](https://github.com/Unity-Technologies/ROS_TCP_Endpoint) running as a ROS node.
28+
<!-- Scripts used to send [ROS](https://www.ros.org/) messages to an [TCP endpoint](https://github.com/Unity-Technologies/ROS_TCP_Endpoint) running as a ROS node. -->
29+
30+
This Unity package provides four main features:
2031

21-
This Unity package provides three main features:
32+
- ROSConnection: A component that sets up communication between ROS and Unity. See the [Unity Robotics Hub](https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/tutorials/ros_unity_integration/README.md) for information and tutorials.
2233

23-
- ROSConnection: See the [Unity Robotics Hub](https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/tutorials/ros_unity_integration/README.md) repository for information and tutorials on how to use this component.
34+
- [Message Generation](MessageGeneration.md): A tool to generate C# classes for ROS message types.
2435

25-
- [Message Generation](MessageGeneration.md)
36+
- Visualizations: A suite of default configurations and APIs to visualize incoming and outgoing information from ROS.
37+
- See the [Nav2 SLAM Example](https://github.com/Unity-Technologies/Robotics-Nav2-SLAM-Example) for tutorials on using the Visualizations Package!
38+
- You can also view the package's [Usage Information](com.unity.robotics.visualizations/Documentation~/README.md) for more details on using the package in your own project.
2639

27-
- [ROSGeometry](ROSGeometry.md)
40+
- [ROSGeometry](ROSGeometry.md): A set of extensions that convert geometries between Unity and other coordinate frames.
2841

2942
## ROS#
3043

ROSGeometry.md

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,56 @@
22

33
In Unity, the X axis points right, Y up, and Z forward. ROS, on the other hand, supports various coordinate frames: in the most commonly-used one, X points forward, Y left, and Z up. In ROS terminology, this frame is called "FLU" (forward, left, up), whereas the Unity coordinate frame would be "RUF" (right, up, forward).
44

5-
The ROSGeometry namespace contains code to make it easier to work with these various coordinate frames - letting you be explicit about what coordinates a given value is in at compile time, and managing the conversions for you. It does this with two generic structs, `Vector3<C>` and `Quaternion<C>`. The type parameter C indicates the coordinate frame you're working in - either FLU, or RUF, or perhaps a more exotic frame such as NED (north, east, down) or ENU (east, north, up), commonly used in aviation.
5+
The ROSGeometry namespace contains code to make it easier to work with these various coordinate frames - letting you be explicit about what coordinates a given value is in at compile time, and managing the conversions for you.
66

7+
Here's the using declaration for adding ROSGeometry to your namespace:
8+
9+
using Unity.Robotics.ROSTCPConnector.ROSGeometry;
10+
11+
# Ros Message conversions:
12+
13+
The main ROS position messages (geometry_msgs/Point, geometry_msgs/Point32 and geometry_msgs/Vector3) can be converted to and from Unity Vector3s like this:
14+
15+
PointMsg ToRosExample(Vector3 position)
16+
{
17+
return position.To<FLU>();
18+
}
19+
20+
Vector3 ToUnityExample(PointMsg message)
21+
{
22+
return message.From<FLU>();
23+
}
24+
25+
Similarly, the geometry_msgs/Quaternion message can be converted to and from a Unity Quaternion.
26+
27+
QuaternionMsg myRosQuaternion = myGameObject.transform.rotation.To<FLU>();
28+
Quaternion myUnityQuaternion = myRosQuaternion.From<FLU>();
29+
30+
Hence, writing 3d data into a message can often be as simple as writing:
31+
32+
ImuMsg msg = new ImuMsg()
33+
{
34+
linear_acceleration = acceleration.To<FLU>();
35+
orientation = rigidbody.transform.rotation.To<FLU>();
36+
angular_velocity = rigidbody.angularVelocity.To<FLU>();
37+
}
38+
ros.Send("imu", msg);
39+
40+
Unity's standard Transform class also has a `To<C>()` extension method that returns a ROS Transform message. So creating a geometry_msgs/Transform message typically looks like this:
41+
42+
TransformMsg msg = myGameObject.transform.To<FLU>());
43+
44+
# Internal details
45+
46+
Some more detail about what's going on here: The core of the ROSGeometry package is the two generic structs, `Vector3<C>` and `Quaternion<C>`. The type parameter C here indicates the coordinate frame you're working in - either FLU, or RUF, or perhaps one of the more exotic frames such as NED (north, east, down) or ENU (east, north, up), used in aviation.
47+
48+
These are fully-fledged Vector3 and Quaternion classes, so if you want, you can work with them directly to perform geometric operations in an arbitrary coordinate space. (Note, it's a compile time error to add a Vector3<FLU> to a Vector3<RUF>.)
49+
50+
These are the types returned by the `To<FLU>()` calls above. Vector3<C> also has implicit conversions to MPoint, MPoint32, and MVector3, which is how this one call can be used to convert to all three data types.
751

852
# Converting between frames:
953

10-
For example, if you need to convert an object's position into the FLU coordinate frame, you might write:
54+
If, for example, you need to convert an object's position into the FLU coordinate frame, you might explicitly create a Vector3<FLU> like this:
1155

1256
Vector3<FLU> rosPos = obj.transform.position.To<FLU>();
1357

@@ -20,7 +64,7 @@ To convert back, just access the "toUnity" property on the vector.
2064

2165
Vector3 unityPos = rosPos.toUnity;
2266

23-
And the same functions apply for converting Quaternions.
67+
The same functions and properties apply for converting Quaternions.
2468

2569
# Ros Message conversions:
2670

@@ -40,17 +84,17 @@ Unity's standard Transform class also has a `To<C>()` extension method that retu
4084

4185
# Converting incoming messages
4286

43-
You can also convert Points, Point32s and Vector3s back into Unity coordinates. To convert a Point in coordinate space C directly into a Unity Vector3, you can write `From<C>`. For example:
87+
You can also convert Points, Point32s and Vector3s back into Unity coordinates. If you know that a Point is in coordinate space C, you can convert it into a Unity Vector3 in the unity coordinate space by writing `From<C>`. For example:
4488

4589
void SubscriberCallback(Point p)
4690
{
4791
transform.position = p.From<FLU>();
4892
}
4993

50-
Or, if you need to work with them in the FLU coordinate space for now, you can write:
94+
Or, if you need to work with it in the FLU coordinate space for now, you can write:
5195

5296
Vector3<FLU> rosPos = p.As<FLU>();
5397

54-
(Note that this 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.)
98+
(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.)
5599

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

TestRosTcpConnector/Packages/manifest.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"dependencies": {
3-
"com.unity.collab-proxy": "1.3.9",
3+
"com.unity.collab-proxy": "1.5.7",
44
"com.unity.ide.rider": "2.0.7",
5-
"com.unity.ide.visualstudio": "2.0.3",
6-
"com.unity.ide.vscode": "1.2.2",
7-
"com.unity.render-pipelines.universal": "10.0.0-preview.26",
5+
"com.unity.ide.visualstudio": "2.0.8",
6+
"com.unity.ide.vscode": "1.2.3",
7+
"com.unity.render-pipelines.universal": "10.2.2",
88
"com.unity.robotics.ros-tcp-connector": "file:../../com.unity.robotics.ros-tcp-connector",
9-
"com.unity.test-framework": "1.1.20",
9+
"com.unity.test-framework": "1.1.24",
1010
"com.unity.testtools.codecoverage": "1.0.0",
1111
"com.unity.textmeshpro": "3.0.1",
12-
"com.unity.timeline": "1.4.3",
12+
"com.unity.timeline": "1.4.8",
13+
"com.unity.toolchain.macos-x86_64-linux-x86_64": "0.1.21-preview",
1314
"com.unity.ugui": "1.0.0",
1415
"com.unity.modules.ai": "1.0.0",
1516
"com.unity.modules.androidjni": "1.0.0",

0 commit comments

Comments
 (0)