You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/pick_and_place/2_ros_tcp.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,7 +146,7 @@ To enable communication between Unity and ROS, a TCP endpoint running as a ROS n
146
146
147
147
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.
148
148
149
-
> Note: While using the ROS Settings menu is the suggested workflow, you may still manually create a GameObject with an attached ROSConnection component.
149
+
> Note: While using the ROS Settings menu is the suggested workflow as of this version, you may still manually create a GameObject with an attached ROSConnection component.
150
150
151
151
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.
152
152
> 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.
The `ros_node_name` is required and the `buffer_size` and `connections` are optional. They are set to `1024` and `10` by default if not provided in the constructor arguments.
59
+
The `ros_node_name`argument is required and the `buffer_size` and `connections` are optional. They are set to `1024` and `10` by default if not provided in the constructor arguments.
63
60
64
-
## Source Destination Dictionary
61
+
## Instantiate the ROS Node
65
62
66
-
Create a dictionary keyed by topic or service with the corresponding ROS communication class as the value. The dictionary is used by the TCP server to direct messages to and from the ROS network.
- ROS Service class generated from running `catkin_make` command
79
+
## Source Destination Dictionary
81
80
82
-
`RosService('position_service', PositionService)`
81
+
The argument to start() is a dictionary keyed by topic or service with the corresponding ROS communication class as the value. The dictionary is used by the TCP server to direct messages to and from the ROS network.
83
82
84
83
## ROS Publisher
85
-
A ROS Publisher requires three components:
84
+
A ROS Publisher allows a Unity component to send messages on a given topic to other ROS nodes. It requires three components:
86
85
87
86
- Topic name
88
87
- ROS message class generated from running `catkin_make` command
89
-
- Queue size
88
+
- Queue size (optional)
90
89
91
90
`RosPublisher('pos_rot', PosRot, queue_size=10)`
92
91
93
92
## ROS Subscriber
94
-
A ROS Subscriber requires three components:
93
+
A ROS Subscriber allows a Unity component to receive messages from other ROS nodes on a given topic. It requires three components:
95
94
96
95
- Topic name
97
96
- ROS message class generated from running `catkin_make` command
98
97
- The tcp server that will connect to Unity
99
98
100
99
`RosSubscriber('color', UnityColor, tcp_server)`
101
100
102
-
## Instantiate the ROS Node
101
+
## ROS Service
102
+
A ROS Service is similar to a RosPublisher, in that a Unity component sends a Request message to another ROS node. Unlike a Publisher, the Unity component then waits for a Response back. It requires two components:
103
103
104
-
```python
105
-
rospy.init_node(ros_node_name, anonymous=True)
106
-
```
104
+
- Service name
105
+
- ROS Service class generated from running `catkin_make` command
107
106
108
-
## Starting the Server
107
+
`RosService('position_service', PositionService)`
108
+
109
+
## Unity Service
110
+
111
+
A Unity Service is similar to a RosSubscriber, in that a Unity component receives a Request message from another ROS node. It then sends a Response back. It requires three components:
112
+
113
+
- Service name
114
+
- ROS Service class generated from running `catkin_make` command
The following parameters can be hardcoded, but for the sake of portability, we recommend setting the parameters using the `rosparam set` command, or a `rosparam` YAML file.
118
123
@@ -132,7 +137,7 @@ An example launch file that will set the appropriate ROSPARAM values required fo
0 commit comments