-
Notifications
You must be signed in to change notification settings - Fork 420
[WIP] Enforce joint limits #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
8828a43
72463b3
7315fef
a1422f1
7a4fcfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -72,6 +72,9 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw | |||||
std::string output_recipe_filename; | ||||||
std::string input_recipe_filename; | ||||||
|
||||||
// Load URDF file from parameter server | ||||||
loadURDF(robot_hw_nh, "robot_description"); | ||||||
|
||||||
|
||||||
// The robot's IP address. | ||||||
if (!robot_hw_nh.getParam("robot_ip", robot_ip_)) | ||||||
{ | ||||||
|
@@ -295,14 +298,18 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw | |||||
&joint_velocities_[i], &joint_efforts_[i])); | ||||||
|
||||||
// Create joint position control interface | ||||||
pj_interface_.registerHandle( | ||||||
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_position_command_[i])); | ||||||
vj_interface_.registerHandle( | ||||||
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_velocity_command_[i])); | ||||||
hardware_interface::JointHandle joint_handle_position = | ||||||
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_position_command_[i]); | ||||||
pj_interface_.registerHandle(joint_handle_position); | ||||||
hardware_interface::JointHandle joint_handle_velocity = | ||||||
hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[i]), &joint_velocity_command_[i]); | ||||||
vj_interface_.registerHandle(joint_handle_velocity); | ||||||
spj_interface_.registerHandle(ur_controllers::ScaledJointHandle( | ||||||
js_interface_.getHandle(joint_names_[i]), &joint_position_command_[i], &speed_scaling_combined_)); | ||||||
svj_interface_.registerHandle(ur_controllers::ScaledJointHandle( | ||||||
js_interface_.getHandle(joint_names_[i]), &joint_velocity_command_[i], &speed_scaling_combined_)); | ||||||
|
||||||
registerJointLimits(robot_hw_nh, joint_handle_position, joint_handle_velocity, i); | ||||||
} | ||||||
|
||||||
speedsc_interface_.registerHandle( | ||||||
|
@@ -382,6 +389,128 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw | |||||
return true; | ||||||
} | ||||||
|
||||||
void HardwareInterface::registerJointLimits(ros::NodeHandle& robot_hw_nh, | ||||||
const hardware_interface::JointHandle& joint_handle_position, | ||||||
const hardware_interface::JointHandle& joint_handle_velocity, | ||||||
std::size_t joint_id) | ||||||
{ | ||||||
// Default values | ||||||
joint_position_lower_limits_[joint_id] = -std::numeric_limits<double>::max(); | ||||||
|
||||||
joint_position_upper_limits_[joint_id] = std::numeric_limits<double>::max(); | ||||||
joint_velocity_limits_[joint_id] = std::numeric_limits<double>::max(); | ||||||
|
||||||
// Limits datastructures | ||||||
joint_limits_interface::JointLimits joint_limits; // Position | ||||||
joint_limits_interface::SoftJointLimits soft_limits; // Soft Position | ||||||
bool has_joint_limits = false; | ||||||
bool has_soft_limits = false; | ||||||
|
||||||
// Get limits from URDF | ||||||
if (urdf_model_ == NULL) | ||||||
|
if (urdf_model_ == NULL) | |
if (urdf_model_ == nullptr) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (urdf_joint == NULL) | |
if (urdf_joint == nullptr) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't only referring to position limits, right? We could change the output that no limits are configured for that joint in the URDF.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block doesn't make sense to me. In which situation should searchParam
fail but getParam
work? Am I missing anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Removed it for the next commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this function apply the limits or register the limits? I guess, the docstring needs to be adapted.