Skip to content

Commit 3e9aee2

Browse files
AIRO-1617 Private ros params (#348)
* Fixed tutorial * Tutorials updated
1 parent 88bbc9d commit 3e9aee2

File tree

10 files changed

+52
-67
lines changed

10 files changed

+52
-67
lines changed

tutorials/pick_and_place/0_ros_setup.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,6 @@ The ROS workspace is now ready to accept commands!
7474
7575
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.
7676
77-
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:
78-
79-
```bash
80-
echo "ROS_IP: $(hostname -I)" > src/niryo_moveit/config/params.yaml
81-
```
82-
83-
> Note: You can also manually assign this value by navigating to the `params.yaml` file and opening it for editing.
84-
85-
```yaml
86-
ROS_IP: <your ROS IP>
87-
```
88-
89-
e.g.
90-
91-
```yaml
92-
ROS_IP: 192.168.50.149
93-
```
94-
95-
1. (Optional) By default, the server_endpoint will listen on port 10000, but this is also controlled by a parameter. If you need to change it, you can run the command `rosparam set ROS_TCP_PORT 10000`, replacing 10000 with the desired port number.
96-
9777
The ROS workspace is now ready to accept commands!
9878
9979
---
@@ -103,8 +83,6 @@ The ROS workspace is now ready to accept commands!
10383
10484
- `...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.
10585
106-
- 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.
107-
10886
---
10987
11088
## Resources

tutorials/pick_and_place/2_ros_tcp.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,25 @@ Most of the ROS setup has been provided via the `niryo_moveit` package. This sec
174174

175175
> Note: Running `roslaunch` automatically starts [ROS Core](http://wiki.ros.org/roscore) if it is not already running.
176176
177-
> 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/`.
177+
> Note: This launch file has been copied below for reference. The server_endpoint and trajectory_subscriber nodes are launched from this file. The launch files for this project are available in the package's `launch` directory, i.e. `src/niryo_moveit/launch/`.
178178
179179
```xml
180-
<launch>
181-
<rosparam file="$(find niryo_moveit)/config/params.yaml" command="load"/>
182-
<node name="server_endpoint" pkg="niryo_moveit" type="server_endpoint.py" args="--wait" output="screen" respawn="true" />
183-
<node name="trajectory_subscriber" pkg="niryo_moveit" type="trajectory_subscriber.py" args="--wait" output="screen"/>
184-
</launch>
180+
<launch>
181+
<arg name="tcp_ip" default="0.0.0.0"/>
182+
<arg name="tcp_port" default="10000"/>
183+
184+
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true">
185+
<param name="tcp_ip" type="string" value="$(arg tcp_ip)"/>
186+
<param name="tcp_port" type="int" value="$(arg tcp_port)"/>
187+
</node>
188+
<node name="trajectory_subscriber" pkg="niryo_moveit" type="trajectory_subscriber.py" args="--wait" output="screen"/>
189+
</launch>
190+
```
191+
192+
> Note: To use a port other than 10000, or if you want to listen on a more restrictive ip address than 0.0.0.0 (e.g. for security reasons), you can pass those arguments into the roslaunch command like this:
193+
194+
```bash
195+
roslaunch niryo_moveit part_2.launch tcp_ip:=127.0.0.1 tcp_port:=10005
185196
```
186197

187198
This launch will print various messages to the console, including the set parameters and the nodes launched.

tutorials/pick_and_place/3_pick_and_place.md

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

171171
> 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!`.
172172

173+
> Note: As with part 2, you can configure this launch file with a custom IP address or port:
174+
```bash
175+
roslaunch niryo_moveit part_3.launch tcp_ip:=127.0.0.1 tcp_port:=10005
176+
```
177+
178+
173179
1. Return to the Unity Editor and press Play. Press the UI Button to send the joint configurations to ROS, and watch the robot arm pick up and place the cube!
174180
- The target object and placement positions can be moved around during runtime for different trajectory calculations.
175181

tutorials/pick_and_place/4_pick_and_place.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,16 +337,19 @@ void Start()
337337
## Add niryo_moveit Package
338338
The Niryo One ROS stack is already installed on the robot and only the `niryo_moveit` package will need to be added.
339339

340-
1. Update the `niryo_moveit/config/params.yml` file's `ROS_IP` parameter to match that of the Niryo One.
341-
342340
1. Copy the `niryo_moveit` package to the `catkin_ws` directory on the Niryo One's catkin workspace at `/home/niryo/catkin_ws` and run the `catkin_make` command.
343341

344342
> Using the SCP command to transfer the `niryo_moveit` package might look something like, `scp -r ~/PATH/TO/niryo_moveit niryo@NIRYO_IP_ADDRESS:/home/niryo/catkin_ws/src`
345343

346344
# Execution
347-
1. Use the `part_4.launch` file to setup the ROS params and start the `server_endpoint` and `sim_real_pnp` scripts.
345+
1. Use the `part_4.launch` file to start the `server_endpoint` and `sim_real_pnp` scripts.
348346
- `roslaunch niryo_moveit part_4.launch`
349347

348+
> Note: As with previous parts, you can configure this launch file with a custom IP address or port:
349+
```bash
350+
roslaunch niryo_moveit part_4.launch tcp_ip:=127.0.0.1 tcp_port:=10005
351+
```
352+
350353
1. Return to the Unity Editor and press Play. Press the UI Button to send the joint configurations to ROS on the Niryo One, and watch the robot arm move simultaneously in simulation and real life!
351354

352355

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<launch>
2-
<rosparam file="$(find niryo_moveit)/config/params.yaml" command="load"/>
3-
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true" />
2+
<arg name="tcp_ip" default="0.0.0.0"/>
3+
<arg name="tcp_port" default="10000"/>
4+
5+
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true">
6+
<param name="tcp_ip" type="string" value="$(arg tcp_ip)"/>
7+
<param name="tcp_port" type="int" value="$(arg tcp_port)"/>
8+
</node>
49
<node name="trajectory_subscriber" pkg="niryo_moveit" type="trajectory_subscriber.py" args="--wait" output="screen"/>
510
</launch>
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<launch>
2-
<rosparam file="$(find niryo_moveit)/config/params.yaml" command="load"/>
3-
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true" />
2+
<arg name="tcp_ip" default="0.0.0.0"/>
3+
<arg name="tcp_port" default="10000"/>
4+
5+
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true">
6+
<param name="tcp_ip" type="string" value="$(arg tcp_ip)"/>
7+
<param name="tcp_port" type="int" value="$(arg tcp_port)"/>
8+
</node>
49
<node name="mover" pkg="niryo_moveit" type="mover.py" args="--wait" output="screen"/>
510
<include file="$(find niryo_moveit)/launch/demo.launch" />
611
</launch>
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<launch>
2-
<rosparam file="$(find niryo_moveit)/config/params.yaml" command="load"/>
3-
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true" />
2+
<arg name="tcp_ip" default="0.0.0.0"/>
3+
<arg name="tcp_port" default="10000"/>
4+
5+
<node name="server_endpoint" pkg="ros_tcp_endpoint" type="default_server_endpoint.py" args="--wait" output="screen" respawn="true">
6+
<param name="tcp_ip" type="string" value="$(arg tcp_ip)"/>
7+
<param name="tcp_port" type="int" value="$(arg tcp_port)"/>
8+
</node>
49
<node name="sim_real_pnp" pkg="niryo_moveit" type="sim_real_pnp.py" args="--wait" output="screen"/>
510
</launch>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22

33
source /opt/ros/melodic/setup.bash
4-
echo "ROS_IP: $(hostname -i)" > $ROS_WORKSPACE/src/ros-tcp-endpoint/config/params.yaml
54
cd $ROS_WORKSPACE
65
catkin_make
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22

33
source /opt/ros/$ROS_DISTRO/setup.bash
4-
echo "ROS_IP: 0.0.0.0" > $ROS_WORKSPACE/src/ros_tcp_endpoint/config/params.yaml
54
cd $ROS_WORKSPACE
65
catkin_make

tutorials/ros_unity_integration/setup.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,12 @@ Follow these steps to use ROS (melodic or noetic):
2424

2525
```bash
2626
source devel/setup.bash
27-
roscore
28-
```
29-
30-
Once ROS Core has started, it will print `started core service [/rosout]` to the terminal window.
31-
32-
3. In your previous terminal, run the following command, replacing the `<your IP address>` with your ROS machine's IP or hostname.
33-
34-
```bash
35-
rosparam set ROS_IP <your IP address>
36-
```
37-
38-
- If you're running ROS in a Docker container, you can just use `rosparam set ROS_IP 0.0.0.0`
39-
- On Linux you can find out your IP address with the command `hostname -I`
40-
- On MacOS you can find out your IP address with `ipconfig getifaddr en0`
41-
42-
6. (Optional) By default, the server_endpoint will listen on port 10000, but this is also controlled by a parameter. If you need to change it, you can run the command `rosparam set ROS_TCP_PORT 10000`, replacing 10000 with the desired port number.
43-
44-
7. Start the server endpoint with the following command:
45-
46-
```bash
47-
rosrun ros_tcp_endpoint default_server_endpoint.py
27+
roslaunch ros_tcp_endpoint endpoint.launch
4828
```
4929

5030
Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`.
5131

52-
> Note, for this tutorial we have illustrated how to do everything manually, but for day-to-day use, we recommend starting the endpoint with a launch file. Replace all the above (including the roscore step) with the following command: `roslaunch ros_tcp_endpoint endpoint.launch`.
53-
> While using this launch file, your ROS_IP and ROS_TCP_PORT parameters are read from the file src/ros_tcp_endpoint/config/params.yaml. You can edit this file to adjust your settings - for example, this command will set the appropriate IP address for your machine:
54-
> `echo "ROS_IP: $(hostname -i)" > src/ros-tcp-endpoint/config/params.yaml`
55-
56-
> Read more about rosparam YAML options [here](http://wiki.ros.org/rosparam).
57-
>
58-
> Read more about the ROS Parameter Server [here](http://wiki.ros.org/Parameter%20Server).
32+
> Note, By default, the server_endpoint will listen on ip 0.0.0.0 (i.e. allowing all incoming addresses) and port 10000, but these settings are configurable. To override them, you can change the command to `roslaunch ros_tcp_endpoint endpoint.launch tcp_ip:=127.0.0.1 tcp_port:=10000` (obviously replacing 127.0.0.1 with your desired IP and 10000 with your desired port number.)
5933
6034
## <img src="images/ros2_icon.png" alt="ros2" width="46" height="28"/> ROS2 Environment
6135

0 commit comments

Comments
 (0)