-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Sprint 11/PI - 154] Akushon Unit Test #31
Open
Alffaza
wants to merge
24
commits into
master
Choose a base branch
from
feature/akushon-unit-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
1a6dc1e
feat: init unit tests and node test
Alffaza d375ed0
feat: add action init unit test
Alffaza b7333d5
feat: add action setter test
Alffaza 8f67f07
fix: fix error
Alffaza 4bcde21
feat: add test action json
Alffaza 912eb9f
feat: update cmakelists
Alffaza 6480ccb
refactor: minor whitespace
Alffaza 016d5d6
feat: init interpolator test
Alffaza e181a57
fix: fix merge
Alffaza d384864
feat: update test action
Alffaza 9862986
refactor: change interpolator test action path
Alffaza d8d5def
refactor: change variable name
Alffaza 747d261
fix: fix expected positions
Alffaza a0d1894
feat: change test action
Alffaza f71a4fe
fix: fix include joint process
Alffaza e04c119
refactor: change test to use assert near
Alffaza 1211ab8
refactor: change test to use expect near
Alffaza 96eaebb
Merge branch 'master' into feature/akushon-unit-tests
maroqijalil dbd7c78
Merge branch 'master' of github.com:ichiro-its/akushon into feature/a…
maroqijalil e6a0590
Merge branch 'feature/akushon-unit-tests' of github.com:ichiro-its/ak…
maroqijalil acfaefe
refactor: change method name
maroqijalil 614a0f1
Merge branch 'master' of https://github.com/ichiro-its/akushon into f…
JayantiTA 914e518
refactor: refactor existing test code
JayantiTA 5985d00
feat: add pose unit test
JayantiTA 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 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 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,89 @@ | ||
{ | ||
"name": "Right Kick", | ||
"next": "", | ||
"poses": [ | ||
{ | ||
"joints": { | ||
"left_ankle_pitch": 0, | ||
"left_ankle_roll": 0, | ||
"left_elbow": 0, | ||
"left_hip_pitch": 0, | ||
"left_hip_roll": 0, | ||
"left_hip_yaw": 0, | ||
"left_knee": 0, | ||
"left_shoulder_pitch": 0, | ||
"left_shoulder_roll": 1, | ||
"neck_pitch": 2, | ||
"neck_yaw": 1, | ||
"right_ankle_pitch": 1, | ||
"right_ankle_roll": 0, | ||
"right_elbow": 0, | ||
"right_hip_pitch": 0, | ||
"right_hip_roll": 0, | ||
"right_hip_yaw": 0, | ||
"right_knee": 0, | ||
"right_shoulder_pitch": 0, | ||
"right_shoulder_roll": 1 | ||
}, | ||
"name": "r_walkready", | ||
"pause": 0, | ||
"speed": 1 | ||
}, | ||
{ | ||
"joints": { | ||
"left_ankle_pitch": 50, | ||
"left_ankle_roll": 50, | ||
"left_elbow": 50, | ||
"left_hip_pitch": 50, | ||
"left_hip_roll": 50, | ||
"left_hip_yaw": 50, | ||
"left_knee": 50, | ||
"left_shoulder_pitch": 23, | ||
"left_shoulder_roll": 51, | ||
"neck_pitch": 52, | ||
"neck_yaw": 51, | ||
"right_ankle_pitch": 51, | ||
"right_ankle_roll": 50, | ||
"right_elbow": 50, | ||
"right_hip_pitch": 50, | ||
"right_hip_roll": 50, | ||
"right_hip_yaw": 50, | ||
"right_knee": 50, | ||
"right_shoulder_pitch": 53, | ||
"right_shoulder_roll": 51 | ||
}, | ||
"name": "r_feet", | ||
"pause": 1, | ||
"speed": 0.1 | ||
}, | ||
{ | ||
"joints": { | ||
"left_ankle_pitch": 0, | ||
"left_ankle_roll": 0, | ||
"left_elbow": 0, | ||
"left_hip_pitch": 0, | ||
"left_hip_roll": 0, | ||
"left_hip_yaw": 0, | ||
"left_knee": 0, | ||
"left_shoulder_pitch": 0, | ||
"left_shoulder_roll": 1, | ||
"neck_pitch": 2, | ||
"neck_yaw": 1, | ||
"right_ankle_pitch": 1, | ||
"right_ankle_roll": 0, | ||
"right_elbow": 0, | ||
"right_hip_pitch": 0, | ||
"right_hip_roll": 0, | ||
"right_hip_yaw": 0, | ||
"right_knee": 0, | ||
"right_shoulder_pitch": 0, | ||
"right_shoulder_roll": 1 | ||
}, | ||
"name": "r_kick", | ||
"pause": 0.5, | ||
"speed": 0.3 | ||
} | ||
], | ||
"start_delay": 0, | ||
"stop_delay": 0 | ||
} |
This file contains 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 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,42 @@ | ||
// Copyright (c) 2021 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#include <memory> | ||
|
||
#include "gtest/gtest.h" | ||
|
||
#include "akushon/action/model/action.hpp" | ||
#include "akushon/action/model/pose.hpp" | ||
|
||
TEST(ActionTest, ClassInitialization) { | ||
akushon::Action action("test action"); | ||
ASSERT_EQ(action.get_name(), "test action"); | ||
ASSERT_TRUE(action.get_poses().empty()); | ||
} | ||
|
||
TEST(ActionTest, SetterTest) { | ||
akushon::Action action("test action"); | ||
action.set_name("new test action"); | ||
action.set_start_delay(1.0); | ||
action.set_stop_delay(3.0); | ||
ASSERT_EQ(action.get_name(), "new test action"); | ||
ASSERT_EQ(action.get_start_delay(), 1.0); | ||
ASSERT_EQ(action.get_stop_delay(), 3.0); | ||
} |
This file contains 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,97 @@ | ||
// Copyright (c) 2021 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#include <fstream> | ||
#include <map> | ||
#include <memory> | ||
#include <string> | ||
#include <utility> | ||
#include <vector> | ||
|
||
#include "gtest/gtest.h" | ||
|
||
#include "akushon/action/model/action_name.hpp" | ||
#include "akushon/action/model/action.hpp" | ||
#include "akushon/action/node/action_manager.hpp" | ||
#include "akushon/action/process/interpolator.hpp" | ||
#include "nlohmann/json.hpp" | ||
#include "tachimawari/joint/joint.hpp" | ||
|
||
TEST(InterpolatorTest, JointTest) { | ||
akushon::ActionManager action_manager; | ||
float max_error = 0.5; | ||
|
||
action_manager.load_data("../../src/akushon/data/test"); | ||
|
||
std::vector<akushon::Pose> poses = action_manager.get_action(akushon::Action::RIGHT_KICK).get_poses(); | ||
|
||
action_manager.start(akushon::Action::RIGHT_KICK, poses[0]); | ||
|
||
float expected_positions[3][20] = | ||
{ | ||
{ | ||
0, 0, 1, 1, 0, | ||
0, 0, 0, 0, 0, | ||
0, 0, 0, 0, 0, | ||
0, 1, 0, 1, 2 | ||
}, | ||
{ | ||
53, 23, 51, 51, 50, | ||
50, 50, 50, 50, 50, | ||
50, 50, 50, 50, 50, | ||
50, 51, 50, 51, 52 | ||
}, | ||
{ | ||
0, 0, 1, 1, 0, | ||
0, 0, 0, 0, 0, | ||
0, 0, 0, 0, 0, | ||
0, 1, 0, 1, 2 | ||
} | ||
}; | ||
|
||
std::vector<tachimawari::joint::Joint> action_manager_joints = action_manager.get_joints(); | ||
|
||
for (int i = 0; i < 20; i++){ | ||
EXPECT_NEAR(expected_positions[0][i], action_manager_joints[i].get_position(), max_error); | ||
} | ||
|
||
for (int i = 0; i < 1100; i++) | ||
{ | ||
action_manager.process(i); | ||
} | ||
|
||
action_manager_joints = action_manager.get_joints(); | ||
|
||
for (int i = 0; i < 20; i++) | ||
{ | ||
EXPECT_NEAR(expected_positions[1][i], action_manager_joints[i].get_position(), max_error); | ||
} | ||
|
||
for (int i = 1100; i < 2000; i++){ | ||
action_manager.process(i); | ||
} | ||
|
||
action_manager_joints = action_manager.get_joints(); | ||
|
||
for (int i = 0; i < 20; i++) | ||
{ | ||
EXPECT_NEAR(expected_positions[2][i], action_manager_joints[i].get_position(), max_error); | ||
} | ||
} |
This file contains 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,41 @@ | ||
// Copyright (c) 2021 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#include <memory> | ||
|
||
#include "gtest/gtest.h" | ||
|
||
#include "akushon/action/node/action_manager.hpp" | ||
#include "akushon/node/akushon_node.hpp" | ||
#include "rclcpp/rclcpp.hpp" | ||
|
||
TEST(AkushonNodeTest, CompileProcess) { | ||
try { | ||
rclcpp::Node::SharedPtr node = std::make_shared<rclcpp::Node>("akushon_node"); | ||
|
||
akushon::AkushonNode akushon_node(node); | ||
|
||
auto action_manager = std::make_shared<akushon::ActionManager>(); | ||
action_manager->load_data(""); | ||
|
||
akushon_node.set_action_manager(action_manager); | ||
} catch (...) { | ||
} | ||
} |
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.
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.
Why did you use
1100
for the looping limit?Can you explain about this?
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.
the delay for the action is 1 second, so i used
1100
to test whether the action would be done in at least 0.1 seconds after the delay. should i change the value or assign it to a variable?