Skip to content

Commit 8edd274

Browse files
author
Felix Exner
committed
Add passthrough interfaces for joints
As this has been added in the joint description, we need to also parse them from the hardware interface.
1 parent 496d924 commit 8edd274

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

ur_robot_driver/include/ur_robot_driver/hardware_interface.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ class URPositionHardwareInterface : public hardware_interface::SystemInterface
192192
double system_interface_initialized_;
193193
bool async_thread_shutdown_;
194194

195+
// Passthrough trajectory controller interface values
196+
urcl::vector6d_t passthrough_trajectory_positions_;
197+
urcl::vector6d_t passthrough_trajectory_velocities_;
198+
urcl::vector6d_t passthrough_trajectory_accelerations_;
199+
195200
// payload stuff
196201
urcl::vector3d_t payload_center_of_gravity_;
197202
double payload_mass_;

ur_robot_driver/src/hardware_interface.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ URPositionHardwareInterface::on_init(const hardware_interface::HardwareInfo& sys
9595
system_interface_initialized_ = 0.0;
9696

9797
for (const hardware_interface::ComponentInfo& joint : info_.joints) {
98-
if (joint.command_interfaces.size() != 2) {
98+
if (joint.command_interfaces.size() != 5) {
9999
RCLCPP_FATAL(rclcpp::get_logger("URPositionHardwareInterface"),
100-
"Joint '%s' has %zu command interfaces found. 2 expected.", joint.name.c_str(),
100+
"Joint '%s' has %zu command interfaces found. 5 expected.", joint.name.c_str(),
101101
joint.command_interfaces.size());
102102
return hardware_interface::CallbackReturn::ERROR;
103103
}
@@ -243,6 +243,15 @@ std::vector<hardware_interface::CommandInterface> URPositionHardwareInterface::e
243243

244244
command_interfaces.emplace_back(hardware_interface::CommandInterface(
245245
info_.joints[i].name, hardware_interface::HW_IF_VELOCITY, &urcl_velocity_commands_[i]));
246+
247+
command_interfaces.emplace_back(hardware_interface::CommandInterface(info_.joints[i].name, "passthrough_position",
248+
&passthrough_trajectory_positions_[i]));
249+
250+
command_interfaces.emplace_back(hardware_interface::CommandInterface(info_.joints[i].name, "passthrough_velocity",
251+
&passthrough_trajectory_velocities_[i]));
252+
253+
command_interfaces.emplace_back(hardware_interface::CommandInterface(
254+
info_.joints[i].name, "passthrough_acceleration", &passthrough_trajectory_accelerations_[i]));
246255
}
247256
// Obtain the tf_prefix from the urdf so that we can have the general interface multiple times
248257
// NOTE using the tf_prefix at this point is some kind of workaround. One should actually go through the list of gpio

0 commit comments

Comments
 (0)