Skip to content

Commit 80bda45

Browse files
committed
Added an EffortJointInterface
1 parent 8828a43 commit 80bda45

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

ur_robot_driver/include/ur_robot_driver/ros/hardware_interface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ class HardwareInterface : public hardware_interface::RobotHW
228228
hardware_interface::PositionJointInterface pj_interface_;
229229
ur_controllers::SpeedScalingInterface speedsc_interface_;
230230
hardware_interface::VelocityJointInterface vj_interface_;
231+
hardware_interface::EffortJointInterface ej_interface_;
231232
ur_controllers::ScaledVelocityJointInterface svj_interface_;
232233
hardware_interface::ForceTorqueSensorInterface fts_interface_;
233234

@@ -236,6 +237,7 @@ class HardwareInterface : public hardware_interface::RobotHW
236237

237238
vector6d_t joint_position_command_;
238239
vector6d_t joint_velocity_command_;
240+
vector6d_t joint_effort_command_;
239241
vector6d_t joint_positions_;
240242
vector6d_t joint_velocities_;
241243
vector6d_t joint_efforts_;

ur_robot_driver/src/ros/hardware_interface.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,15 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw
298298
&joint_velocities_[i], &joint_efforts_[i]));
299299

300300
// Create joint position control interface
301-
pj_interface_.registerHandle(
302-
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_position_command_[i]));
303-
vj_interface_.registerHandle(
304-
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_velocity_command_[i]));
301+
hardware_interface::JointHandle joint_handle_position =
302+
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_position_command_[i]);
303+
pj_interface_.registerHandle(joint_handle_position);
304+
hardware_interface::JointHandle joint_handle_velocity =
305+
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_velocity_command_[i]);
306+
vj_interface_.registerHandle(joint_handle_velocity);
307+
hardware_interface::JointHandle joint_handle_effort =
308+
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_effort_command_[i]);
309+
ej_interface_.registerHandle(joint_handle_effort);
305310
spj_interface_.registerHandle(ur_controllers::ScaledJointHandle(
306311
js_interface_.getHandle(joint_names_[i]), &joint_position_command_[i], &speed_scaling_combined_));
307312
svj_interface_.registerHandle(ur_controllers::ScaledJointHandle(
@@ -322,6 +327,7 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw
322327
registerInterface(&spj_interface_);
323328
registerInterface(&pj_interface_);
324329
registerInterface(&vj_interface_);
330+
registerInterface(&ej_interface_);
325331
registerInterface(&svj_interface_);
326332
registerInterface(&speedsc_interface_);
327333
registerInterface(&fts_interface_);

0 commit comments

Comments
 (0)