|
| 1 | +/* |
| 2 | + * Software License Agreement (BSD License) |
| 3 | + * |
| 4 | + * Copyright (c) 2020. Toyota Research Institute |
| 5 | + * All rights reserved. |
| 6 | + * |
| 7 | + * Redistribution and use in source and binary forms, with or without |
| 8 | + * modification, are permitted provided that the following conditions |
| 9 | + * are met: |
| 10 | + * |
| 11 | + * * Redistributions of source code must retain the above copyright |
| 12 | + * notice, this list of conditions and the following disclaimer. |
| 13 | + * * Redistributions in binary form must reproduce the above |
| 14 | + * copyright notice, this list of conditions and the following |
| 15 | + * disclaimer in the documentation and/or other materials provided |
| 16 | + * with the distribution. |
| 17 | + * * Neither the name of CNRS-LAAS and AIST nor the names of its |
| 18 | + * contributors may be used to endorse or promote products derived |
| 19 | + * from this software without specific prior written permission. |
| 20 | + * |
| 21 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 22 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 23 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 24 | + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 25 | + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 26 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 27 | + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 28 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 29 | + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 30 | + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 31 | + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 32 | + * POSSIBILITY OF SUCH DAMAGE. |
| 33 | + */ |
| 34 | + |
| 35 | +/** @author Sean Curtis (sean@tri.global) (2020) */ |
| 36 | + |
| 37 | +#include "fcl/math/motion/interp_motion.h" |
| 38 | + |
| 39 | +#include <gtest/gtest.h> |
| 40 | + |
| 41 | +#include "eigen_matrix_compare.h" |
| 42 | + |
| 43 | +namespace fcl { |
| 44 | +namespace { |
| 45 | + |
| 46 | +// TODO(SeanCurtis-TRI): Convert this to a parameterized test harness and use |
| 47 | +// TEST_P. |
| 48 | + |
| 49 | +template <typename S> |
| 50 | +class InterpMotionTest : public ::testing::Test {}; |
| 51 | + |
| 52 | +typedef testing::Types<double, float> MyTypes; |
| 53 | +TYPED_TEST_CASE(InterpMotionTest, MyTypes); |
| 54 | + |
| 55 | +TYPED_TEST(InterpMotionTest, Construction) { |
| 56 | + using S = TypeParam; |
| 57 | + const Transform3<S> I = Transform3<S>::Identity(); |
| 58 | + |
| 59 | + { |
| 60 | + // Default constructor; everything should be identity. |
| 61 | + InterpMotion<S> motion{}; |
| 62 | + |
| 63 | + Transform3<S> X_FA; |
| 64 | + motion.getCurrentTransform(X_FA); |
| 65 | + EXPECT_TRUE(CompareMatrices(X_FA.matrix(), I.matrix())); |
| 66 | + EXPECT_TRUE( |
| 67 | + CompareMatrices(motion.getLinearVelocity(), Vector3<S>::Zero())); |
| 68 | + EXPECT_EQ(motion.getAngularVelocity(), S(0)); |
| 69 | + EXPECT_TRUE(CompareMatrices(motion.getAngularAxis(), Vector3<S>::UnitX())); |
| 70 | + EXPECT_TRUE( |
| 71 | + CompareMatrices(motion.getReferencePoint(), Vector3<S>::Zero())); |
| 72 | + } |
| 73 | + |
| 74 | + { |
| 75 | + // Construct from start (R_FS, p_FSo) and goal (R_FG, p_FGo). |
| 76 | + } |
| 77 | + |
| 78 | + { |
| 79 | + // Construct from start X_FS and goal X_FG. |
| 80 | + } |
| 81 | + |
| 82 | + { |
| 83 | + // Construct from start (R_FS, p_FSo), goal (R_FG, p_FGo), and an origin of |
| 84 | + // rotation (p_FO). |
| 85 | + } |
| 86 | + |
| 87 | + { |
| 88 | + // Construct from start X_FS, goal X_FG, and rotation origin p_FO. |
| 89 | + } |
| 90 | +} |
| 91 | + |
| 92 | +} // namespace |
| 93 | +} // namespace fcl |
| 94 | + |
| 95 | +//============================================================================== |
| 96 | +int main(int argc, char *argv[]) { |
| 97 | + ::testing::InitGoogleTest(&argc, argv); |
| 98 | + return RUN_ALL_TESTS(); |
| 99 | +} |
0 commit comments