Skip to content
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

Update online planning example and toJointTrajectory to leverage trajectory uuid #526

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ UseTab: Never
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping: {
BraceWrapping:
AfterCaseLabel : 'true'
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
Expand All @@ -63,5 +64,5 @@ BraceWrapping: {
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
}

...
5 changes: 3 additions & 2 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ on:

jobs:
clang_format:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1

- name: Run clang format
run: |
sudo apt update
sudo apt install -y git clang-format-8
sudo apt install -y git clang-format-12
if [ $? -ge 1 ]; then return 1; fi
./.run-clang-format
if [ $? -ge 1 ]; then return 1; fi
output=$(git diff)
echo $output
if [ -n "$output" ]; then exit 1; else exit 0; fi
2 changes: 1 addition & 1 deletion .run-clang-format
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
find . -type d \( -name bullet3_ros -o -name fcl_ros -o -name libccd_ros -o -name gtest_ros -o -name tesseract_ext \) -prune -o -type f -regex '.*\.\(cpp\|hpp\|cc\|cxx\|h\|hxx\)' -exec clang-format-8 -style=file -i {} \;
find . -type d \( -name bullet3_ros -o -name fcl_ros -o -name libccd_ros -o -name gtest_ros -o -name tesseract_ext \) -prune -o -type f -regex '.*\.\(cpp\|hpp\|cc\|cxx\|h\|hxx\)' -exec clang-format-12 -style=file -i {} \;
Original file line number Diff line number Diff line change
Expand Up @@ -63,168 +63,169 @@ void runCartesianWaypointTest()
EXPECT_FALSE(wp.isToleranced());
}

{ // Set/Get Transform
{ // Test construction providing pose
{ // Set/Get Transform
{ // Test construction providing pose
Eigen::Isometry3d pose{ Eigen::Isometry3d::Identity() };
pose.translation() = Eigen::Vector3d(1, 2, 3);
CartesianWaypointPoly wp{ T(pose) };
EXPECT_TRUE(wp.getTransform().isApprox(pose));
EXPECT_FALSE(wp.isToleranced());
}

{ // Test construction providing pose
Eigen::Isometry3d pose{ Eigen::Isometry3d::Identity() };
pose.translation() = Eigen::Vector3d(1, 2, 3);
CartesianWaypointPoly wp{ T(pose, Eigen::VectorXd::Constant(3, -5), Eigen::VectorXd::Constant(3, 5)) };
EXPECT_TRUE(wp.getTransform().isApprox(pose));
EXPECT_TRUE(wp.getLowerTolerance().isApprox(Eigen::VectorXd::Constant(3, -5)));
EXPECT_TRUE(wp.getUpperTolerance().isApprox(Eigen::VectorXd::Constant(3, 5)));
EXPECT_TRUE(wp.isToleranced());
}
pose.translation() = Eigen::Vector3d(1, 2, 3);
CartesianWaypointPoly wp{ T(pose) };
EXPECT_TRUE(wp.getTransform().isApprox(pose));
EXPECT_FALSE(wp.isToleranced());
}

{ // Test set pose
Eigen::Isometry3d pose{ Eigen::Isometry3d::Identity() };
pose.translation() = Eigen::Vector3d(1, 2, 3);
CartesianWaypointPoly wp{ T() };
wp.setTransform(pose);
EXPECT_TRUE(wp.getTransform().isApprox(pose));
EXPECT_FALSE(wp.isToleranced());
}

{ // Test assigning pose
Eigen::Isometry3d pose{ Eigen::Isometry3d::Identity() };
pose.translation() = Eigen::Vector3d(1, 2, 3);
CartesianWaypointPoly wp{ T() };
wp.getTransform() = pose;
EXPECT_TRUE(std::as_const(wp).getTransform().isApprox(pose));
EXPECT_FALSE(wp.isToleranced());
}
} // namespace tesseract_planning::test_suite

{ // Test Set Tolerances
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.isToleranced());

wp.setUpperTolerance(Eigen::VectorXd::Constant(3, 5));
wp.setLowerTolerance(Eigen::VectorXd::Constant(3, -5));
EXPECT_TRUE(wp.isToleranced());
{ // Test construction providing pose
Eigen::Isometry3d pose{ Eigen::Isometry3d::Identity() };
pose.translation() = Eigen::Vector3d(1, 2, 3);
CartesianWaypointPoly wp{ T(pose, Eigen::VectorXd::Constant(3, -5), Eigen::VectorXd::Constant(3, 5)) };
EXPECT_TRUE(wp.getTransform().isApprox(pose));
EXPECT_TRUE(wp.getLowerTolerance().isApprox(Eigen::VectorXd::Constant(3, -5)));
EXPECT_TRUE(wp.getUpperTolerance().isApprox(Eigen::VectorXd::Constant(3, 5)));
EXPECT_TRUE(wp.isToleranced());
}

{ // Test set pose
Eigen::Isometry3d pose{ Eigen::Isometry3d::Identity() };
pose.translation() = Eigen::Vector3d(1, 2, 3);
CartesianWaypointPoly wp{ T() };
wp.setTransform(pose);
EXPECT_TRUE(wp.getTransform().isApprox(pose));
EXPECT_FALSE(wp.isToleranced());
}

{ // Test assigning pose
Eigen::Isometry3d pose{ Eigen::Isometry3d::Identity() };
pose.translation() = Eigen::Vector3d(1, 2, 3);
CartesianWaypointPoly wp{ T() };
wp.getTransform() = pose;
EXPECT_TRUE(std::as_const(wp).getTransform().isApprox(pose));
EXPECT_FALSE(wp.isToleranced());
}
} // namespace tesseract_planning::test_suite

{ // Test Set Tolerances
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.isToleranced());

wp.setUpperTolerance(Eigen::VectorXd::Constant(3, -5));
wp.setLowerTolerance(Eigen::VectorXd::Constant(3, -5));
EXPECT_ANY_THROW(wp.isToleranced()); // NOLINT
wp.setUpperTolerance(Eigen::VectorXd::Constant(3, 5));
wp.setLowerTolerance(Eigen::VectorXd::Constant(3, -5));
EXPECT_TRUE(wp.isToleranced());

wp.setUpperTolerance(Eigen::VectorXd::Constant(3, 5));
wp.setLowerTolerance(Eigen::VectorXd::Constant(3, 5));
EXPECT_ANY_THROW(wp.isToleranced()); // NOLINT
wp.setUpperTolerance(Eigen::VectorXd::Constant(3, -5));
wp.setLowerTolerance(Eigen::VectorXd::Constant(3, -5));
EXPECT_ANY_THROW(wp.isToleranced()); // NOLINT

wp.setUpperTolerance(Eigen::VectorXd::Constant(3, 0));
wp.setLowerTolerance(Eigen::VectorXd::Constant(3, 0));
EXPECT_FALSE(wp.isToleranced());
}
wp.setUpperTolerance(Eigen::VectorXd::Constant(3, 5));
wp.setLowerTolerance(Eigen::VectorXd::Constant(3, 5));
EXPECT_ANY_THROW(wp.isToleranced()); // NOLINT

{ // Test Equality and Serialization
{ CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
CartesianWaypointPoly wp2(wp1); // NOLINT
EXPECT_TRUE(wp1 == wp2);
EXPECT_TRUE(wp2 == wp1);
EXPECT_FALSE(wp2 != wp1);
runWaypointSerializationTest(wp1);
}
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
wp1.getTransform().translate(Eigen::Vector3d(1e6, 0, 0));
CartesianWaypointPoly wp2(wp1);
EXPECT_TRUE(wp1 == wp2);
EXPECT_TRUE(wp2 == wp1);
EXPECT_FALSE(wp2 != wp1);
runWaypointSerializationTest(wp1);
}
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
wp1.getUpperTolerance().resize(3);
wp1.getUpperTolerance() << 1, 2, 3;
wp1.getLowerTolerance().resize(3);
wp1.getLowerTolerance() << -4, -5, -6;
CartesianWaypointPoly wp2(wp1);
EXPECT_TRUE(wp1 == wp2);
EXPECT_TRUE(wp2 == wp1);
EXPECT_FALSE(wp2 != wp1);
runWaypointSerializationTest(wp1);
}
// Not equal
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
CartesianWaypointPoly wp2{ T(Eigen::Isometry3d::Identity()) };
wp2.getTransform().rotate(Eigen::AngleAxisd(M_PI, Eigen::Vector3d(0, 0, 1)));
EXPECT_FALSE(wp1 == wp2);
EXPECT_FALSE(wp2 == wp1);
EXPECT_TRUE(wp2 != wp1);
runWaypointSerializationTest(wp2);
}
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
CartesianWaypointPoly wp2{ T(Eigen::Isometry3d::Identity()) };
wp2.getTransform().translate(Eigen::Vector3d(1e6, 0, 0));
EXPECT_FALSE(wp1 == wp2);
EXPECT_FALSE(wp2 == wp1);
EXPECT_TRUE(wp2 != wp1);
runWaypointSerializationTest(wp2);
}
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
CartesianWaypointPoly wp2(wp1);
wp2.getUpperTolerance().resize(3);
wp2.getUpperTolerance() << 1, 2, 3;
wp2.getLowerTolerance().resize(3);
wp2.getLowerTolerance() << -4, -5, -6;
EXPECT_FALSE(wp1 == wp2);
EXPECT_FALSE(wp2 == wp1);
EXPECT_TRUE(wp2 != wp1);
runWaypointSerializationTest(wp2);
}
}

{ // Set/Get Seed
tesseract_common::JointState seed_state;
seed_state.joint_names = { "joint_1", "joint_2", "joint_3" };
seed_state.position.resize(3);
seed_state.position << .01, .02, .03;
seed_state.velocity.resize(3);
seed_state.velocity << .1, .2, .3;
seed_state.acceleration.resize(3);
seed_state.acceleration << 1, 2, 3;

{ // Test default construction pose
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.hasSeed());
EXPECT_FALSE(std::as_const(wp).getSeed() == seed_state);
}

{ // Test assigning pose
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.hasSeed());
wp.setSeed(seed_state);
EXPECT_TRUE(wp.hasSeed());
EXPECT_TRUE(std::as_const(wp).getSeed() == seed_state);
wp.setUpperTolerance(Eigen::VectorXd::Constant(3, 0));
wp.setLowerTolerance(Eigen::VectorXd::Constant(3, 0));
EXPECT_FALSE(wp.isToleranced());
}

{ // Test assigning pose
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.hasSeed());
wp.getSeed() = seed_state;
EXPECT_TRUE(wp.hasSeed());
EXPECT_TRUE(std::as_const(wp).getSeed() == seed_state);
{ // Test Equality and Serialization
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
CartesianWaypointPoly wp2(wp1); // NOLINT
EXPECT_TRUE(wp1 == wp2);
EXPECT_TRUE(wp2 == wp1);
EXPECT_FALSE(wp2 != wp1);
runWaypointSerializationTest(wp1);
}
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
wp1.getTransform().translate(Eigen::Vector3d(1e6, 0, 0));
CartesianWaypointPoly wp2(wp1);
EXPECT_TRUE(wp1 == wp2);
EXPECT_TRUE(wp2 == wp1);
EXPECT_FALSE(wp2 != wp1);
runWaypointSerializationTest(wp1);
}
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
wp1.getUpperTolerance().resize(3);
wp1.getUpperTolerance() << 1, 2, 3;
wp1.getLowerTolerance().resize(3);
wp1.getLowerTolerance() << -4, -5, -6;
CartesianWaypointPoly wp2(wp1);
EXPECT_TRUE(wp1 == wp2);
EXPECT_TRUE(wp2 == wp1);
EXPECT_FALSE(wp2 != wp1);
runWaypointSerializationTest(wp1);
}
// Not equal
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
CartesianWaypointPoly wp2{ T(Eigen::Isometry3d::Identity()) };
wp2.getTransform().rotate(Eigen::AngleAxisd(M_PI, Eigen::Vector3d(0, 0, 1)));
EXPECT_FALSE(wp1 == wp2);
EXPECT_FALSE(wp2 == wp1);
EXPECT_TRUE(wp2 != wp1);
runWaypointSerializationTest(wp2);
}
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
CartesianWaypointPoly wp2{ T(Eigen::Isometry3d::Identity()) };
wp2.getTransform().translate(Eigen::Vector3d(1e6, 0, 0));
EXPECT_FALSE(wp1 == wp2);
EXPECT_FALSE(wp2 == wp1);
EXPECT_TRUE(wp2 != wp1);
runWaypointSerializationTest(wp2);
}
{
CartesianWaypointPoly wp1{ T(Eigen::Isometry3d::Identity()) };
CartesianWaypointPoly wp2(wp1);
wp2.getUpperTolerance().resize(3);
wp2.getUpperTolerance() << 1, 2, 3;
wp2.getLowerTolerance().resize(3);
wp2.getLowerTolerance() << -4, -5, -6;
EXPECT_FALSE(wp1 == wp2);
EXPECT_FALSE(wp2 == wp1);
EXPECT_TRUE(wp2 != wp1);
runWaypointSerializationTest(wp2);
}
}

{ // Test clear seed
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.hasSeed());
wp.getSeed() = seed_state;
EXPECT_TRUE(wp.hasSeed());
wp.clearSeed();
EXPECT_FALSE(wp.hasSeed());
{ // Set/Get Seed
tesseract_common::JointState seed_state;
seed_state.joint_names = { "joint_1", "joint_2", "joint_3" };
seed_state.position.resize(3);
seed_state.position << .01, .02, .03;
seed_state.velocity.resize(3);
seed_state.velocity << .1, .2, .3;
seed_state.acceleration.resize(3);
seed_state.acceleration << 1, 2, 3;

{ // Test default construction pose
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.hasSeed());
EXPECT_FALSE(std::as_const(wp).getSeed() == seed_state);
}

{ // Test assigning pose
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.hasSeed());
wp.setSeed(seed_state);
EXPECT_TRUE(wp.hasSeed());
EXPECT_TRUE(std::as_const(wp).getSeed() == seed_state);
}

{ // Test assigning pose
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.hasSeed());
wp.getSeed() = seed_state;
EXPECT_TRUE(wp.hasSeed());
EXPECT_TRUE(std::as_const(wp).getSeed() == seed_state);
}

{ // Test clear seed
CartesianWaypointPoly wp{ T() };
EXPECT_FALSE(wp.hasSeed());
wp.getSeed() = seed_state;
EXPECT_TRUE(wp.hasSeed());
wp.clearSeed();
EXPECT_FALSE(wp.hasSeed());
}
}
}
}
}
} // namespace tesseract_planning::test_suite
#endif // TESSERACT_COMMAND_LANGUAGE_CARTESIAN_WAYPOINT_POLY_UNIT_HPP
Loading
Loading