-
Notifications
You must be signed in to change notification settings - Fork 7
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
README clean up and integration of Kinematic limits from Robot Model #49
Conversation
This commit adds upper/lower position/velocity bounds. Reads them from the robot model VariableBound API and sets them up as Drake PositionBund and VelocityBound constraints. Adds some additional docs on readme
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.
Might be easier to break this up task by task, so it's faster to review smaller things and get them in. Would recommend finishing up what you've got so far and then following this suggestion.
README.md
Outdated
- Exposes `KinematicTrajectoryOptimization` implementation in `drake`. | ||
- Exposes `TOPPRA` implementation in `drake`. |
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.
consider links to Drake docs
res/ktopt_moveit_parameters.yaml
Outdated
# validation: { | ||
# gt_eq<>: [1] |
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.
remove
src/ktopt_planning_context.cpp
Outdated
// std::cout << "Joint " << joint_name << ": Position [" | ||
// << bounds.min_position_ << ", " << bounds.max_position_ | ||
// << "], Velocity [-" << bounds.max_velocity_ << ", " | ||
// << bounds.max_velocity_ << "]" << std::endl; |
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.
remove
src/ktopt_planning_context.cpp
Outdated
int num_positions = plant.num_positions(); | ||
int num_velocities = plant.num_velocities(); |
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.
can be const
src/ktopt_planning_context.cpp
Outdated
int num_velocities = plant.num_velocities(); | ||
|
||
// Ensure the bounds have the correct size | ||
if (lower_position_bounds.size() != num_positions || upper_position_bounds.size() != num_positions) |
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 might get compiler warnings in comparing int
with size_t
, which requires a static_cast
to resolve
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.
Left some additional comments, but once addressed this is good for me, so approving.
README.md
Outdated
|
||
`moveit_drake` brings together the vertical ROS integration of the | ||
[MoveIt2](https://moveit.ai/) motion planning framework, with the Mathematical | ||
Programming interface within [drake](https://drake.mit.edu/). This allows the |
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.
Capitalize Drake
README.md
Outdated
release. | ||
|
||
`moveit_drake` brings together the vertical ROS integration of the | ||
[MoveIt2](https://moveit.ai/) motion planning framework, with the Mathematical |
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.
MoveIt 2 (with a space)
### Potential issues | ||
- Assumes that planner managers initialize will set robot description before a | ||
call to getPlanningContext. | ||
- Use [pre-commit to format your |
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.
Might want to share the basic command
pre-commit run -a
@@ -48,6 +48,62 @@ void KTOptPlanningContext::solve(planning_interface::MotionPlanResponse& res) | |||
const auto joint_model_group = getPlanningScene()->getRobotModel()->getJointModelGroup(getGroupName()); | |||
RCLCPP_INFO_STREAM(getLogger(), "Planning for group: " << getGroupName()); | |||
|
|||
// extract position and velocity bounds | |||
std::vector<double> lower_position_bounds; |
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.
Try initialize all of these with the known size (number of dofs) for efficiency.
If you initialize them, change the push_back
s for modifying existing elements.
Or you can reserve()
them in which case you do keep pushing back.
src/ktopt_planning_context.cpp
Outdated
std::vector<double> upper_acceleration_bounds; | ||
for (const auto& joint_model : joint_model_group->getActiveJointModels()) | ||
{ | ||
const std::string& joint_name = joint_model->getName(); |
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 and the next line can just use auto&
for the return type
src/ktopt_planning_context.cpp
Outdated
lower_acceleration_bounds.push_back(-bounds.max_acceleration_); | ||
upper_acceleration_bounds.push_back(bounds.max_acceleration_); | ||
} | ||
const int num_positions = plant.num_positions(); |
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 and the next line can just be auto
src/ktopt_planning_context.cpp
Outdated
// Ensure the bounds have the correct size | ||
if (lower_position_bounds.size() != num_positions || upper_position_bounds.size() != num_positions) | ||
{ | ||
lower_position_bounds.resize(num_positions, -1e6); |
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.
Instead of using these hard-coded 1e6 magic numbers, consider defining them as constants in an anonymous namespace.
namespace {
constexpr double kDefaultJointMaxPosition = 1.0e6;
} // namespace
But more importantly, did you find that you needed to pad these vectors? Is this because of the additional joints that are not part of the group?
If that's the case, then you possibly want these extra joints to have big position limits (as you did), but also to use zero vel/accel/jerk limits to ensure they do not move.
Or possibly the position limits just have their min/max set to the current state? Might be even better
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 was a good catch. On closer inspection, I completely missed that the inactive joints were having their kinematics limits added to the end of each respective (position, vel, accel, jerk) bound vector, instead of being indexed. Corrected now!
And also, can you change the PR name to more precisely say what this ends up adding? Cleaned up README and kinematic limits from the robot model? |
This PR addresses #45.