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

Add zmp generator and populate all outputs of the unycycle trajectory generator #916

Merged

Conversation

LoreMoretti
Copy link
Contributor

@LoreMoretti LoreMoretti commented Dec 10, 2024

Some of the outputs of the UnicycleTrajectoryGenerator were not being populated.

This PR fixes it.

Moreover, the ZMP generator (and its outputs) is added to the UnicycleTrajectoryGenerator

@LoreMoretti LoreMoretti changed the title Populate all outputs of the unycycle trajectory generator Add zmp generator and populate all outputs of the unycycle trajectory generator Dec 16, 2024
@LoreMoretti LoreMoretti force-pushed the unicycleTrajectoryGenerator/addOutputs branch from 03e1d0e to 7f78303 Compare December 18, 2024 15:32
@LoreMoretti LoreMoretti marked this pull request as ready for review December 18, 2024 15:32
@S-Dafarra
Copy link
Member

At the code level, it looks good. What I am a bit afraid of is that from outside it is not clear that the different trajectories are not coherent with each other. At the unicycle planner level, you are calling to different generators, so somehow you can expect them to be separate. Here instead, the output is in a single data structure. Maybe it would be useful to have a trigger to turn on or off this output?

@LoreMoretti
Copy link
Contributor Author

At the code level, it looks good. What I am a bit afraid of is that from outside it is not clear that the different trajectories are not coherent with each other. At the unicycle planner level, you are calling to different generators, so somehow you can expect them to be separate. Here instead, the output is in a single data structure. Maybe it would be useful to have a trigger to turn on or off this output?

You're right! It makes totally sense.

With the commit ecbd51f I tried to make the dcmTrajectory and the zmpTrajectory optional (and enabled by boolean flags).

I like the fact that std::optional makes the code cleaner in my opinion.

There's the drawback. This change makes the blf Unicycle Trajectory Generator not backward compatible. But I think the number of users is still low.

Let me know what you think.

@S-Dafarra
Copy link
Member

There's the drawback. This change makes the blf Unicycle Trajectory Generator not backward compatible. But I think the number of users is still low.

Let me know what you think.

It should be fine by changing the version number. On the other hand, another alternative is to apply this change only for the data you added

@LoreMoretti
Copy link
Contributor Author

@GiulioRomualdi can we merge this PR?

Copy link
Member

@GiulioRomualdi GiulioRomualdi left a comment

Choose a reason for hiding this comment

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

Some minor changes

CHANGELOG.md Outdated Show resolved Hide resolved
examples/UnicycleTrajectoryGenerator/main.cpp Outdated Show resolved Hide resolved
examples/UnicycleTrajectoryGenerator/main.cpp Outdated Show resolved Hide resolved
Comment on lines 145 to +147
void convertToBLF(const iDynTree::Transform& input, manif::SE3d& output)
{
output.asSO3() = iDynTree::toEigen(input.getRotation().asQuaternion());
output.translation(iDynTree::toEigen(input.getPosition()));
output = BipedalLocomotion::Conversions::toManifPose(input);
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps this can be be removed since there is already BipedalLocomotion::Conversions::toManifPose

Copy link
Contributor Author

@LoreMoretti LoreMoretti Jan 20, 2025

Choose a reason for hiding this comment

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

The reason why I added it is because I used it as a helper function in the following function templates:

template <typename From, typename To>
void convertVector(const std::vector<From>& inputVect, std::vector<To>& outputVect)
{
outputVect.resize(inputVect.size());
for (size_t i = 0; i < inputVect.size(); ++i)
{
convertToBLF(inputVect[i], outputVect[i]);
}
}
} // namespace Conversions
} // namespace BipedalLocomotion::Planners::UnicycleUtilities

If I remove void convertToBLF(const iDynTree::Transform& input, manif::SE3d& output), I think I should modify the template function as:

  • perform a check on <From> type.
  • if it is iDynTree::Transform& then call BipedalLocomotion::Conversions::toManifPose instead of void convertToBLF(const iDynTree::Transform& input, manif::SE3d& output).

Do you have other better alternatives?
Is it worth the change?

Copy link
Member

Choose a reason for hiding this comment

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

You convinced me!

@GiulioRomualdi GiulioRomualdi merged commit a2ed322 into ami-iit:master Jan 23, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants