Skip to content
This repository was archived by the owner on May 11, 2023. It is now read-only.

added StompSmoothingAdapter #10

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

afrixs
Copy link
Contributor

@afrixs afrixs commented Mar 10, 2023

  • migrated StompSmoothingAdapter from stomp_ros
  • changed noise_generators to work with flexible trajectory size

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Copy link
Member

@henningkayser henningkayser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afrixs thank you a lot for this! I've been planning to add this for a while now but never got to do it. I left some comments for implementation details and possible TODOs. I'm willing to merge this shortly after testing.

@@ -48,15 +48,15 @@ NoiseGeneratorFn get_normal_distribution_generator(size_t num_timesteps, std::ve
r = std::make_shared<math::MultivariateGaussian>(Eigen::VectorXd::Zero(num_timesteps), covariance);
}

auto raw_noise = std::make_shared<Eigen::VectorXd>(num_timesteps);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -28,5 +28,8 @@ class StompPlanningContext : public planning_interface::PlanningContext
private:
const stomp_moveit::Params params_;
std::shared_ptr<stomp::Stomp> stomp_;

bool extractSeedTrajectory(const planning_interface::MotionPlanRequest &req,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this could be a free function instead. I'm also thinking about changing this to return std::optional in the future, but this version works for me as well

@@ -13,16 +13,24 @@
#include <stomp_moveit_parameters.hpp>

#include <moveit/constraint_samplers/constraint_sampler_manager.h>
#include <moveit/robot_state/conversions.h>

namespace stomp_moveit
{
bool solveWithStomp(const std::shared_ptr<stomp::Stomp>& stomp, const moveit::core::RobotState& start_state,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability, I would suggest creating a separate function "adaptWithStomp()" that takes the input trajectory instead of start and goal states.

const auto config = getStompConfig(params_, group->getActiveJointModels().size() /* num_dimensions */);
auto config = getStompConfig(params_, group->getActiveJointModels().size() /* num_dimensions */);
robot_trajectory::RobotTrajectoryPtr input_trajectory;
if (extractSeedTrajectory(request_, input_trajectory) && !input_trajectory->empty())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have to implement this now, but it would be great if you could leave a note that failed seed trajectories should be handled in a special way, and not result in a fresh motion plan.

{
}

// todo[noetic] add override again
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// todo[noetic] add override again


// STOMP reads the seed trajectory from trajectory constraints so we need to convert the waypoints first
const size_t seed_waypoint_count = res.trajectory->getWayPointCount();
const std::vector<std::string> variable_names =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just noticed that we have been iterating over all variables. We should probably switch this to active variables only, that's also what the extract function and STOMP use. Groups with mimic joints will probably just produce an error. A note/TODO on that would be fine for now, though.

@henningkayser
Copy link
Member

Formatting is not happy. We are using pre-commit, here are some instructions on how to fix that locally https://moveit.ros.org/documentation/contributing/code/#pre-commit-formatting-checks

@henningkayser henningkayser mentioned this pull request Mar 28, 2023
henningkayser added a commit that referenced this pull request Mar 29, 2023
@henningkayser henningkayser merged commit bc16f4d into moveit:main Mar 29, 2023
@afrixs
Copy link
Contributor Author

afrixs commented Mar 30, 2023

Sorry for not being active yesterday, my daughter was being born, but thank you for finishing these PRs!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants