From e92d992ae133bd996d528e62a51f8995365d3b24 Mon Sep 17 00:00:00 2001 From: LaurieCheers <73140792+LaurieCheers-unity@users.noreply.github.com> Date: Fri, 21 Jan 2022 15:59:33 -0800 Subject: [PATCH 1/2] Fixed tutorial --- .../ros_docker/set-up-workspace | 1 - tutorials/ros_unity_integration/setup.md | 30 ++----------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/tutorials/ros_unity_integration/ros_docker/set-up-workspace b/tutorials/ros_unity_integration/ros_docker/set-up-workspace index 3aaa96a2..5d607eb6 100644 --- a/tutorials/ros_unity_integration/ros_docker/set-up-workspace +++ b/tutorials/ros_unity_integration/ros_docker/set-up-workspace @@ -1,6 +1,5 @@ #!/bin/bash source /opt/ros/$ROS_DISTRO/setup.bash -echo "ROS_IP: 0.0.0.0" > $ROS_WORKSPACE/src/ros_tcp_endpoint/config/params.yaml cd $ROS_WORKSPACE catkin_make \ No newline at end of file diff --git a/tutorials/ros_unity_integration/setup.md b/tutorials/ros_unity_integration/setup.md index 0b0ad5f8..bede9048 100644 --- a/tutorials/ros_unity_integration/setup.md +++ b/tutorials/ros_unity_integration/setup.md @@ -24,38 +24,12 @@ Follow these steps to use ROS (melodic or noetic): ```bash source devel/setup.bash - roscore - ``` - - Once ROS Core has started, it will print `started core service [/rosout]` to the terminal window. - -3. In your previous terminal, run the following command, replacing the `` with your ROS machine's IP or hostname. - - ```bash - rosparam set ROS_IP - ``` - - - If you're running ROS in a Docker container, you can just use `rosparam set ROS_IP 0.0.0.0` - - On Linux you can find out your IP address with the command `hostname -I` - - On MacOS you can find out your IP address with `ipconfig getifaddr en0` - -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. - -7. Start the server endpoint with the following command: - - ```bash - rosrun ros_tcp_endpoint default_server_endpoint.py + roslaunch ros_tcp_endpoint endpoint.launch ``` Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`. -> 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`. -> 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: -> `echo "ROS_IP: $(hostname -i)" > src/ros-tcp-endpoint/config/params.yaml` - -> Read more about rosparam YAML options [here](http://wiki.ros.org/rosparam). -> -> Read more about the ROS Parameter Server [here](http://wiki.ros.org/Parameter%20Server). +> 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.) ## ros2 ROS2 Environment From e50aec7ba581706716548160379fed06fca0d9fb Mon Sep 17 00:00:00 2001 From: LaurieCheers <73140792+LaurieCheers-unity@users.noreply.github.com> Date: Mon, 24 Jan 2022 13:20:34 -0800 Subject: [PATCH 2/2] Tutorials updated --- tutorials/pick_and_place/0_ros_setup.md | 22 ------------------ tutorials/pick_and_place/2_ros_tcp.md | 23 ++++++++++++++----- tutorials/pick_and_place/3_pick_and_place.md | 6 +++++ tutorials/pick_and_place/4_pick_and_place.md | 9 +++++--- .../ROS/src/niryo_moveit/launch/part_2.launch | 9 ++++++-- .../ROS/src/niryo_moveit/launch/part_3.launch | 9 ++++++-- .../ROS/src/niryo_moveit/launch/part_4.launch | 9 ++++++-- .../pick_and_place/docker/set-up-workspace | 1 - 8 files changed, 50 insertions(+), 38 deletions(-) diff --git a/tutorials/pick_and_place/0_ros_setup.md b/tutorials/pick_and_place/0_ros_setup.md index ad785cab..8381a2fe 100644 --- a/tutorials/pick_and_place/0_ros_setup.md +++ b/tutorials/pick_and_place/0_ros_setup.md @@ -74,26 +74,6 @@ The ROS workspace is now ready to accept commands! 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: - ``` - - e.g. - - ```yaml - ROS_IP: 192.168.50.149 - ``` - -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. - The ROS workspace is now ready to accept commands! --- @@ -103,8 +83,6 @@ The ROS workspace is now ready to accept commands! - `...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 diff --git a/tutorials/pick_and_place/2_ros_tcp.md b/tutorials/pick_and_place/2_ros_tcp.md index a4d50fa0..e81051dc 100644 --- a/tutorials/pick_and_place/2_ros_tcp.md +++ b/tutorials/pick_and_place/2_ros_tcp.md @@ -174,14 +174,25 @@ Most of the ROS setup has been provided via the `niryo_moveit` package. This sec > Note: Running `roslaunch` automatically starts [ROS Core](http://wiki.ros.org/roscore) if it is not already running. - > 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/`. + > 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/`. ```xml - - - - - + + + + + + + + + + + ``` + + > 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: + + ```bash + roslaunch niryo_moveit part_2.launch tcp_ip:=127.0.0.1 tcp_port:=10005 ``` This launch will print various messages to the console, including the set parameters and the nodes launched. diff --git a/tutorials/pick_and_place/3_pick_and_place.md b/tutorials/pick_and_place/3_pick_and_place.md index a0b5a4b0..7f1611f4 100644 --- a/tutorials/pick_and_place/3_pick_and_place.md +++ b/tutorials/pick_and_place/3_pick_and_place.md @@ -170,6 +170,12 @@ def plan_trajectory(move_group, destination_pose, start_joint_angles): > 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!`. + > Note: As with part 2, you can configure this launch file with a custom IP address or port: + ```bash + roslaunch niryo_moveit part_3.launch tcp_ip:=127.0.0.1 tcp_port:=10005 + ``` + + 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! - The target object and placement positions can be moved around during runtime for different trajectory calculations. diff --git a/tutorials/pick_and_place/4_pick_and_place.md b/tutorials/pick_and_place/4_pick_and_place.md index f23beed4..46afe357 100644 --- a/tutorials/pick_and_place/4_pick_and_place.md +++ b/tutorials/pick_and_place/4_pick_and_place.md @@ -337,16 +337,19 @@ void Start() ## Add niryo_moveit Package The Niryo One ROS stack is already installed on the robot and only the `niryo_moveit` package will need to be added. -1. Update the `niryo_moveit/config/params.yml` file's `ROS_IP` parameter to match that of the Niryo One. - 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. > 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` # Execution -1. Use the `part_4.launch` file to setup the ROS params and start the `server_endpoint` and `sim_real_pnp` scripts. +1. Use the `part_4.launch` file to start the `server_endpoint` and `sim_real_pnp` scripts. - `roslaunch niryo_moveit part_4.launch` + > Note: As with previous parts, you can configure this launch file with a custom IP address or port: + ```bash + roslaunch niryo_moveit part_4.launch tcp_ip:=127.0.0.1 tcp_port:=10005 + ``` + 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! diff --git a/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_2.launch b/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_2.launch index 4c28027d..544f5cad 100644 --- a/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_2.launch +++ b/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_2.launch @@ -1,5 +1,10 @@ - - + + + + + + + \ No newline at end of file diff --git a/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_3.launch b/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_3.launch index b3b40711..ee1a7cc6 100644 --- a/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_3.launch +++ b/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_3.launch @@ -1,6 +1,11 @@ - - + + + + + + + \ No newline at end of file diff --git a/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_4.launch b/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_4.launch index 432407c3..5ff51476 100644 --- a/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_4.launch +++ b/tutorials/pick_and_place/ROS/src/niryo_moveit/launch/part_4.launch @@ -1,5 +1,10 @@ - - + + + + + + + \ No newline at end of file diff --git a/tutorials/pick_and_place/docker/set-up-workspace b/tutorials/pick_and_place/docker/set-up-workspace index 9eee40eb..2920326c 100644 --- a/tutorials/pick_and_place/docker/set-up-workspace +++ b/tutorials/pick_and_place/docker/set-up-workspace @@ -1,6 +1,5 @@ #!/bin/bash source /opt/ros/melodic/setup.bash -echo "ROS_IP: $(hostname -i)" > $ROS_WORKSPACE/src/ros-tcp-endpoint/config/params.yaml cd $ROS_WORKSPACE catkin_make