Skip to content

test #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

test #422

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .yamato/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ csharp:
name: Sonarqube C# Scan
agent:
type: Unity::metal::macmini
image: package-ci/mac
image: package-ci/mac:v1.8.1-822785
flavor: m1.mac
variables:
PROJECT_PATH: tutorials/pick_and_place/PickAndPlaceProject
Expand Down Expand Up @@ -36,7 +36,7 @@ standard:
name: Sonarqube Standard Scan
agent:
type: Unity::metal::macmini
image: package-ci/mac
image: package-ci/mac:v1.8.1-822785
flavor: m1.mac
variables:
SONARQUBE_PROJECT_KEY: ai-robotics-hub-standard
Expand All @@ -49,4 +49,4 @@ standard:
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")
(push.branch eq "main" OR push.branch eq "dev")
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

<!-- [![Version](https://img.shields.io/github/v/tag/Unity-Technologies/Unity-Robotics-Hub)](https://github.com/Unity-Technologies/Unity-Robotics-Hub/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)
![Unity](https://img.shields.io/badge/unity-2020.2+-brightgreen)

This is a central repository for tools, tutorials, resources, and documentation for robotic simulation in Unity.

Expand Down Expand Up @@ -83,18 +79,6 @@ Use articulation bodies to easily prototype industrial designs with realistic mo
- [Unity Computer Vision](https://unity.com/computer-vision)
- [Unity ML-Agents Toolkit](https://github.com/Unity-Technologies/ml-agents)

## New Physics Features in Unity
### New Features
- **Contact Modification API** This API will allow users to define custom contact reactions, such as ignoring subsets of contact points, in order to help simulate holes, slippery surfaces, soft contacts, and more. It is available in Unity versions **2021.2a12+**. [Read more about the new Contact Modification API](https://forum.unity.com/threads/experimental-contacts-modification-api.924809/).
- **Collision detection modes exposed for ArticulationBody: discrete, sweep-based CCD, and speculative CCD**. New continuous collision detection (CCD) modes will ensure that fast-moving objects collide with objects, instead of tunneling or passing through those objects, which can happen in the default “discrete” mode. This API is available in Unity versions **2020.3.5f1+**. [Read more about continuous collision detection](https://docs.unity3d.com/2020.3/Documentation/ScriptReference/ArticulationBody-collisionDetectionMode.html).

### Coming Soon
Here’s a peek into what our Physics Team is hard at work on…

- **Wheel Collider shapes**. This feature will allow the user to specify the shape of the collider to be used for collision detection. Currently the collider shape is fixed to a cylinder, and collision detection is performed by casting a ray from the center of the cylinder. Custom shapes will improve the accuracy of simulating wheels over rough terrains, holes, etc. [Read more about Wheel Collider](https://docs.unity3d.com/Manual/class-WheelCollider.html).
- **Force/Torque Sensor API**. This API will allow users to get the force and torque acting on an articulation body (useful for simulating a force/torque sensor!), as well as to get the motor torque applied by an articulation drive.
- **Query primitives**. These simple, GameObject-less shapes allow for collision detection without requiring simulation (i.e., without calling Physics.Simulate). This feature will allow users to initialize objects in feasible locations, and can also be used for motion planning.

## ROS 2
ROS2 support is now available! You can get started by following [this tutorial](https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/tutorials/ros_unity_integration/publisher.md).

Expand Down
6 changes: 4 additions & 2 deletions tutorials/pick_and_place/0_ros_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ The ROS workspace is now ready to accept commands!
- Copy or download this directory to your ROS operating system if you are doing ROS operations in another machine, VM, or container.
> Note: This contains the ROS packages for the pick-and-place task, including [ROS TCP Endpoint](https://github.com/Unity-Technologies/ROS-TCP-Endpoint), [Niryo One ROS stack](https://github.com/NiryoRobotics/niryo_one_ros), [MoveIt Msgs](https://github.com/ros-planning/moveit_msgs), `niryo_moveit`, and `niryo_one_urdf`.

1. The provided files require the following packages to be installed. ROS Melodic users should run the following commands if the packages are not already present:
1. The provided files require the following packages to be installed.

ROS Melodic users should run the following commands if the packages are not already present:

```bash
sudo apt-get update && sudo apt-get upgrade
Expand All @@ -72,7 +74,7 @@ The ROS workspace is now ready to accept commands!
sudo -H pip3 install rospkg jsonpickle
```

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.
2. 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.

The ROS workspace is now ready to accept commands!

Expand Down
4 changes: 2 additions & 2 deletions tutorials/pick_and_place/2_ros_tcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ ROS and Unity have now successfully connected!

- `...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.

- If Unity fails to find a network connection, ensure that the ROS IP address is entered correctly as the ROS IP Address in the RosConnect in Unity, and that the `src/niryo_moveit/config/params.yaml` values are set correctly.
- If Unity fails to find a network connection, ensure that the ROS IP address is entered correctly as the ROS IP Address in the ROS Settings in Unity. This should default to `127.0.0.1`.

- 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.
- If the ROS TCP handshake fails (e.g. no `Connection from 172.17.0.1` on the ROS side after starting the endpoint and entering Play in Unity), the ROS IP may not have been set correctly. The endpoint defaults to `0.0.0.0`, assuming a native or Docker setup. To override this, you can configure the address and/or port by passing them into the launchfile when you launch it, e.g. `roslaunch niryo_moveit part_2.launch tcp_ip:=127.0.0.1 tcp_port:=10005`.

- If the UI buttons appear to be unresponsive, such as not responding to clicks, ensure there is an [EventSystem](https://docs.unity3d.com/2020.1/Documentation/Manual/UIE-Events.html) in the scene hierarchy. This should be added automatically when adding UI elements, but if it is not, you can add one to your scene from the Hierarchy window via `(+) > UI > Event System`. You can also access this dropdown from right-clicking in an empty area in the Hierarchy window.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 14 additions & 17 deletions tutorials/ros_unity_integration/network.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

> It is possible to set both of these variables on the machines running Unity and ROS. The specifics of where and why each of these settings will be described below.

On the ROS machine, these settings are set as a rosparam and will typically be set in a launch file like [this](ros_packages/unity_robotics_demo/launch/robo_demo.launch) or in a [param file](https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/tutorials/pick_and_place/ROS/src/niryo_moveit/config/params.yaml) loaded by a launch file like [this](https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_3.launch#L2). The param file can also be loaded manually by running the `rosparam load params.yaml` command.
On the ROS machine, these settings can be set via arguments when running the endpoint's roslaunch like this:

```
roslaunch ros_tcp_endpoint endpoint.launch tcp_ip:=127.0.0.1 tcp_port:=10000
```

Or, if using a launchfile like in the Pick-and-Place demo, the settings can be passed as arguments in a launch file like [this](https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_3.launch#L2-L3).

On the Unity machine, these settings are set from the menu by going to `Robotics` -> `ROS Settings`

Expand All @@ -27,17 +33,7 @@ The minimum settings required for Unity to communicate with ROS is to set the `R

## If Using Docker

The container will need to be started with the following arguments to forward the ports used for communication between ROS and Unity.

`-p 10000:10000 -p 5005:5005`


- On the ROS side, set `ROS_IP` to `0.0.0.0`.
```bash
rosparam set ROS_IP 0.0.0.0
```

- On the Unity side, set `ROS_IP` to `127.0.0.1`.
The container will need to be started with the default arguments to forward the ports used for communication between ROS and Unity. The `unity_endpoint` will listen on IP 0.0.0.0 (i.e. allowing all incoming addresses) and port 10000, but these settings are configurable.

![](images/settings_ros_ip.png)

Expand All @@ -49,18 +45,17 @@ The container will need to be started with the following arguments to forward th

When play is pressed in the Editor, Unity will establish the connection to ROS using the ROS_IP.

If Unity can communicate with ROS, you should see a heads-up display showing the connection in Unity Editor.
If Unity can communicate with ROS, you should see a heads-up display showing the connection in Unity Editor's Game view.

![](images/troubleshoot_hud_success.png)

The icon in front of ROS IP should be blue indicating the connection between Unity and ROS is successful.


On ROS side, you should see a message printed to the console screen running the `server_endpoint.py` script, something similar to the following:
On ROS side, you should see a message printed to the console screen running the server endpoint, something similar to the following:

```Connection from 172.17.0.1```


If the previous message is not shown and either of the following errors are thrown instead:

```
Expand All @@ -73,21 +68,23 @@ SocketException: Connection refused

Confirm that:

- `server_endpoint` is running. On ROS side, you can run ```rosrun ros_tcp_endpoint default_server_endpoint.py```
- The `unity_endpoint` is running. On ROS side, you can run ```rosrun ros_tcp_endpoint default_server_endpoint.py```
- You can ping ROS machine from Unity machine
- From a terminal on the Unity machine, run the following command to confirm whether the ROS machine is reachable over the network. ```ping ROS_IP```

If issue still persists:

- If on Windows you may need to [open ports for the firewall](#open-port-on-windows-firewall).
- Ensure your Connector and Endpoint packages are using matching versions. You will see a `Incompatible ROS-TCP-Endpoint version...` message in your Unity console if these are not the same.
- You can verify which Connector version is being used in the `Window > Package Manager` window, and you can run `rosversion ros_tcp_endpoint` on the ROS side. Ensure these values match.

### 2. Can ROS send messages to Unity?

After it is confirmed that Unity can communicate with ROS, publish a message to a ROS topic to which Unity has instantiated a subscriber.

You can confirm the connection status by checking the heads-up display in your Unity Scene after entering the Play mode.

If an error is thrown in the `server_endpoint` console then ROS cannot connect to Unity.
If an error is thrown in the `unity_endpoint` console then ROS cannot connect to Unity.

If issue still persists:

Expand Down
4 changes: 4 additions & 0 deletions tutorials/ros_unity_integration/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ The instructions so far have set up the ROS-TCP-Connector package for general us
![](images/generate_messages_3.png)

The generated files will be saved in the default directories `Assets/RosMessages/UnityRoboticsDemo/msg` and `Assets/RosMessages/UnityRoboticsDemo/srv`. Note, there is no difference between the message scripts generated in ROS1 and ROS2 mode. You don't need to regenerate messages when you switch between them.

## Troubleshooting

Check out the [ROS–Unity Integration Networking](network.md) document for more details on troubleshooting your connection.
Loading