robotraconteur-contrib / robotraconteur_training_sim

4 stars 2 forks source link

Robot Raconteur Training Simulator

The Robot Raconteur Training Simulator is a Gazebo based simulator designed to help users learn Robot Raconteur. It provides simulated devices and Robot Raconteur device drivers.

simulator window 2ur5e simulator window multi robot simulator window create

Table of Contents:

Introduction

The Robot Raconteur Training Simulator is a Gazebo based simulator that contains three scenes:

Universal Robot UR5e Scene

Multi Robot Scene

iRobot Create Scene

Connection Info

The training simulator provides multiple Robot Raconteur services. This section contains the default Robot Raconteur connection information for clients to connect to the service. Also see the Robot Raconteur Service Browser to detect services on the network. The services can be connected using a URL, Discovery, or Subscriptions. See the Robot Raconteur documentation for more information on connecting to services.

2ur5e Scene Connection Info

Multi Robot Scene Connection Info

iRobot Create Scene Connection Info

Use examples in https://github.com/robotraconteur/RobotRaconteur_Python_Examples to operate the iRobot Create scene.

Installation

Windows

Download and install Miniforge for Python 3.11 from https://github.com/conda-forge/miniforge?tab=readme-ov-file#download .

Open the Miniforge3 prompt by clicking Start -> Miniforge3 -> Miniforge Prompt

In the terminal, run the following to install the simulator:

conda create -c conda-forge -c robotraconteur -c wasontech -n rr_training_sim robotraconteur_training_sim

Linux

Download and install Miniforge for Python 3.11 from https://github.com/conda-forge/miniforge?tab=readme-ov-file#download .

The Linux installer will configure your system to start conda by default in new terminals. This can be disabled with the following command:

conda config --set auto_activate_base false

In a new terminal, run the following to install the simulator:

source ~/miniforge3/bin/activate
conda create -c conda-forge -c robotraconteur -c wasontech -n rr_training_sim robotraconteur_training_sim

Running the iRobot Create Simulation

The iRobot Create scene only contains the simulation. The simulated drivers are contained in the Python Examples repository. See https://github.com/robotraconteur/RobotRaconteur_Python_Examples

Windows

A shortcut is created in the Start menu on Windows. Click Start -> Robot Raconteur Training Sim -> RR Training Sim (create)

To run the simulation from the command line, open the Miniforge3 prompt by clicking Start -> Miniforge3 -> Miniforge Prompt

Run the following command:

conda activate rr_training_sim
run_create_sim

Linux

Open a new prompt and run the following commands to run the simulation:

source ~/miniforge3/bin/activate
conda activate rr_training_sim
run_create_sim

Running the UR5e Simulation

Windows

A shortcut is created in the Start menu on Windows. Click Start -> Robot Raconteur Training Sim -> RR Training Sim (2ur5e)

To run the simulation from the command line, open the Miniforge3 prompt by clicking Start -> Miniforge3 -> Miniforge Prompt

Run the following command:

conda activate rr_training_sim
run_2ur5e_sim   

Linux

Open a new prompt and run the following commands to run the simulation:

source ~/miniforge3/bin/activate
conda activate rr_training_sim
run_2ur5e_sim

UR5e Example Scripts

The simulator comes with several Robot Raconteur driver client example scripts. In a terminal with the rr_training_sim conda environment active, such as the one used to start the simulator, run the following to cd to the directory containing the scripts:

Windows:

cd %CONDA_PREFIX%\gz_example\example_scripts

Linux:

cd $CONDA_PREFIX/gz_example/example_scripts

Robot Motion Examples

Jog example ur5_client_jog_freespace.py - A client commanding the robot using the jog_freespace command.

python ur5_client_jog_freespace.py

Position command example ur5_client_position_command.py - A client commanding the robot using the position_command wire member.

python ur5_client_position_command.py

Trajectory command example ur5_client_trajectory.py - A client commanding the robot using the execute_trajectory member generator function.

python ur5_client_trajectory.py

Camera Client Examples

Camera single frame synchronous capture camera_client_captureframe.py - An example camera client that synchronously captures a frame from the overhead camera.

python camera_client_captureframe.py

Camera streaming camera_client_image.py - An example camera client that streams a preview of the overhead camera.

Running the Multi Robot Simulation

Windows

A shortcut is created in the Start menu on Windows. Click Start -> Robot Raconteur Training Sim -> RR Training Sim (multi robot)

To run the simulation from the command line, open the Miniforge3 prompt by clicking Start -> Miniforge3 -> Miniforge Prompt

Run the following command:

conda activate rr_training_sim
run_multi_robot_sim   

Linux

Open a new prompt and run the following commands to run the simulation:

source ~/miniforge3/bin/activate
conda activate rr_training_sim
run_multi_robot_sim

PyRI Programming Environment

The PyRI Open-Source Programming Environment and Teach Pendant can be used to operate and program the devices training simulator. It can manipulate the robots, operate the tools, and read the camera. It can also program the robots using restricted Python and Blockly. See https://github.com/pyri-project/pyri-core/blob/master/README.md

Troubleshooting

See the log files for the output of processes. On Windows, these are located at %LOCALAPPDATA%\drekar-launch\drekar-launch\Logs . On Linux the logs are located at $HOME/.cache/drekar-launch/log .

Gazebo won't start

Sometimes gzserver fails to quit properly. On Linux, run killall gzserver. On Windows, use the Task Manager -> Details tab to kill gzserver.

Gazebo or Drivers fail to start again after closing all windows

Linux sockets have a behavior called TIME_WAIT, which means the socket will remain open for a few minutes after the program has exited. This can be checked using the command netstat -an | grep TIME_WAIT. Try waiting a few minutes before restarting the simulation, or reboot the computer.

Connection Refused when trying to connect using a script

Check to make sure the drivers have all opened properly. Check the log files to make sure that all the processes are operating correctly. More debug information is available if the simulations are launched from the command line. Check the connection info in the section above for the simulation. Real devices will have different connection URLs and other values. Check the driver documentation for more information on connecting. Use the Robot Raconteur Service Browser to see if the driver is discoverable on the network. Try (temporarily) disabling the firewall if networking between computers is being used.

Acknowledgment

This work was supported in part bythe Advanced Robotics for Manufacturing ("ARM") Institute under Agreement Number W911NF-17-3-0004 sponsored by the Office of the Secretary of Defense. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of either ARM or the Office of the Secretary of Defense of the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes, notwithstanding any copyright notation herein.

This work was supported in part by the New York State Empire State Development Division of Science, Technology and Innovation (NYSTAR) under contract C160142.