Skip to content

Commit ad3cb7c

Browse files
authored
Merge pull request #141 from isys-vision/robot_status
Robot status topic via controller
2 parents 5eca7f7 + e03bb3f commit ad3cb7c

14 files changed

+156
-2
lines changed

ur_robot_driver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ find_package(catkin REQUIRED
1515
controller_manager
1616
geometry_msgs
1717
hardware_interface
18+
industrial_robot_status_interface
1819
pluginlib
1920
roscpp
2021
sensor_msgs

ur_robot_driver/config/ur10_controllers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,8 @@ vel_traj_controller:
139139
joint_group_vel_controller:
140140
type: velocity_controllers/JointGroupVelocityController
141141
joints: *robot_joints
142+
143+
robot_status_controller:
144+
type: industrial_robot_status_controller/IndustrialRobotStatusController
145+
handle_name: industrial_robot_status_handle
146+
publish_rate: 10

ur_robot_driver/config/ur10e_controllers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,8 @@ vel_traj_controller:
139139
joint_group_vel_controller:
140140
type: velocity_controllers/JointGroupVelocityController
141141
joints: *robot_joints
142+
143+
robot_status_controller:
144+
type: industrial_robot_status_controller/IndustrialRobotStatusController
145+
handle_name: industrial_robot_status_handle
146+
publish_rate: 10

ur_robot_driver/config/ur3_controllers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,8 @@ vel_traj_controller:
140140
joint_group_vel_controller:
141141
type: velocity_controllers/JointGroupVelocityController
142142
joints: *robot_joints
143+
144+
robot_status_controller:
145+
type: industrial_robot_status_controller/IndustrialRobotStatusController
146+
handle_name: industrial_robot_status_handle
147+
publish_rate: 10

ur_robot_driver/config/ur3e_controllers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,8 @@ vel_traj_controller:
139139
joint_group_vel_controller:
140140
type: velocity_controllers/JointGroupVelocityController
141141
joints: *robot_joints
142+
143+
robot_status_controller:
144+
type: industrial_robot_status_controller/IndustrialRobotStatusController
145+
handle_name: industrial_robot_status_handle
146+
publish_rate: 10

ur_robot_driver/config/ur5_controllers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,8 @@ vel_traj_controller:
139139
joint_group_vel_controller:
140140
type: velocity_controllers/JointGroupVelocityController
141141
joints: *robot_joints
142+
143+
robot_status_controller:
144+
type: industrial_robot_status_controller/IndustrialRobotStatusController
145+
handle_name: industrial_robot_status_handle
146+
publish_rate: 10

ur_robot_driver/config/ur5e_controllers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,8 @@ vel_traj_controller:
139139
joint_group_vel_controller:
140140
type: velocity_controllers/JointGroupVelocityController
141141
joints: *robot_joints
142+
143+
robot_status_controller:
144+
type: industrial_robot_status_controller/IndustrialRobotStatusController
145+
handle_name: industrial_robot_status_handle
146+
publish_rate: 10

ur_robot_driver/include/ur_robot_driver/ros/hardware_interface.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
#include <ur_dashboard_msgs/RobotMode.h>
5555
#include <ur_dashboard_msgs/SafetyMode.h>
5656

57+
#include <industrial_robot_status_interface/industrial_robot_status_interface.h>
58+
5759
namespace ur_driver
5860
{
5961
/*!
@@ -179,6 +181,12 @@ class HardwareInterface : public hardware_interface::RobotHW
179181
void publishToolData();
180182
void publishRobotAndSafetyMode();
181183

184+
/*!
185+
* \brief Read and evaluate data in order to set robot status properties for industrial
186+
* robot status interface
187+
*/
188+
void extractRobotStatus();
189+
182190
bool stopControl(std_srvs::TriggerRequest& req, std_srvs::TriggerResponse& res);
183191

184192
template <typename T>
@@ -242,6 +250,8 @@ class HardwareInterface : public hardware_interface::RobotHW
242250
std::vector<std::string> joint_names_;
243251
int32_t robot_mode_;
244252
int32_t safety_mode_;
253+
std::bitset<4> robot_status_bits_;
254+
std::bitset<11> safety_status_bits_;
245255

246256
std::unique_ptr<realtime_tools::RealtimePublisher<tf2_msgs::TFMessage>> tcp_pose_pub_;
247257
std::unique_ptr<realtime_tools::RealtimePublisher<ur_msgs::IOStates>> io_pub_;
@@ -254,6 +264,9 @@ class HardwareInterface : public hardware_interface::RobotHW
254264
ros::ServiceServer resend_robot_program_srv_;
255265
ros::Subscriber command_sub_;
256266

267+
industrial_robot_status_interface::RobotStatus robot_status_resource_{};
268+
industrial_robot_status_interface::IndustrialRobotStatusInterface robot_status_interface_{};
269+
257270
uint32_t runtime_state_;
258271
bool position_controller_running_;
259272
bool velocity_controller_running_;

ur_robot_driver/include/ur_robot_driver/rtde/rtde_client.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,29 @@ namespace ur_driver
4848
{
4949
namespace rtde_interface
5050
{
51+
enum class UrRtdeRobotStatusBits
52+
{
53+
IS_POWER_ON = 0,
54+
IS_PROGRAM_RUNNING = 1,
55+
IS_TEACH_BUTTON_PRESSED = 2,
56+
IS_POWER_BUTTON_PRESSED = 3
57+
};
58+
59+
enum class UrRtdeSafetyStatusBits
60+
{
61+
IS_NORMAL_MODE = 0,
62+
IS_REDUCED_MODE = 1,
63+
IS_PROTECTIVE_STOPPED = 2,
64+
IS_RECOVERY_MODE = 3,
65+
IS_SAFEGUARD_STOPPED = 4,
66+
IS_SYSTEM_EMERGENCY_STOPPED = 5,
67+
IS_ROBOT_EMERGENCY_STOPPED = 6,
68+
IS_EMERGENCY_STOPPED = 7,
69+
IS_VIOLATION = 8,
70+
IS_FAULT = 9,
71+
IS_STOPPED_DUE_TO_SAFETY = 10
72+
};
73+
5174
/*!
5275
* \brief The RTDEClient class manages communication over the RTDE interface. It contains the RTDE
5376
* handshake and read and write functionality to and from the robot.

ur_robot_driver/launch/ur_common.launch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<arg name="script_sender_port" default="50002" doc="The driver will offer an interface to receive the program's URScript on this port. If the robot cannot connect to this port, `External Control` will stop immediately."/>
99
<arg name="kinematics_config" doc="Kinematics config file used for calibration correction. This will be used to verify the robot's calibration is matching the robot_description."/>
1010
<arg name="tf_prefix" default="" doc="tf_prefix used for the robot."/>
11-
<arg name="controllers" default="joint_state_controller scaled_pos_traj_controller speed_scaling_state_controller force_torque_sensor_controller" doc="Controllers that are activated by default."/>
11+
<arg name="controllers" default="joint_state_controller scaled_pos_traj_controller speed_scaling_state_controller force_torque_sensor_controller robot_status_controller" doc="Controllers that are activated by default."/>
1212
<arg name="stopped_controllers" default="pos_traj_controller joint_group_vel_controller" doc="Controllers that are initally loaded, but not started."/>
1313
<arg name="tool_voltage" default="0" doc="Tool voltage set at the beginning of the UR program. Only used, when `use_tool_communication` is set to true."/>
1414
<arg name="tool_parity" default="0" doc="Parity configuration used for tool communication. Only used, when `use_tool_communication` is set to true."/>

0 commit comments

Comments
 (0)