Skip to content

Commit 2c997f6

Browse files
Merge branch 'main' into dev
2 parents 8c77224 + 71c090e commit 2c997f6

File tree

8 files changed

+94
-5
lines changed

8 files changed

+94
-5
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
![](images/unity-wide.png)
2-
3-
<p align="center"><img src="images/warehouse.gif" width="800"/></p>
1+
<p align="center"><img src="images/warehouse.gif"/></p>
42

53
# Unity Robotics Hub
64

images/Unity-1200X630.png

38.7 KB
Loading

tutorials/pick_and_place/2_ros_tcp.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ To enable communication between Unity and ROS, a TCP endpoint running as a ROS n
155155

156156
- Replace the `Host Name` value with the IP address of your ROS machine. Ensure that the `Host Port` is set to `10000`.
157157

158+
- 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`.
159+
158160
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.
159161
> 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.
160162

@@ -174,7 +176,31 @@ To enable communication between Unity and ROS, a TCP endpoint running as a ROS n
174176

175177
> Note: This project has been tested with Python 2 and ROS Melodic, as well as Python 3 and ROS Noetic.
176178
177-
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.
179+
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 provideds to launch ROS nodes and services: either using a ROS docker container or doing it manually in your own ROS environment.
180+
181+
### Use Docker Container
182+
183+
1. [Install Docker Engine](https://docs.docker.com/engine/install/)
184+
185+
2. Build the ROS docker image
186+
187+
```bash
188+
cd /YOUR/UNITY-ROBOTICS-HUB/REPOSITORY/tutorials/pick_and_place &&
189+
git submodule update --init --recursive &&
190+
docker build -t unity-robotics:pick-and-place -f docker/Dockerfile .
191+
```
192+
193+
3. Run ROS in a new docker container
194+
195+
```bash
196+
docker run -it --rm -p 10000:10000 -p 5005:5005 unity-robotics:pick-and-place part_2 /bin/bash
197+
```
198+
199+
4. Terminate docker container
200+
201+
Press `Ctrl + C` or `Cmd + C` to terminate the docker container.
202+
203+
### Manually Setup ROS
178204

179205
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:
180206

tutorials/pick_and_place/3_pick_and_place.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ def plan_trajectory(move_group, destination_pose, start_joint_angles):
158158

159159
> 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.
160160

161+
### Use Docker Container
162+
163+
1. If you are using ROS docker container and have not already build the ROS docker image. Follow the steps in [Part 2](2_ros_tcp.md) to build the `unity-robotics:pick-and-place` docker image.
164+
165+
### Manually Setup ROS
166+
161167
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.
162168

163169
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.
@@ -168,6 +174,22 @@ def plan_trajectory(move_group, destination_pose, start_joint_angles):
168174

169175
## ROSUnity Communication
170176

177+
### Use Docker Container
178+
179+
1. If you have not already, [build the ROS docker image](2_ros_tcp.md#use-docker-container) before executing the following command lines.
180+
181+
2. Run ROS in a new docker container
182+
183+
```bash
184+
docker run -it --rm -p 10000:10000 -p 5005:5005 unity-robotics:pick-and-place part_3 /bin/bash
185+
```
186+
187+
3. Terminate docker container
188+
189+
Press `Ctrl + C` or `Cmd + C` to terminate the docker container.
190+
191+
### Manually Setup ROS
192+
171193
1. Open a new terminal window in the ROS workspace. Once again, source the workspace.
172194

173195
Then, run the following `roslaunch` in order to start roscore, set the ROS parameters, start the server endpoint, start the Mover Service node, and launch MoveIt.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
build
22
devel
3-
src/CMakeLists.txt
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ros:melodic-ros-base
2+
3+
RUN sudo apt-get update && sudo apt-get install -y vim iputils-ping net-tools 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 dos2unix
4+
5+
RUN sudo -H pip install rospkg jsonpickle
6+
7+
ENV ROS_WORKSPACE=/catkin_ws
8+
9+
# Copy each directory explicitly to avoid workspace cruft
10+
COPY ./ROS/src/moveit_msgs $ROS_WORKSPACE/src/moveit_msgs
11+
COPY ./ROS/src/niryo_moveit $ROS_WORKSPACE/src/niryo_moveit
12+
COPY ./ROS/src/niryo_one_ros $ROS_WORKSPACE/src/niryo_one_ros
13+
COPY ./ROS/src/niryo_one_urdf $ROS_WORKSPACE/src/niryo_one_urdf
14+
COPY ./ROS/src/ros_tcp_endpoint $ROS_WORKSPACE/src/ros_tcp_endpoint
15+
16+
COPY ./docker/set-up-workspace /setup.sh
17+
COPY docker/tutorial /
18+
19+
RUN dos2unix /tutorial && dos2unix /setup.sh && chmod +x /setup.sh && /setup.sh && rm /setup.sh
20+
21+
ENTRYPOINT ["/tutorial"]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
source /opt/ros/melodic/setup.bash
4+
cd $ROS_WORKSPACE
5+
catkin_make
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
help()
4+
{
5+
echo "Syntax: $0 [part_2|part_3]"
6+
}
7+
8+
source $ROS_WORKSPACE/devel/setup.bash
9+
10+
echo "ROS_IP: $(hostname -i)" > $ROS_WORKSPACE/src/niryo_moveit/config/params.yaml
11+
12+
if [ $1 == "part_2" ]; then
13+
roslaunch niryo_moveit part_2.launch
14+
elif [ $1 == "part_3" ]; then
15+
roslaunch niryo_moveit part_3.launch
16+
else
17+
help
18+
fi

0 commit comments

Comments
 (0)