-
Notifications
You must be signed in to change notification settings - Fork 52
Add path shortening utils and consolidate examples #33
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
2b1a1a4
Add functions for path shortening
eholum c0932ed
Start adding unit tests for path shortcutting
eholum f1337ba
Update roboplan/src/core/path_utils.cpp
eholum 2d07f7a
Eigen, right.
eholum 3863ce7
Make path shortening actually work
eholum 546c0bb
Seed path shortcutting
eholum c1f9410
Never shortcut the start
eholum 2a2a23a
Add python bindings
eholum ac46894
Weird timeouts when connecting through ssh in the vizer viz
eholum 530abc1
Add path shortcutting example
eholum c6fe78d
Update bindings/src/roboplan/viser_visualizer.py
eholum e36d4e1
Tweak RRT params for path shortening
eholum aebffd9
Merge branch 'main' into path-shortening
eholum 5f7d2e5
Separate tree and path rendering
eholum d9116e1
Add path shortcutting to existing RRT demos
eholum 2ecd997
0 is a valid seed
eholum ed53e17
Minor viz tweaks
eholum 562a806
Add tyro as a dep and install in containers
eholum 3a6082e
Consolidate RRT examples with tyro
eholum 86d29d1
Generalize the IK example
eholum 8bf6e97
Add comment
eholum 795f377
Unused params
eholum 0742a16
pin typing_extensions
eholum fef1552
Install tyro with the other bindings deps
eholum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #include <gtest/gtest.h> | ||
|
|
||
| #include <roboplan/core/path_utils.hpp> | ||
| #include <roboplan/core/scene.hpp> | ||
| #include <roboplan_example_models/resources.hpp> | ||
|
|
||
| namespace roboplan { | ||
|
|
||
| class RoboPlanPathUtilsTest : public ::testing::Test { | ||
| protected: | ||
| void SetUp() override { | ||
| const auto share_prefix = roboplan_example_models::get_package_share_dir(); | ||
| const auto urdf_path = share_prefix / "ur_robot_model" / "ur5_gripper.urdf"; | ||
| const auto srdf_path = share_prefix / "ur_robot_model" / "ur5_gripper.srdf"; | ||
| const std::vector<std::filesystem::path> package_paths = {share_prefix}; | ||
| scene_ = std::make_shared<Scene>("test_scene", urdf_path, srdf_path, package_paths); | ||
| } | ||
|
|
||
| public: | ||
| // No default constructors, so must be pointers. | ||
| std::shared_ptr<Scene> scene_; | ||
|
|
||
| JointPath getTestPath(const size_t num_points) { | ||
| JointPath test_path; | ||
| test_path.joint_names = scene_->getJointNames(); | ||
|
|
||
| if (num_points == 0) | ||
| return test_path; | ||
|
|
||
| Eigen::VectorXd q1(6); | ||
| Eigen::VectorXd q2(6); | ||
| Eigen::VectorXd q3(6); | ||
| q1 << 0.0, 0.0, 0.0, 0.0, 0.0, 0.0; | ||
| q2 << 0.5, 0.0, 0.0, 0.0, 0.0, 0.0; | ||
| q3 << 1.0, 0.0, 0.0, 0.0, 0.0, 0.0; | ||
|
|
||
| if (num_points >= 1) | ||
| test_path.positions.push_back(q1); | ||
| if (num_points >= 2) | ||
| test_path.positions.push_back(q2); | ||
| if (num_points >= 3) | ||
| test_path.positions.push_back(q3); | ||
|
|
||
| return test_path; | ||
| } | ||
| }; | ||
|
|
||
| TEST_F(RoboPlanPathUtilsTest, testGetNormalizedPathScaling) { | ||
|
|
||
| JointPath empty_path = getTestPath(0); | ||
| auto empty_scalings = getNormalizedPathScaling(*scene_, empty_path); | ||
| EXPECT_TRUE(empty_scalings.empty()); | ||
|
|
||
| JointPath length_1_path = getTestPath(1); | ||
| auto length_1_path_scalings = getNormalizedPathScaling(*scene_, length_1_path); | ||
| ASSERT_EQ(length_1_path_scalings.size(), 1); | ||
| EXPECT_DOUBLE_EQ(length_1_path_scalings[0], 1.0); | ||
|
|
||
| // Path with 3 evenly spaced points | ||
| auto test_path = getTestPath(3); | ||
| auto path_scalings = getNormalizedPathScaling(*scene_, test_path); | ||
|
|
||
| ASSERT_EQ(path_scalings.size(), 3); | ||
| EXPECT_DOUBLE_EQ(path_scalings[0], 0.0); | ||
| EXPECT_DOUBLE_EQ(path_scalings[1], 0.5); | ||
| EXPECT_DOUBLE_EQ(path_scalings[2], 1.0); | ||
| } | ||
|
|
||
| } // namespace roboplan |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.