浏览代码

AIRO-355: Tutorial reorganization (#87)

* AIRO-356: Tutorial Updates (#88)
* Update tutorial to Robotics menu option, ROSConnect instructions
* PR feedback: IP troubleshooting, gripper value swap
* Reimported niryo for completed scene
* PR feedback: bring TCP-connector up to dev
/devin-main-fix
GitHub 3 年前
当前提交
9acb79c0
共有 34 个文件被更改,包括 7352 次插入4257 次删除
  1. 30
      tutorials/pick_and_place/1_urdf.md
  2. 185
      tutorials/pick_and_place/2_ros_tcp.md
  3. 48
      tutorials/pick_and_place/3_pick_and_place.md
  4. 2
      tutorials/pick_and_place/PickAndPlaceProject/Assets/Prefabs/Target.prefab
  5. 2
      tutorials/pick_and_place/PickAndPlaceProject/Assets/Prefabs/TargetPlacement.prefab
  6. 696
      tutorials/pick_and_place/PickAndPlaceProject/Assets/Scenes/Part1DoneScene.unity
  7. 72
      tutorials/pick_and_place/PickAndPlaceProject/Assets/Scenes/TutorialScene.unity
  8. 2
      tutorials/pick_and_place/PickAndPlaceProject/Packages/manifest.json
  9. 30
      tutorials/pick_and_place/README.md
  10. 7
      tutorials/pick_and_place/Scripts/SourceDestinationPublisher.cs
  11. 15
      tutorials/pick_and_place/Scripts/TrajectoryPlanner.cs
  12. 7
      tutorials/pick_and_place/docker/Dockerfile
  13. 3
      tutorials/pick_and_place/docker/set-up-workspace
  14. 196
      tutorials/pick_and_place/img/1_base.png
  15. 163
      tutorials/pick_and_place/img/1_controller.png
  16. 999
      tutorials/pick_and_place/img/1_cube.png
  17. 298
      tutorials/pick_and_place/img/1_physics.png
  18. 1001
      tutorials/pick_and_place/img/2_sourcedest.gif
  19. 1001
      tutorials/pick_and_place/img/2_target.gif
  20. 1001
      tutorials/pick_and_place/img/3_target.gif
  21. 423
      tutorials/pick_and_place/img/2_srv.png
  22. 126
      tutorials/pick_and_place/0_ros_setup.md
  23. 1001
      tutorials/pick_and_place/img/0_docker.png
  24. 1001
      tutorials/pick_and_place/img/0_unity.png
  25. 139
      tutorials/pick_and_place/img/1_camera.png
  26. 522
      tutorials/pick_and_place/img/2_browser.png
  27. 92
      tutorials/pick_and_place/img/2_menu.png
  28. 181
      tutorials/pick_and_place/img/2_msg.png
  29. 545
      tutorials/pick_and_place/img/2_robottraj.png
  30. 581
      tutorials/pick_and_place/img/2_settings.png
  31. 18
      tutorials/pick_and_place/docker/tutorial
  32. 1001
      tutorials/pick_and_place/img/2_component.gif
  33. 221
      tutorials/pick_and_place/img/2_single.png
  34. 0
      /tutorials/pick_and_place/img/2_srv.png

30
tutorials/pick_and_place/1_urdf.md


# Pick-and-Place Tutorial: Part 1
This part includes downloading and installing the Unity Editor, setting up a basic Unity scene, and importing a robot using the URDF Importer.
> Note: If you are familiar with Unity and the URDF Importer, or just want to skip directly to setting up ROS, you can do so by opening Assets/Scenes/Part1Done and going directly to [Part 2](2_ros_tcp.md).
> Note: If you are familiar with Unity and the URDF Importer, or just want to skip directly to setting up ROS, you can do so by opening the `Assets/Scenes/Part1Done` scene and going directly to [Part 2](2_ros_tcp.md).
**Table of Contents**
- [Setting up the Unity Scene](#setting-up-the-unity-scene)

---
## Setting up the Unity Scene
1. Clone this repo to a location on your local machine:
1. If you have not already cloned this project to your local machine, do so now:
```bash
git clone --recurse-submodules https://github.com/Unity-Technologies/Unity-Robotics-Hub.git
```

1. Go to the [Unity 2020.2 Beta website](https://unity3d.com/unity/beta/2020.2.0b9) to install this project's version of Unity: **2020.2.0b9**.
1. Click the "Add" button in the top right of the "Projects" tab on Unity Hub, and navigate to and select the PickAndPlaceProject directory (`./Unity-Robotics-Hub/tutorials/pick_and_place/PickAndPlaceProject/`) to add the tutorial project to your Hub.
1. Click the "Add" button in the top right of the "Projects" tab on Unity Hub, and navigate to and select the PickAndPlaceProject directory within this cloned repository (`/PATH/TO/Unity-Robotics-Hub/tutorials/pick_and_place/PickAndPlaceProject/`) to add the tutorial project to your Hub.
5. Unity should open the project to a scene titled `EmptyScene`. If it did not, you can find it in the Project browser in the Assets/Scenes directory, and double-click to open it now.
1. Unity should open the project to a scene titled `EmptyScene`. If it did not, you can find it in the Project window in the Assets/Scenes directory, and double-click to open it now.
6. In the Unity Project window, navigate to `Assets/Prefabs`. Select the Table prefab, and click and drag it into the Hierarchy window. The table should appear in the Scene view. Then, select and drag the Target into the Hierarchy window, as well as the TargetPlacement. They should appear to sit on the table.
> The Hierarchy, Scene View, Game View, Play/Pause/Step toolbar, Inspector, Project, and Console windows of the Unity Editor have been highlighted below for reference, based on the default layout. Custom Unity Editor layouts may vary slightly. A top menu bar option is available to re-open any of these windows: Window > General.
![](img/0_unity.png)
1. In the Unity Project window, navigate to `Assets/Prefabs`. Select the Table prefab, and click and drag it into the Hierarchy window. The table should appear in the Scene view. Then, select and drag the Target into the Hierarchy window, as well as the TargetPlacement. They should appear to sit on the table.
7. Select the `Main Camera` in the Hierarchy. Move the camera to a more convenient location for viewing the robot by assigning the `Main Camera`'s Position to `(0, 1.4, -0.7)`, and the Rotation to `(45, 0, 0)` in the Inspector.
1. Select the `Main Camera` in the Hierarchy. Move the camera to a more convenient location for viewing the robot by assigning the `Main Camera`'s Position to `(0, 1.4, -0.7)`, and the Rotation to `(45, 0, 0)` in the Inspector, which can be found in the Transform component.
![](img/1_camera.png)
> Note: Presumably when you opened this project, the Package Manager automatically checked out and built the URDF-Importer package for you. You can double-check this now by looking for `Packages/URDF-Importer` in the Project Browser or by opening the Package Manager window. See the [Quick Setup](../quick_setup.md) steps for adding this package to your own project.
> Note: Presumably when you opened this project, the Package Manager automatically checked out and built the URDF-Importer package for you. You can double-check this now by looking for `Packages/URDF-Importer` in the Project window or by opening the Package Manager window. See the [Quick Setup](../quick_setup.md) steps for adding this package to your own project.
1. Open the Physics Project Settings (Edit > Project Settings > Physics) and ensure the `Solver Type` is set to `Temporal Gauss Seidel`. This prevents erratic behavior in the joints that may be caused by the default solver.
1. Open the Physics Project Settings (in the top menu bar, Edit > Project Settings > Physics) and ensure the `Solver Type` is set to `Temporal Gauss Seidel`. This prevents erratic behavior in the joints that may be caused by the default solver.
![](img/1_physics.png)

> Note: Going from Unity world space to ROS world space requires a conversion. Unity's `(x,y,z)` is equivalent to the ROS `(z,-x,y)` coordinate.
1. On the Controller script of the top-level `niryo_one` object, set the Stiffness to `10000` ,the Damping to `100` and `Force Limit` to `1000`. Set the Speed to `30` and the Acceleration to `10`.
1. Select the newly imported `niryo_one` object in the Scene Hierarchy, and from the Inspector window, find the Controller (Script) component. Set the Stiffness to `10000`, the Damping to `100` and `Force Limit` to `1000`. Set the Speed to `30` and the Acceleration to `10`.
> Note: You can find information on how these parameters are used in calculations by articulation bodies by referencing [this](https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/master/tutorials/urdf_importer/urdf_appendix.md#guide-to-write-your-own-controller) technical guide for writing a custom controller. For our purposes, these settings will allow the robot to stay in position without the joints slipping.
![](img/1_controller.png)

> Note: A controller is pre-built in the Unity URDF Importer to help showcase the movement of the Niryo. The Controller script is added to the imported URDF by default. This will add FKrobot and Joint Control components at runtime. The Controller script can be found in the project at `Assets/Packages/URDF Importer/Runtime/Controller/Controller.cs`.
1. Press Play. If everything imported correctly, no errors should appear in the Console window. The robot arm should stay “mounted” to the table, and nothing should fall through the floor.
1. Press the Play button at the top of the Unity Editor to enter Play Mode. If everything imported correctly, no errors should appear in the Console window. The robot arm should stay “mounted” to the table, and nothing should fall through the floor.
> Note: Using the Controller, joints can be selected using the arrow keys. Use the left/right arrow keys to navigate through the joints, where the selected index will be highlighted in red. Use the up/down arrow keys to control the selected joint movement. The Controller script on the niryo_one object will describe the actively `Selected Index` as well as the `Joint Name`.
Using the Controller, joints can be selected using the arrow keys. Use the left/right arrow keys to navigate through the joints, where the selected index will be highlighted in red. Use the up/down arrow keys to control the selected joint movement. The Controller script on the niryo_one object will describe the actively `Selected Index` as well as the `Joint Name`.
![](img/1_end.gif)

185
tutorials/pick_and_place/2_ros_tcp.md


# Pick-and-Place Tutorial: Part 2
This part assumes you have access to a functional ROS workspace. If you do not yet have a working ROS setup, refer to the [Resources](#resources) section below to get started.
If you're new to ROS, check out the [Start Guide](http://wiki.ros.org/ROS/StartGuide) on the ROS Wiki to get started.
The steps in this tutorial will explain how to configure your ROS workspace for this project, but check out the ROS Wiki's [Start Guide](http://wiki.ros.org/ROS/StartGuide) if you'd like to learn more about getting started with ROS.
- [Setup](#setup)
- [The Unity Side](#the-unity-side)
- [The ROS side](#the-ros-side)
- [Troubleshooting](#troubleshooting)

---
## Setup
1. If you have not already, complete [Part 1](1_urdf.md) to set up the Unity project.
1. Navigate to the `Unity-Robotics-Hub/tutorials/pick_and_place/ROS` directory of this downloaded repo.
- This directory will be used as the [ROS catkin workspace](http://wiki.ros.org/catkin/Tutorials/using_a_workspace).
- If you cloned the project and forgot to use `--recurse-submodules`, or if any submodule in this directory doesn't have content, you can run the command `git submodule update --init --recursive` to download packages for Git submodules.
- Copy or download this directory to your ROS operating system if you are doing ROS operations in another machine, VM, or container.
- This contains 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. If you have not already completed the steps in [Part 0](0_ros_setup.md) to set up your ROS workspace and [Part 1](1_urdf.md) to set up the Unity project, do so now.
> Note: The Package Manager automatically checked out and built the ROS-TCP-Connection package in this project. You can verify this now by looking for `Packages/ROS-TCP-Connector` in the Project Browser or by opening the Package Manager window. See the [Quick Setup](../quick_setup.md) steps for adding this package to your own project.
> Note: The Package Manager automatically checked out and built the ROS-TCP-Connection package in this project. You can verify this now by looking for `Packages/ROS-TCP-Connector` in the Project window or by opening the Package Manager window. See the [Quick Setup](../quick_setup.md) steps for adding this package to your own project.
> The ROS-TCP-Connector package includes two pieces: TcpConnector, which contains the `ROSConnection` script described above, and MessageGeneration, which generates C# scripts from ROS msg and srv files.

> Note: Read more about the ROS srv [here](http://wiki.ros.org/srv).
1. We will start with generating the MoveItMsg: RobotTrajectory.
1. We will start with generating the MoveItMsg: RobotTrajectory. This file describes the trajectory contents that will be used in the sent and received trajectory messages.
Select `Robotics -> Generate ROS Messages...` from the top menu bar.
Select `RosMessageGeneration -> Auto Generate Messages -> Single Message` from the menu.
![](img/2_menu.png)
![](img/2_single.png)
In the ROS Message Browser window, click `Browse` next to the ROS message path. Navigate to and select the ROS directory of this cloned repository (`Unity-Robotics-Hub/tutorials/pick_and_place/ROS/`). This window will populate with all msg and srv files found in this directory.
![](img/2_browser.png)
> Note: If any of these ROS directories appear to be empty, you can run the command `git submodule update --init --recursive` to download the packages via Git submodules.
Under `ROS/src/moveit_msgs/msg`, scroll to `RobotTrajectory.msg`, and click its `Build msg` button. The button text will change to "Rebuild msg" when it has finished building.
![](img/2_robottraj.png)
In the Message Auto Generation window click `Browse File...` and navigate to the MoveIt Msgs repository. Select `moveit_msgs/msg/RobotTrajectory.msg`, and then click `GENERATE!`
> Note: If any of these ROS directories appear to be empty, you can run the command `git submodule update --init --recursive` to download the packages via Git submodules.
1. Next, the custom message scripts for this tutorial will be generated.
1. Next, the custom message scripts for this tutorial will need to be generated.
Still in the ROS Message Browser window, expand `ROS/src/niryo_moveit/msg` to view the msg files listed. Next to msg, click `Build 2 msgs`.
Select `RosMessageGeneration -> Auto Generate Messages -> All Messages in Directory`.
![](img/2_msg.png)
In the Message Auto Generation window, click `Select Folder…` and navigate to the `niryo_moveit` directory, e.g. `Unity-Robotics-Hub/tutorials/pick_and_place/ROS/src/niryo_moveit/`. Select the `msg` folder, and then click `GENERATE!`
- Two new C# scripts should populate the `Assets/RosMessages/NiryoMoveit/msg` directory: NiryoMoveitJoints and NiryoTrajectory.
- Two new C# scripts should populate the `Assets/RosMessages/NiryoMoveit/msg` directory: NiryoMoveitJoints and NiryoTrajectory. NiryoMoveitJoints describes a value for each joint in the Niryo arm as well as poses for the target object and target goal. NiryoTrajectory describes a list of RobotTrajectory values, which will hold the calculated trajectories for the pick-and-place task.
1. Now that the messages have been generated, the service for moving the robot will be created.
1. Finally, now that the messages have been generated, we will create the service for moving the robot.
In the menu, select `RosMessageGeneration -> Auto Generate Services -> Single Service`.
Still in the ROS Message Browser window, expand `ROS/src/niryo_moveit/srv` to view the srv file listed. Next to srv, click `Build 1 srv`.
1. In the Service Auto Generation window, click `Browse File...` and navigate to the niryo_moveit/srv directory, e.g. `Unity-Robotics-Hub/tutorials/pick_and_place/ROS/src/niryo_moveit/srv`. Choose the `MoverService.srv` file, and then click `GENERATE!`
![](img/2_srv.png)
- Two new C# scripts should populate the `Assets/RosMessages/NiryoMoveit/srv` directory: MoverServiceRequest and MoverServiceResponse.
- Two new C# scripts should populate the `Assets/RosMessages/NiryoMoveit/srv` directory: MoverServiceRequest and MoverServiceResponse. These files describe the expected input and output formats for the service requests and responses when calculating trajectories.
You can now close the ROS Message Browser window.
> Note: The SourceDestinationPublisher script is included. This script will communicate with ROS, grabbing the positions of the target and destination objects and sending it to the ROS Topic `"SourceDestination_input"`. On `Start()`, the TCP connector is instantiated with a ROS host name and port, and the articulation body values are assigned based on the GameObjects that will be assigned shortly. The `Publish()` function is defined as follows:
> Note: The SourceDestinationPublisher script is one of the included files. This script will communicate with ROS, grabbing the positions of the target and destination objects and sending it to the ROS Topic `"SourceDestination_input"`. The `Publish()` function is defined as follows:
```csharp
public void Publish()

![](img/2_sourcedest.gif)
1. Next, the object that will hold the TCP functionality needs to be added.
1. Note that this component shows empty member variables in the Inspector window, which need to be assigned.
Create another GameObject, name it RosConnect, and add the script `Packages/ROS TCP Connection/Runtime/TcpConnector/ROSConnection` to it in the same way.
Select the Target object in the Hierarchy and assign it to the `Target` field in the Publisher. Similarly, assign the TargetPlacement object to the `TargetPlacement` field. Assign the niryo_one robot to the `Niryo One` field.
1. Note that these components show empty member variables in the Inspector window, which need to be assigned.
![](img/2_target.gif)
Select the Target object in the Hierarchy and assign it to the `Target` field in the Publisher. Similarly, assign the TargetPlacement object to the `TargetPlacement` field. Assign the niryo_one robot to the `Niryo One` field. Finally, assign the newly created RosConnect object to the `Ros` field.
1. Next, the ROS TCP connection needs to be created. Select `Robotics -> ROS Settings` from the top menu bar.
![](img/2_target.gif)
In the ROS Settings window, the `ROS IP Address` should be the IP address of your ROS machine (*not* the one running Unity).
1. Once again, select the RosConnect object. The `Host Name` should be the IP address of your ROS machine (*not* the one running Unity).
- Find the IP address of your ROS machine. In Ubuntu, open a terminal window, and enter `hostname -I`.
- Find the IP address of your ROS machine. In Ubuntu, open a terminal window, and enter `hostname -I`.
- If you are **not** running ROS services in a Docker container, replace the `ROS IP Address` value with the IP address of your ROS machine. Ensure that the `Host Port` is set to `10000`.
- Replace the `Host Name` value with the IP address of your ROS machine. Ensure that the `Host Port` is set to `10000`.
- If you **are** running ROS services in a Docker container, fill `ROS IP Address` and `Override Unity IP Address` with the loopback IP address `127.0.0.1`. Otherwise, leave the `Override Unity IP Address` field empty.
![](img/2_settings.png)
- If you are going to run ROS services with docker container introduced [below](#the-ros-side), fill `Host Name` and `Override Unity IP` with the loopback IP address `127.0.0.1`.
Opening the ROS Settings has created a ROSConnectionPrefab in `Assets/Resources` with the user-input settings. When the static `ROSConnection.instance` is referenced in a script, if a `ROSConnection` instance is not already present, the prefab will be instantiated in the Unity scene, and the connection will begin.
> Note: While using the ROS Settings menu is the suggested workflow, you may still manually create a GameObject with an attached ROSConnection component.
1. To call the `Publish()` function, a UI element will be added for user input. In the Hierarchy window, right click to add a new UI > Button. Note that this will create a new Canvas parent as well.
1. Next, we will add a UI element that will allow user input to trigger the `Publish()` function. In the Hierarchy window, right click to add a new UI > Button. Note that this will create a new Canvas parent as well.
> Note: In the `Game` view, you will see the button appear in the bottom left corner as an overlay. In `Scene` view the button will be rendered on a canvas object that may not be visible.
> Note: In case the Button does not start in the bottom left, it can be moved by setting the `Pos X` and `Pos Y` values in its Rect Transform component. For example, setting its Position to `(-200, -200, 0)` would set its position to the bottom right area of the screen.

> Note: This project has been tested with Python 2 and ROS Melodic, as well as Python 3 and ROS Noetic.
Most of the ROS setup has been provided via the `niryo_moveit` package. This section will describe the `.launch` files and start the necessary ROS nodes for communication. Two methods are provided to launch ROS nodes and services: either using a ROS docker container or doing it manually in your own ROS environment.
Most of the ROS setup has been provided via the `niryo_moveit` package. This section will describe the `.launch` files and start the necessary ROS nodes for communication. If you have not already followed the steps in [Part 0](0_ros_setup.md) to set up your ROS workspace, do so now.
### Use Docker Container
1. [Install Docker Engine](https://docs.docker.com/engine/install/)
2. Build the ROS docker image
```bash
cd /YOUR/UNITY-ROBOTICS-HUB/REPOSITORY/tutorials/pick_and_place &&
git submodule update --init --recursive &&
docker build -t unity-robotics:pick-and-place -f docker/Dockerfile .
```
3. Run ROS in a new docker container
```bash
docker run -it --rm -p 10000:10000 -p 5005:5005 unity-robotics:pick-and-place part_2 /bin/bash
```
4. Terminate docker container
Press `Ctrl + C` or `Cmd + C` to terminate the docker container.
### Manually Setup ROS
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. Open a terminal window in the ROS workspace. Once again, source the workspace. Then, run the following `roslaunch` in order to set the ROS parameters, start the server endpoint, and start the trajectory subscriber.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install python-pip ros-melodic-robot-state-publisher ros-melodic-moveit ros-melodic-rosbridge-suite ros-melodic-joy ros-melodic-ros-control ros-melodic-ros-controllers ros-melodic-tf2-web-republisher
sudo -H pip install rospkg jsonpickle
```
ROS Noetic users should run:
```bash
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install python3-pip ros-noetic-robot-state-publisher ros-noetic-moveit ros-noetic-rosbridge-suite ros-noetic-joy ros-noetic-ros-control ros-noetic-ros-controllers
sudo -H pip3 install rospkg jsonpickle
roslaunch niryo_moveit part_2.launch
> In your ROS workspace, find the directory `src/niryo_moveit/scripts`. Note the file `server_endpoint.py`. This script imports the necessary dependencies from tcp_endpoint and starts the server. `rospy.spin()` ensures the node does not exit until it is shut down.
```python
...
tcp_server.start()
rospy.spin()
...
```
> Additionally, note the file `src/niryo_moveit/scripts/trajectory_subscriber.py`. This script subscribes to the SourceDestination topic. When something is published to this topic, this script will print out the information heard.
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.
1. The ROS parameters will need to be set to your configuration in order to allow the server endpoint to fetch values for the TCP connection. Navigate to `src/niryo_moveit/config/params.yaml` and open the file for editing. You will need to know the IP address of your ROS machine as well as the IP address of the machine running Unity.
- The ROS machine IP, i.e. `ROS_IP` should be the same value as the one set as `Host Name` on the RosConnect component in Unity.
- Update the `ROS_IP` below with the appropriate addresses and copy the contents into the `params.yaml` file.
> Note: Running `roslaunch` automatically starts [ROS Core](http://wiki.ros.org/roscore) if it is not already running.
```yaml
ROS_IP: <your ROS IP>
```
e.g.
```yaml
ROS_IP: 192.168.50.149
```
> Note: Learn more about the server endpoint and ROS parameters [here](../ros_unity_integration/server_endpoint.md).
> This YAML file is `rosparam set` from the launch files provided for this tutorial, which has been copied below for reference. Additionally, the server_endpoint and trajectory_subscriber nodes are launched from this file.
> Note: This launch file has been copied below for reference. The server_endpoint and trajectory_subscriber nodes are launched from this file, and the ROS params (set up in [Part 0](0_ros_setup.md)) are loaded from this command. The launch files for this project are available in the package's `launch` directory, i.e. `src/niryo_moveit/launch/`.
```xml
<launch>

</launch>
```
> Note: The launch files for this project are available in the package's `launch` directory, i.e. `src/niryo_moveit/launch/`.
1. Open a new terminal window in the ROS workspace. Once again, source the workspace. Then, run the following `roslaunch` in order to set the ROS parameters, start the server endpoint, and start the trajectory subscriber.
```bash
roslaunch niryo_moveit part_2.launch
```
> Note: Running `roslaunch` automatically starts [ROS Core](http://wiki.ros.org/roscore) if it is not already running.
This launch will print various messages to the console, including the set parameters and the nodes launched.
Ensure that the `process[server_endpoint]` and `process[trajectory_subscriber]` were successfully started, and that a message similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000` is printed.
This launch will print various messages to the console, including the set parameters and the nodes launched.
Ensure that the `process[server_endpoint]` and `process[trajectory_subscriber]` were successfully started, and that a message similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000` is printed.
1. Return to Unity, and press Play. Click the UI Button in the Game view to call SourceDestinationPublisher's `Publish()` function, publishing the associated data to the ROS topic. View the terminal in which the `roslaunch` command is running. It should now print `I heard:` with the data.

- `...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 Host Name 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 RosConnect in Unity, and that the `src/niryo_moveit/config/params.yaml` values are set correctly.
- 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.
- Setting up a ROS workspace:
> Note: this tutorial was made using ROS Melodic.
- http://wiki.ros.org/ROS/Installation
- http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
- http://wiki.ros.org/catkin/Tutorials/create_a_workspace
- More on [ROS Topics](http://wiki.ros.org/Topics)
- [ROS–Unity Integration Tutorials](../ros_unity_integration/README.md)
- [ROS TCP Connector](https://github.com/Unity-Technologies/ROS-TCP-Connector) package

48
tutorials/pick_and_place/3_pick_and_place.md


# Pick-and-Place Tutorial: Part 3
This part assumes you have access to a functional ROS workspace and that the previous two parts ([Part 1](1_urdf.md), [Part 2](2_ros_tcp.md)) have been completed.
This part assumes that the previous two parts ([Part 1](1_urdf.md), [Part 2](2_ros_tcp.md)) have been completed.
Steps covered in this tutorial includes invoking a motion planning service in ROS, moving a Unity Articulation Body based on the calculated trajectory, and controlling a gripping tool to successfully grasp a cube.

## The Unity Side
1. If you have not already completed the steps in [Part 1](1_urdf.md) to set up the Unity project and [Part 2](2_ros_tcp.md) to integrate ROS with Unity, do so now.
1. If you have not already completed the steps in [Part 1](1_urdf.md) to set up the Unity project and [Part 2](2_ros_tcp.md) to integrate ROS with Unity, do so now.
1. If the PickAndPlaceProject Unity project is not already open, select and open it from the Unity Hub.

1. Note that the TrajectoryPlanner component shows its member variables in the Inspector window, which need to be assigned.
Once again, drag and drop the `Target` and `TargetPlacement` objects onto the Target and Target Placement Inspector fields, respectively. Assign the `niryo_one` robot to the Niryo One field. Finally, assign the RosConnect object to the `Ros` field.
Once again, drag and drop the `Target` and `TargetPlacement` objects onto the Target and Target Placement Inspector fields, respectively. Assign the `niryo_one` robot to the Niryo One field.
![](img/3_target.gif)

## The ROS Side
> Note: This project was built using the ROS Melodic distro, and Python 2.
> Note: This project has been tested with Python 2 and ROS Melodic, as well as Python 3 and ROS Noetic.
> Note the file `src/niryo_moveit/scripts/mover.py`. This script holds the ROS-side logic for the MoverService. When the service is called, the function `plan_pick_and_place()` runs. This calls `plan_trajectory` on the current joint configurations (sent from Unity) to a destination pose (dependent on the phase of the pick-and-place task).

> This creates a set of planned trajectories, iterating through a pre-grasp, grasp, pick up, and place set of poses. Finally, this set of trajectories is sent back to Unity.
### Use Docker Container
1. If you are using ROS docker container and have not already built the ROS docker image. Follow the steps in [Part 2](2_ros_tcp.md) to build the `unity-robotics:pick-and-place` docker image.
### Manually Setup ROS
1. If you have not already built and sourced the ROS workspace since importing the new ROS packages, navigate to your ROS workplace, e.g. `Unity-Robotics-Hub/tutorials/pick_and_place/ROS/`, run `catkin_make && source devel/setup.bash`. Ensure there are no errors.
1. If you have not already set the ROS parameter values in the `params.yaml`, navigate to `src/niryo_moveit/config/params.yaml` and open the file for editing. Follow the steps in [Part 2](2_ros_tcp.md) to configure the values.
1. The ROS side is now ready to interface with Unity!
---
### Use Docker Container
1. If you have not already, [build the ROS docker image](2_ros_tcp.md#use-docker-container) before executing the following command lines.
2. Run ROS in a new docker container
```bash
docker run -it --rm -p 10000:10000 -p 5005:5005 unity-robotics:pick-and-place part_3 /bin/bash
```
3. Terminate docker container
Press `Ctrl + C` or `Cmd + C` to terminate the docker container.
### Manually Setup ROS
1. If you have not already completed the steps in [Part 0](0_ros_setup.md) to set up your ROS workspace, do so now.
- This launch file also loads all relevant files and starts ROS nodes required for trajectory planning for the Niryo One robot (`demo.launch`). The launch files for this project are available in the package's `launch` directory, i.e. `src/niryo_moveit/launch/`.
> Note: Descriptions of what these files are doing can be found [here](moveit_file_descriptions.md).
This launch will print various messages to the console, including the set parameters and the nodes launched.
The final two messages should confirm `You can start planning now!` and `Ready to plan`.
> Note: This launch file also loads all relevant files and starts ROS nodes required for trajectory planning for the Niryo One robot (`demo.launch`). The launch files for this project are available in the package's `launch` directory, i.e. `src/niryo_moveit/launch/`. Descriptions of what these files are doing can be found [here](moveit_file_descriptions.md).
This launch will print various messages to the console, including the set parameters and the nodes launched. The final two messages should confirm `You can start planning now!` and `Ready to plan`.
> Note: This may print out various error messages such as `Failed to find 3D sensor plugin`. These messages are safe to ignore as long as the final message to the console is `You can start planning now!`.

### Hangs, Timeouts, and Freezes
- If Unity fails to find a network connection, ensure that the ROS IP address is entered correctly as the Host Name 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 RosConnect in Unity, and that the `src/niryo_moveit/config/params.yaml` values are set correctly.
### Miscellaneous Issues

2
tutorials/pick_and_place/PickAndPlaceProject/Assets/Prefabs/Target.prefab


m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5601983281253769233}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.216, y: 0.64, z: 0.157}
m_LocalPosition: {x: 0.216, y: 0.64, z: -0.157}
m_LocalScale: {x: 1.38, y: 1.38, z: 1.38}
m_Children: []
m_Father: {fileID: 0}

2
tutorials/pick_and_place/PickAndPlaceProject/Assets/Prefabs/TargetPlacement.prefab


m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850690186460591414}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.216, y: 0.64, z: 0.187}
m_LocalPosition: {x: -0.216, y: 0.64, z: -0.187}
m_LocalScale: {x: 0.05, y: 0.02, z: 0.05}
m_Children: []
m_Father: {fileID: 0}

696
tutorials/pick_and_place/PickAndPlaceProject/Assets/Scenes/Part1DoneScene.unity
文件差异内容过多而无法显示
查看文件

72
tutorials/pick_and_place/PickAndPlaceProject/Assets/Scenes/TutorialScene.unity


m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 850690186460591411, guid: 43bef545df3e344c4a7e089ca90c15a0, type: 3}
propertyPath: m_LocalPosition.x
value: -0.216
objectReference: {fileID: 0}
- target: {fileID: 850690186460591411, guid: 43bef545df3e344c4a7e089ca90c15a0, type: 3}
propertyPath: m_LocalPosition.y
value: 0.64
objectReference: {fileID: 0}
- target: {fileID: 850690186460591411, guid: 43bef545df3e344c4a7e089ca90c15a0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.187
objectReference: {fileID: 0}
- target: {fileID: 850690186460591411, guid: 43bef545df3e344c4a7e089ca90c15a0, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 850690186460591411, guid: 43bef545df3e344c4a7e089ca90c15a0, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 850690186460591411, guid: 43bef545df3e344c4a7e089ca90c15a0, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 850690186460591411, guid: 43bef545df3e344c4a7e089ca90c15a0, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 850690186460591411, guid: 43bef545df3e344c4a7e089ca90c15a0, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}

m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5113255398182140587, guid: 3901759e6233748538fffdbc519c1a68, type: 3}
propertyPath: m_LocalPosition.x
value: 0.216
objectReference: {fileID: 0}
- target: {fileID: 5113255398182140587, guid: 3901759e6233748538fffdbc519c1a68, type: 3}
propertyPath: m_LocalPosition.y
value: 0.64
objectReference: {fileID: 0}
- target: {fileID: 5113255398182140587, guid: 3901759e6233748538fffdbc519c1a68, type: 3}
propertyPath: m_LocalPosition.z
value: 0.157
objectReference: {fileID: 0}
- target: {fileID: 5113255398182140587, guid: 3901759e6233748538fffdbc519c1a68, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5113255398182140587, guid: 3901759e6233748538fffdbc519c1a68, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5113255398182140587, guid: 3901759e6233748538fffdbc519c1a68, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5113255398182140587, guid: 3901759e6233748538fffdbc519c1a68, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5113255398182140587, guid: 3901759e6233748538fffdbc519c1a68, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}

m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2781043625631727712, guid: 85db2308098d34a79837fb7356902f62, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2781043625631727712, guid: 85db2308098d34a79837fb7356902f62, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}

value: 0
objectReference: {fileID: 0}
- target: {fileID: 2781043625631727712, guid: 85db2308098d34a79837fb7356902f62, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2781043625631727712, guid: 85db2308098d34a79837fb7356902f62, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}

- target: {fileID: 2781043625631727712, guid: 85db2308098d34a79837fb7356902f62, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2781043625631727712, guid: 85db2308098d34a79837fb7356902f62, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2781043625631727712, guid: 85db2308098d34a79837fb7356902f62, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2781043625631727712, guid: 85db2308098d34a79837fb7356902f62, type: 3}
propertyPath: m_LocalEulerAnglesHint.x

2
tutorials/pick_and_place/PickAndPlaceProject/Packages/manifest.json


"com.unity.ide.visualstudio": "2.0.3",
"com.unity.ide.vscode": "1.2.2",
"com.unity.robotics.urdf-importer": "https://github.com/Unity-Technologies/URDF-Importer.git#v0.0.5",
"com.unity.robotics.ros-tcp-connector": "https://github.com/Unity-Technologies/ROS-TCP-Connector.git#v0.1.1",
"com.unity.robotics.ros-tcp-connector": "https://github.com/Unity-Technologies/ROS-TCP-Connector.git#dev",
"com.unity.test-framework": "1.1.18",
"com.unity.textmeshpro": "3.0.1",
"com.unity.timeline": "1.4.3",

30
tutorials/pick_and_place/README.md


<p align="center"><img src="img/0_pick_place.gif"/></p>
![](img/0_pick_place.gif)
Unity's tools for robotic simulation enable users to integrate Unity with ROS-based workflows. [ROS](http://wiki.ros.org/ROS/Introduction) (Robot Operating System) provides services such as message-passing, package management, low-level device control, and hardware abstraction. Unity's robotics tools are able to support **importing URDF files** and **sending and receiving messages between ROS and Unity**. This tutorial will go through the steps necessary to integrate ROS with Unity, from installing the Unity Editor to creating a scene with an imported URDF to completing a pick-and-place task with known poses using [MoveIt](https://moveit.ros.org/) trajectory planning.
This tutorial will go through the steps necessary to integrate ROS with Unity, from installing the Unity Editor to creating a scene with an imported URDF to completing a pick-and-place task with known poses using MoveIt trajectory planning.
This tutorial is designed such that you do not need prior experience with Unity or C# in order to follow the scene setup steps, and you do not need prior robotics experience to get started with ROS integration. The tutorial is divided into high-level phases, from basic Unity and ROS initial setup through executing a pick-and-place task.
> Note: This project was built using the ROS Melodic distro and Python 2.
> Note: This project has been tested with Python 2 and ROS Melodic, as well as Python 3 and ROS Noetic.
- [Pick-and-Place Tutorial](#pick-and-place-tutorial)
- [Requirements](#requirements)
- [Part 0: ROS Setup](#part-0-ros-setup)
- [Part 1: Create Unity scene with imported URDF](#part-1-create-unity-scene-with-imported-urdf)
- [Part 2: ROS–Unity Integration](#part-2-rosunity-integration)
- [Part 3: Pick-and-Place](#part-3-pick-and-place)

## Requirements
This repository provides project files for the pick-and-place tutorial, including Unity assets, URDF files, and ROS scripts. Clone this repository to a location on your local machine:
```bash
git clone --recurse-submodules https://github.com/Unity-Technologies/Unity-Robotics-Hub.git
```
---
## [Part 0: ROS Setup](0_ros_setup.md)
<img src="img/0_docker.png" width="400"/>
This part provides two options for setting up your ROS workspace: using Docker, or manually setting up a catkin workspace.
---
## [Part 1: Create Unity scene with imported URDF](1_urdf.md)
<img src="img/1_end.gif" width="400"/>

<img src="img/2_echo.png" width="400"/>
This part assumes you have access to a functional ROS workspace. Steps covered include creating a TCP connection between Unity and ROS, generating C# scripts from a ROS msg and srv files, and publishing to a ROS topic.
This part covers creating a TCP connection between Unity and ROS, generating C# scripts from a ROS msg and srv files, and publishing to a ROS topic.
---

7
tutorials/pick_and_place/Scripts/SourceDestinationPublisher.cs


public class SourceDestinationPublisher : MonoBehaviour
{
// ROS Connector
public ROSConnection ros;
private int numRobotJoints = 6;
private ROSConnection ros;
// Variables required for ROS communication
public string topicName = "SourceDestination_input";

public GameObject targetPlacement;
private int numRobotJoints = 6;
private readonly Quaternion pickOrientation = Quaternion.Euler(90, 90, 0);
// Articulation Bodies

/// </summary>
void Awake()
{
// Get ROS connection static instance
ros = ROSConnection.instance;
jointArticulationBodies = new ArticulationBody[numRobotJoints];
string shoulder_link = "world/base_link/shoulder_link";
jointArticulationBodies[0] = niryoOne.transform.Find(shoulder_link).GetComponent<ArticulationBody>();

15
tutorials/pick_and_place/Scripts/TrajectoryPlanner.cs


public class TrajectoryPlanner : MonoBehaviour
{
// ROS Connector
public ROSConnection ros;
private int numRobotJoints = 6;
private ROSConnection ros;
private int numRobotJoints = 6;
private readonly float jointAssignmentWait = 0.1f;
private readonly float poseAssignmentWait = 0.5f;
private readonly Vector3 pickPoseOffset = Vector3.up * 0.1f;

var leftDrive = leftGripper.xDrive;
var rightDrive = rightGripper.xDrive;
leftDrive.target = 0.01f;
rightDrive.target = -0.01f;
leftDrive.target = -0.01f;
rightDrive.target = 0.01f;
leftGripper.xDrive = leftDrive;
rightGripper.xDrive = rightDrive;

var leftDrive = leftGripper.xDrive;
var rightDrive = rightGripper.xDrive;
leftDrive.target = -0.01f;
rightDrive.target = 0.01f;
leftDrive.target = 0.01f;
rightDrive.target = -0.01f;
leftGripper.xDrive = leftDrive;
rightGripper.xDrive = rightDrive;

/// </summary>
void Awake()
{
// Get ROS connection static instance
ros = ROSConnection.instance;
jointArticulationBodies = new ArticulationBody[numRobotJoints];
string shoulder_link = "world/base_link/shoulder_link";
jointArticulationBodies[0] = niryoOne.transform.Find(shoulder_link).GetComponent<ArticulationBody>();

7
tutorials/pick_and_place/docker/Dockerfile


COPY ./ROS/src/ros_tcp_endpoint $ROS_WORKSPACE/src/ros_tcp_endpoint
COPY ./docker/set-up-workspace /setup.sh
COPY docker/tutorial /
RUN dos2unix /tutorial && dos2unix /setup.sh && chmod +x /setup.sh && /setup.sh && rm /setup.sh
RUN dos2unix /setup.sh && chmod +x /setup.sh && /setup.sh && rm /setup.sh
WORKDIR $ROS_WORKSPACE
ENTRYPOINT ["/tutorial"]
ENTRYPOINT ["/bin/bash"]

3
tutorials/pick_and_place/docker/set-up-workspace


#!/bin/bash
source /opt/ros/melodic/setup.bash
echo "ROS_IP: $(hostname -i)" > $ROS_WORKSPACE/src/niryo_moveit/config/params.yaml
catkin_make
catkin_make

196
tutorials/pick_and_place/img/1_base.png

之前 之后
宽度: 343  |  高度: 431  |  大小: 35 KiB

163
tutorials/pick_and_place/img/1_controller.png

之前 之后
宽度: 424  |  高度: 366  |  大小: 29 KiB

999
tutorials/pick_and_place/img/1_cube.png
文件差异内容过多而无法显示
查看文件

298
tutorials/pick_and_place/img/1_physics.png

之前 之后
宽度: 558  |  高度: 536  |  大小: 70 KiB

1001
tutorials/pick_and_place/img/2_sourcedest.gif
文件差异内容过多而无法显示
查看文件

1001
tutorials/pick_and_place/img/2_target.gif
文件差异内容过多而无法显示
查看文件

1001
tutorials/pick_and_place/img/3_target.gif
文件差异内容过多而无法显示
查看文件

423
tutorials/pick_and_place/img/2_srv.png

之前 之后
宽度: 600  |  高度: 356  |  大小: 66 KiB

126
tutorials/pick_and_place/0_ros_setup.md


# Pick-and-Place Tutorial: Part 0
This part provides two options for setting up your ROS workspace: using Docker, or manually setting up a catkin workspace.
**Table of Contents**
- [Option A: Use Docker](#option-a-use-docker)
- [Option B: Manual Setup](#option-b-manual-setup)
- [Troubleshooting](#troubleshooting)
- [Resources](#resources)
- [Proceed to Part 1](#proceed-to-part-1)
---
If you have not already cloned this project to your local machine, do so now:
```bash
git clone --recurse-submodules https://github.com/Unity-Technologies/Unity-Robotics-Hub.git
```
## Option A: Use Docker
> The Docker-related files (Dockerfile, setup scripts) are located in the [`docker/`](docker/) directory.
1. Follow the steps to install [Docker Engine](https://docs.docker.com/engine/install/) for your platform if it is not already installed.
1. Start the Docker daemon.
> Note: The system-independent `docker info` command can verify whether or not Docker is running. This command will throw a `Server: ERROR` if the Docker daemon is not currently running, and will print the appropriate [system-wide information](https://docs.docker.com/engine/reference/commandline/info/) otherwise.
1. Build the provided ROS Docker image:
```bash
cd /PATH/TO/Unity-Robotics-Hub/tutorials/pick_and_place &&
git submodule update --init --recursive &&
docker build -t unity-robotics:pick-and-place -f docker/Dockerfile .
```
> Note: The provided Dockerfile uses the [ROS Melodic base Image](https://hub.docker.com/_/ros/). Building the image will install the necessary packages, copy the [provided ROS packages and submodules](ROS/) to the container, and build the catkin workspace.
1. Start the newly built Docker container:
```docker
docker run -it --rm -p 10000:10000 -p 5005:5005 unity-robotics:pick-and-place
```
When this is complete, it will print: `Successfully tagged unity-robotics:pick-and-place`. This console should open into a bash shell at the ROS workspace root, e.g. `root@8d88ed579657:/catkin_ws#`.
1. Source your ROS workspace:
```bash
source devel/setup.bash
```
The ROS workspace is now ready to accept commands!
---
## Option B: Manual Setup
1. Navigate to the `/PATH/TO/Unity-Robotics-Hub/tutorials/pick_and_place/ROS` directory of this downloaded repo.
- This directory will be used as the [ROS catkin workspace](http://wiki.ros.org/catkin/Tutorials/using_a_workspace).
- If you cloned the project and forgot to use `--recurse-submodules`, or if any submodule in this directory doesn't have content, you can run the command `git submodule update --init --recursive` to download packages for Git submodules.
- 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:
```bash
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install python-pip ros-melodic-robot-state-publisher ros-melodic-moveit ros-melodic-rosbridge-suite ros-melodic-joy ros-melodic-ros-control ros-melodic-ros-controllers ros-melodic-tf2-web-republisher
sudo -H pip install rospkg jsonpickle
```
ROS Noetic users should run:
```bash
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install python3-pip ros-noetic-robot-state-publisher ros-noetic-moveit ros-noetic-rosbridge-suite ros-noetic-joy ros-noetic-ros-control ros-noetic-ros-controllers
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.
1. The ROS parameters will need to be set to your configuration in order to allow the server endpoint to fetch values for the TCP connection, stored in `src/niryo_moveit/config/params.yaml`. From your ROS workspace, assign the ROS IP in this `yaml` file:
```bash
echo "ROS_IP: $(hostname -I)" > src/niryo_moveit/config/params.yaml
```
> Note: You can also manually assign this value by navigating to the `params.yaml` file and opening it for editing.
```yaml
ROS_IP: <your ROS IP>
```
e.g.
```yaml
ROS_IP: 192.168.50.149
```
The ROS workspace is now ready to accept commands!
---
## Troubleshooting
- Building the Docker image may throw an `Could not find a package configuration file provided by...` exception if one or more of the directories in ROS/ appears empty. Try downloading the submodules again via `git submodule update --init --recursive`.
- `...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 packages.
- 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.
---
## Resources
- [Getting started with Docker](https://docs.docker.com/get-started/)
- Setting up a ROS workspace:
> Note: this tutorial has been tested with ROS Melodic as well as ROS Noetic.
- http://wiki.ros.org/ROS/Installation
- http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
- http://wiki.ros.org/catkin/Tutorials/create_a_workspace
---
### Proceed to [Part 1](1_urdf.md).

1001
tutorials/pick_and_place/img/0_docker.png
文件差异内容过多而无法显示
查看文件

1001
tutorials/pick_and_place/img/0_unity.png
文件差异内容过多而无法显示
查看文件

139
tutorials/pick_and_place/img/1_camera.png

之前 之后
宽度: 586  |  高度: 342  |  大小: 43 KiB

522
tutorials/pick_and_place/img/2_browser.png

之前 之后
宽度: 800  |  高度: 411  |  大小: 93 KiB

92
tutorials/pick_and_place/img/2_menu.png

之前 之后
宽度: 217  |  高度: 73  |  大小: 22 KiB

181
tutorials/pick_and_place/img/2_msg.png

之前 之后
宽度: 600  |  高度: 342  |  大小: 58 KiB

545
tutorials/pick_and_place/img/2_robottraj.png

之前 之后
宽度: 600  |  高度: 652  |  大小: 179 KiB

581
tutorials/pick_and_place/img/2_settings.png

之前 之后
宽度: 500  |  高度: 488  |  大小: 176 KiB

18
tutorials/pick_and_place/docker/tutorial


#!/bin/bash
help()
{
echo "Syntax: $0 [part_2|part_3]"
}
source $ROS_WORKSPACE/devel/setup.bash
echo "ROS_IP: $(hostname -i)" > $ROS_WORKSPACE/src/niryo_moveit/config/params.yaml
if [ $1 == "part_2" ]; then
roslaunch niryo_moveit part_2.launch
elif [ $1 == "part_3" ]; then
roslaunch niryo_moveit part_3.launch
else
help
fi

1001
tutorials/pick_and_place/img/2_component.gif
文件差异内容过多而无法显示
查看文件

221
tutorials/pick_and_place/img/2_single.png

之前 之后

/tutorials/pick_and_place/img/2_gen.png → /tutorials/pick_and_place/img/2_srv.png

正在加载...
取消
保存