diff --git a/.yamato/sonar.yml b/.yamato/sonar.yml index 19a4bdae..9fdbf291 100644 --- a/.yamato/sonar.yml +++ b/.yamato/sonar.yml @@ -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 @@ -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 @@ -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") \ No newline at end of file + (push.branch eq "main" OR push.branch eq "dev") diff --git a/README.md b/README.md index 12736a99..053a0f61 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,6 @@ [![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. @@ -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). diff --git a/tutorials/pick_and_place/0_ros_setup.md b/tutorials/pick_and_place/0_ros_setup.md index 8381a2fe..dca2dd5c 100644 --- a/tutorials/pick_and_place/0_ros_setup.md +++ b/tutorials/pick_and_place/0_ros_setup.md @@ -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 @@ -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! diff --git a/tutorials/pick_and_place/2_ros_tcp.md b/tutorials/pick_and_place/2_ros_tcp.md index e46089e9..2434cc89 100644 --- a/tutorials/pick_and_place/2_ros_tcp.md +++ b/tutorials/pick_and_place/2_ros_tcp.md @@ -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. diff --git a/tutorials/ros_unity_integration/images/troubleshoot_hud_success.png b/tutorials/ros_unity_integration/images/troubleshoot_hud_success.png index c8a5ef83..6d9da095 100644 Binary files a/tutorials/ros_unity_integration/images/troubleshoot_hud_success.png and b/tutorials/ros_unity_integration/images/troubleshoot_hud_success.png differ diff --git a/tutorials/ros_unity_integration/network.md b/tutorials/ros_unity_integration/network.md index f5d28f08..ae5b9e7a 100644 --- a/tutorials/ros_unity_integration/network.md +++ b/tutorials/ros_unity_integration/network.md @@ -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` @@ -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) @@ -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: ``` @@ -73,13 +68,15 @@ 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? @@ -87,7 +84,7 @@ After it is confirmed that Unity can communicate with ROS, publish a message to 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: diff --git a/tutorials/ros_unity_integration/setup.md b/tutorials/ros_unity_integration/setup.md index bede9048..60ea07d6 100644 --- a/tutorials/ros_unity_integration/setup.md +++ b/tutorials/ros_unity_integration/setup.md @@ -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. \ No newline at end of file