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

Fix support for PrismaticJoint in iDynTree::getRandomModel #1057

Merged
merged 3 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [8.999.0] - 2023-03-05

### Fixed
- Fix export of `iDynTree::PrismaticJoint` in `iDynTree::getRandomModel` (https://github.com/robotology/idyntree/pull/1057).

### Changed

#### URDF XML parser change
The XML parser API has changed. Now an additional `XMLParserState` context object is propagated while parsing.
To catch logic errors (which are not pure XML errors that are currently caught by the parser itself) the `XMLParserState` contains a `bool` variable. Further logic can be added to the context state.

Expand Down
11 changes: 7 additions & 4 deletions src/model/include/iDynTree/Model/ModelTestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ inline Link getRandomLink()
/**
* Add a random link with random model.
*/
inline void addRandomLinkToModel(Model & model, std::string parentLink, std::string newLinkName, bool noFixed=false)
inline void addRandomLinkToModel(Model & model, std::string parentLink, std::string newLinkName, bool onlyRevoluteJoints=false)
{
// Add Link
LinkIndex newLinkIndex = model.addLink(newLinkName,getRandomLink());
Expand All @@ -64,7 +64,10 @@ inline void addRandomLinkToModel(Model & model, std::string parentLink, std::str

int jointType = rand() % nrOfJointTypes;

if( noFixed ) jointType = 1;
if (onlyRevoluteJoints)
{
jointType = 1;
}

if( jointType == 0 )
{
Expand Down Expand Up @@ -147,7 +150,7 @@ inline Model getRandomModel(unsigned int nrOfJoints, size_t nrOfAdditionalFrames
return model;
}

inline Model getRandomChain(unsigned int nrOfJoints, size_t nrOfAdditionalFrames = 10, bool noFixed=false)
inline Model getRandomChain(unsigned int nrOfJoints, size_t nrOfAdditionalFrames = 10, bool onlyRevoluteJoints=false)
{
Model model;

Expand All @@ -158,7 +161,7 @@ inline Model getRandomChain(unsigned int nrOfJoints, size_t nrOfAdditionalFrames
{
std::string parentLink = linkName;
linkName = "link" + int2string(i);
addRandomLinkToModel(model,parentLink,linkName,noFixed);
addRandomLinkToModel(model,parentLink,linkName,onlyRevoluteJoints);
}

for(unsigned int i=0; i < nrOfAdditionalFrames; i++)
Expand Down