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

[Sprint 11/PI - 154] Akushon Unit Test #31

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

Alffaza
Copy link
Member

@Alffaza Alffaza commented Mar 27, 2022

Jira Link:

https://ichiro-its.atlassian.net/browse/PI-154

Description

create unit test for node initialization, interpolator, and action creation

Type of Change

  • Bugfix
  • Enhancement
  • New feature
  • Breaking change (fix or feature that would cause the existing functionality to not work as expected)

How Has This Been Tested?

  • New unit tests added.
  • Manual tested.

Checklist:

  • Using Branch Name Convention
    • feature/JIRA-ID-SHORT-DESCRIPTION if has a JIRA ticket
    • enhancement/SHORT-DESCRIPTION if has/has no JIRA ticket and contain enhancement
    • hotfix/SHORT-DESCRIPTION if the change doesn't need to be tested (urgent)
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made the documentation for the corresponding changes.

std::vector<tachimawari::joint::Joint> action_manager_joints = action_manager.get_joints();

for (int i = 0; i < 20; i++){
ASSERT_TRUE(expected_positions[0][i] + max_error > action_manager_joints[i].get_position()
Copy link
Member

Choose a reason for hiding this comment

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

You can use EXPECT_NEAR instead, see this.

Copy link
Member

Choose a reason for hiding this comment

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

Another similar usage as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

okay done

&& expected_positions[0][i] - max_error < action_manager_joints[i].get_position());
}

for (int i = 0; i < 1100; i++)
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

@maroqijalil maroqijalil left a comment

Choose a reason for hiding this comment

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

There are request change and question

@maroqijalil
Copy link
Member

My guess was the interpolator test has its loop until the action used for testing finished. You can expect_near or assert_equal the result of nth loop with the difference value of current pose target position against initial position multiply by its speed and nth loop. Exactly, you have to calculate the current joint values on nth loop that you want to assert.
But I think this is okay, the code was manually tested. Good for your beginning on making this code.

@maroqijalil
Copy link
Member

Maybe mas @threeal, any suggestion or comment?

Copy link
Member

@threeal threeal left a comment

Choose a reason for hiding this comment

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

looks good for me

@threeal
Copy link
Member

threeal commented Apr 11, 2022

btw pls resolve the warnings @Alffaza

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

Successfully merging this pull request may close these issues.

4 participants