Skip to content

Simulation

Assuming:
ROS noetic
Universal Robots Gazebo packages are installed
Run roslaunch ur10e_bringup.launch in a directory with the following files
ur10e_bringup.launch
<?xml version="1.0"?>
<launch>
<!--
Main entry point for loading a single UR10e into Gazebo, in isolation, in the
empty world.

A set of ros_control controllers similar to those loaded by ur_robot_driver
will be loaded by 'ur_control.launch.xml' (note: *similar*, *not* identical).

This bringup .launch file is intentionally given the same name as the one in
the ur_robot_driver package, as it fulfills a similar role: loading the
configuration and starting the necessary ROS nodes which in the end provide
a ROS API to a Universal Robots UR10e. Only in this case, instead of a real
robot, a virtual model in Gazebo is used.

NOTE 1: as this is not a real robot, there are limits to the faithfulness
of the simulation. Dynamic behaviour will be different from a real robot.
Only a subset of topics, actions and services is supported. Specifically,
interaction with the Control Box itself is not supported, as Gazebo does not
simulate a Control Box. This means: no Dashboard server, no URScript topic
and no force-torque sensor among other things.

NOTE 2: users wishing to integrate a UR10e with other models into a more
complex simulation should NOT modify this file. Instead, if it would be
desirable to reuse this file with a custom simulation, they should create a
copy and update this copy so as to accomodate required changes.

In those cases, treat this file as an example, showing one way how a Gazebo
simulation for UR robots *could* be launched. It is not necessary to mimic
this setup completely.
-->

<!--Robot description and related parameter files -->
<arg name="robot_description_file" default="$(find ur_gazebo)/launch/inc/load_ur10e.launch.xml" doc="Launch file which populates the 'robot_description' parameter."/>
<arg name="joint_limit_params" default="$(find ur_description)/config/ur10e/joint_limits.yaml"/>
<arg name="kinematics_params" default="$(find ur_description)/config/ur10e/default_kinematics.yaml"/>
<arg name="physical_params" default="$(find ur_description)/config/ur10e/physical_parameters.yaml"/>
<arg name="visual_params" default="$(find ur_description)/config/ur10e/visual_parameters.yaml"/>
<arg name="transmission_hw_interface" default="hardware_interface/EffortJointInterface" doc="The hardware_interface to expose for each joint in the simulated robot (one of: [hardware_interface/PositionJointInterface, hardware_interface/VelocityJointInterface, hardware_interface/EffortJointInterface])"/>

<!-- Controller configuration -->
<arg name="controller_config_file" default="$(find ur_gazebo)/config/ur10e_controllers.yaml" doc="Config file used for defining the ROS-Control controllers."/>
<arg name="controllers" default="joint_state_controller eff_joint_traj_controller" doc="Controllers that are activated by default."/>
<arg name="stopped_controllers" default="joint_group_eff_controller" doc="Controllers that are initally loaded, but not started."/>

<!-- robot_state_publisher configuration -->
<arg name="tf_prefix" default="" doc="tf_prefix used for the robot."/>
<arg name="tf_pub_rate" default="500" doc="Rate at which robot_state_publisher should publish transforms."/>

<!-- Gazebo parameters -->
<arg name="paused" default="false" doc="Starts Gazebo in paused mode" />
<arg name="gui" default="true" doc="Starts Gazebo gui" />
<arg name="gazebo_world" default="ur10e_bench.world" doc="Gazebo world to load" />

<!-- Load urdf on the parameter server -->
<include file="$(arg robot_description_file)">
<arg name="joint_limit_params" value="$(arg joint_limit_params)"/>
<arg name="kinematics_params" value="$(arg kinematics_params)"/>
<arg name="physical_params" value="$(arg physical_params)"/>
<arg name="visual_params" value="$(arg visual_params)"/>
<arg name="transmission_hw_interface" value="$(arg transmission_hw_interface)"/>
</include>

<!-- Robot state publisher -->
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="$(arg tf_pub_rate)" />
<param name="tf_prefix" value="$(arg tf_prefix)" />
</node>

<!-- Start the 'driver' (ie: Gazebo in this case) -->
<include file="$(dirname)/ur_control.launch.xml">
<arg name="controller_config_file" value="$(arg controller_config_file)"/>
<arg name="controllers" value="$(arg controllers)"/>
<arg name="gui" value="$(arg gui)"/>
<arg name="gazebo_world" value="$(arg gazebo_world)"/>
<arg name="paused" value="$(arg paused)"/>
<arg name="stopped_controllers" value="$(arg stopped_controllers)"/>
</include>
</launch>

ur_control.launch.xml
<?xml version="1.0"?>
<launch>
<!--
This file 'pretends' to load a driver for a UR robot, by accepting similar
arguments and playing a similar role (ie: starting the driver node (in this
case Gazebo) and loading the ros_control controllers).

Some of the arguments to this .launch file will be familiar to those using
the ur_robot_driver with their robot.

Other parameters are specific to Gazebo.

Note: we spawn and start the ros_control controllers here, as they are,
together with gazebo_ros_control, essentially the replacement for the
driver which would be used with a real robot.
-->

<!-- Parameters we share with ur_robot_driver -->
<arg name="controller_config_file" doc="Config file used for defining the ROS-Control controllers."/>
<arg name="controllers" default="joint_state_controller eff_joint_traj_controller"/>
<arg name="stopped_controllers" default="joint_group_eff_controller"/>

<!-- Gazebo parameters -->
<arg name="gazebo_model_name" default="robot" doc="The name to give to the model in Gazebo (after spawning it)." />
<arg name="gazebo_world" default="worlds/empty.world" doc="The '.world' file to load in Gazebo." />
<arg name="gui" default="true" doc="If true, Gazebo UI is started. If false, only start Gazebo server." />
<arg name="paused" default="false" doc="If true, start Gazebo in paused mode. If false, start simulation as soon as Gazebo has loaded." />
<arg name="robot_description_param_name" default="robot_description" doc="Name of the parameter which contains the robot description (ie: URDF) which should be spawned into Gazebo." />
<arg name="spawn_z" default="0.9" doc="At which height the model should be spawned. NOTE: lower values will cause the robot to collide with the ground plane." />
<arg name="start_gazebo" default="true" doc="If true, Gazebo will be started. If false, Gazebo will be assumed to have been started elsewhere." />

<!--Setting initial configuration -->
<arg name="initial_joint_positions" default=" -J shoulder_pan_joint 0.0 -J shoulder_lift_joint -1.57 -J elbow_joint 0.0 -J wrist_1_joint -1.57 -J wrist_2_joint 0.0 -J wrist_3_joint 0.0" doc="Initial joint configuration of the robot"/>

<!-- Load controller settings -->
<rosparam file="$(arg controller_config_file)" command="load"/>

<!-- Start Gazebo and load the empty world if requested to do so -->
<include file="$(find gazebo_ros)/launch/empty_world.launch" if="$(arg start_gazebo)">
<arg name="world_name" value="$(dirname)/ur10e_bench.world"/>
<arg name="paused" value="$(arg paused)"/>
<arg name="gui" value="$(arg gui)"/>
</include>

<!-- Spawn the model loaded earlier in the simulation just started -->
<node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model"
args="
-urdf
-param $(arg robot_description_param_name)
-model $(arg gazebo_model_name)
-z $(arg spawn_z)
$(arg initial_joint_positions)
"
output="screen" respawn="false" />

<!-- Load and start the controllers listed in the 'controllers' arg. -->
<node name="ros_control_controller_spawner" pkg="controller_manager" type="spawner"
args="$(arg controllers)" output="screen" respawn="false" />

<!-- Load other controllers, but do not start them -->
<node name="ros_control_stopped_spawner" pkg="controller_manager" type="spawner"
args="--stopped $(arg stopped_controllers)" output="screen" respawn="false" />

</launch>

ur10e_bench.world
<?xml version="1.0" ?>
<sdf version="1.6">
<world name="default">

<!-- Load physics engine -->
<physics name='default_physics' default='true' type='ode'>
<gravity>0 0 -9.81</gravity>
</physics>

<!-- Light -->
<include>
<uri>model://sun</uri>
</include>

<!-- Ground Plane -->
<include>
<uri>model://ground_plane</uri>
</include>

<!-- Simple bench as a static box -->
<model name="bench">
<static>true</static>
<link name="bench_link">
<collision name="bench_collision">
<geometry>
<box>
<size>1.2 0.8 0.9</size> <!-- LxWxH -->
</box>
</geometry>
<pose>0 0 0 0 0 0</pose>
</collision>
<visual name="bench_visual">
<geometry>
<box>
<size>1.2 0.8 0.9</size>
</box>
</geometry>
<material>
<ambient>0.7 0.5 0.4 1</ambient>
<diffuse>0.7 0.5 0.4 1</diffuse>
</material>
</visual>
</link>
<pose>0 0 0.45 0 0 0</pose>
</model>
</world>
</sdf>

NOTE: PHD Flexion does not have an availale URDF and I did not have time to make one, however given time I would create a parent URDF xacro file that includes the arm and gripper and creates a fixed joint between the robot eef link and the gripper.
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.