ROS Incorporation - siemens/evaluation-framework GitHub Wiki

2.2 Incorporation of ROS into the Evaluation Framework

Exemplary Use Case

The idea behind the combination of the Evaluation Framework and ROS developed during Michael Dyck's master's thesis was the evaluation of different robot positions and their suitability for a specific robotic bin picking scenario using the Franka Emika Panda robot. Since the bin picking required complex robot motion, planning of the trajectories was done in ROS MoveIt. The initial trajectory of the bin picking process was solely defined by seven Cartesian waypoints and planned using ROS' GetCartesianPath service. Repositioning the robot was then simulated by moving the Cartesian waypoints on the trajectory in the opposite direction of the shift of the robot position and replanning the trajectory for each robot position.

To this end, a combination of both software libraries seemed most suitable:

  • Define all robot positions as EvaluationParameters using the Evaluation Framework's Unity component (see here for an example)
  • Plan all trajectories (in this case based on fixed Cartesian positions) for all these robot positions
  • Simulate all trajectories in Unity and evaluate desired ObjectiveValues.

Application Setup

In order to understand how to use the Evaluation Framework alongside ROS, the setup of the use case introduced above will be explained briefly.

  • As explained here, the EvaluationFrameworkROSUnity folder has to be copied into the Assets-folder of the Unity project
  • Equivalently to defining the Evaluation Space as described in this application example (without the use of ROS), the EvaluationParameters have to be defined. In this use case, the x-, y- and z-position of the robot socket were selected.
  • In contrast to the general workflow of defining the Evaluation Space, in the next step the so-called ROSParameters have to be defined in the exact same manner as is done for the EvaluationParameters and ObjectiveValues. ROSParamaters represent parameters, i.e. variables of Components of GameObjects in the Unity scene, whose values will be provided from an external ROS system. In the use case explained above, these ROSParameters represented the time stamps, positions, velocities and accelerations of the Panda robot on all discrete robot configurations on the trajectories calculated by ROS MoveIt.
  • Finally, as usual, several desired ObjectiveValues have to be specified in Unity. The remaining process of defining the Evaluation Space is equivalent to the usual usage of the Evaluation Framework (see here).

Usage

  • Define the Evaluation Space using EvaluationFrameworkROSUnity as described above
  • Setup the ROS system with ROS# as described here
  • On the ROS system, two commands have to be executed:
    • websocket node: roslaunch rosbridge_server rosbridge_websocket.launch
    • any use case specific ROS node. In the application introduced above, the following MoveIt! node was started: roslaunch panda_moveit_config demo.launch
  • Navigate to the folder EvaluationFrameworkROS
  • Open the command line and launch the executable of the .NET solution by typing (NameOfTheEvaluationToSimulate is the previously specified name when defining the evaluation space):
bin\Release\netcoreapp3.1\EvaluationFrameworkROS.exe -evaluationName [NameOfTheEvaluationToSimulate]

Workflow

Following the above steps, the following things happen (with examples referring to the use case introduced above):

  1. As it is the case without ROS communication, the EvaluationFramework computes a grid of all combinations of EvaluationParameters defined in Unity in the previous step.
  2. Using the RosBridgeClient of ROS#, a connection between the Evaluation Framework's .NET solution (EvaluationFrameworkROS) and the respective ROS system is established, using rosbridge_suite.
  3. An application-specific ROS client connects to the websocket of the ROS system. In the application presented here, ROS#'s MoveGroupAction using ROS' MoveGroup interface is used.
  4. From now on, the workflow is very application-specific. Here, every combination of EvaluationParameters, i.e. every robot position, is successively send to the ROS MoveIt node using different services and messages. As a result the planned trajectories for each robot position, consisting of discrete joint configurations (timings, positions, velocities, accelerations for each configuration) are returned to the .NET solution of the Evaluation Framework.
  5. After all ROS-sided calculations are finished, the websocket is closed an the communication to the ROS system is terminated.
  6. From now on, the remaining workflow of the Evaluation Framework is similar to the one without ROS incorporation: The Unity executable of the project is called for every combination of EvaluationParameters, and additionally all specified ROSParameters (in this case, the different parameters of all generated trajectories) are sent to the executable and used in simulation.

Further Information

In order to adapt the code inside EvaluationFrameworkROS to your specific use case, please have a closer look at the following files:


© Siemens AG, 2020

Author: Michael Dyck ([email protected])