-
Notifications
You must be signed in to change notification settings - Fork 38
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
Implement MANNTrajectoryGenerator in ML component #668
Conversation
3034bd6
to
4f33272
Compare
f30d5b7
to
6fa5033
Compare
Is there any test? |
I dont know how to properly test it. What I can do is to try to generate a trajectory while asking to do not move and check if there is only a double support phase. |
Properly checking seems tricky also to me, since a "weird" path could in principle be generated even if the implementation is correct.
This makes sense, it is a very basic test but at least guarantees that the trajectory generation starts properly. In addition, we could think of testing forward/backward/sideways walking by giving the correspondent input and checking whether after a certain amount of time the base/CoM/feet positions in the world frame increased significantly "only" in the expected direction. For instance, checking that after 10s of forward walking the CoM x increased a lot and the CoM y remained within a threshold. But still, it cannot be a very restrictive test because the performances of the architecture are robot- and training-dependent and can vary also a lot. |
Hi @paolo-viceconte, we can easily implement the tests you suggested. At least we will have a test that spots some wired motion |
Awesome! Otherwise also a simple test where you call the methods and make sure it does not segfault 😉 |
c337fa8
to
caddb70
Compare
Hi @S-Dafarra in 8fe6311 I implemented a test to check that the robot walks forward when the planner is called with a given set of inputs |
caddb70
to
8fe6311
Compare
src/ML/src/MANNAutoregressive.cpp
Outdated
// TODO remove 51 | ||
AutoregressiveState state; | ||
state.pastProjectedBasePositions = std::deque<Eigen::Vector2d>{51, Eigen::Vector2d{0.0, 0.0}}; | ||
state.pastProjectedBaseVelocity = std::deque<Eigen::Vector2d>{51, Eigen::Vector2d{0.0, 0.0}}; |
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.
Actually, what is that 51?
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.
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.
51 is the length of 1 second of past trajectory stored in the autoregressive state. Since the original mocap data are collected at 50 Hz, and therefore the trajectory generation is assumed to proceed at 50 Hz, we need 50 datapoints to store the past second of trajectory. Along with the present datapoint, they sum up to 51!
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.
This comment will become a comment of the code
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.
This comment will become a comment of the code
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.
Done here bb33760
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.
Is it worth having it as an input parameter? Ideally, it should be one metadata of the loaded model
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.
Yes, I agree. In the next PR, we are going to generate the trajectory from the joypad. I think we can try to handle this in that PR
8fe6311
to
61dd92b
Compare
2a5b8ac
to
464ca81
Compare
Merging for the time being, keeping in mind that we need to handle this #668 (comment) in the PR related to the generation of the input to the planner (cc @paolo-viceconte) |
2be4346
to
a5c98fe
Compare
This PR implements
MANNTrajectoryGenerator
.The
MANNTrajectoryGenerator
class utilizes theMANNAutoregressive
algorithm to generate a kinematically feasible trajectory for humanoid robots. The planner generates a trajectory with a duration equal toslow_down_factor * time_horizon
seconds.The diagram shows how the
MANNAutoregressive
is used within theMANNTrajectoryGenerator
class.To initialize the generator, the user must set the initial state using the
MANNTrajectoryGenerator::setInitialState
method. The generator takesMANNTrajectoryGeneratorInput
as input, which is used as the input forMANNAutoregressiveInput
, along with themergePointIndex
. TheMANNAutoregressiveInput
is assumed to remain constant within the trajectory horizon. ThemergePointIndex
indicates the index at which the new trajectory will be attached. For example, if theMANNTrajectoryGenerator
generates a trajectory consisting of 'N' points and themergePointIndex
is set to 3, the first three elements of the new trajectory will be derived from the previously computed trajectory usingMANNTrajectoryGeneratorOutput
and the previousMANNAutoregressiveInput
. Subsequently, all points from 3 to N will be evaluated using the currentMANNAutoregressiveInput
. This behavior is facilitated by storing the autoregressive state required for resetting theMANNAutoregressive
at the designated merge point. Whenever theMANNAutoregressive::advance()
function is invoked by theMANNTrajectoryGenerator
, the autoregressive state is stored for future reference.Drawio diagram adherent_autregressive.zip