iDynTree/ModelTestUtils.h file

Namespaces

namespace iDynTree

Enums

enum JointTypes: unsigned int { JOINT_FIXED = 1 << 0, JOINT_REVOLUTE = 1 << 1, JOINT_PRISMATIC = 1 << 2, JOINT_REVOLUTE_SO2 = 1 << 3, JOINT_SPHERICAL = 1 << 4 }
Bitfield enum for selecting joint types in random model generation.

Functions

auto getRandomLink() -> Link
void addRandomLinkToModel(Model& model, std::string parentLink, std::string newLinkName, unsigned int allowedJointTypes = SIMPLE_JOINT_TYPES)
Add a random link with random model.
IDYNTREE_DEPRECATED_WITH_MSG("Use addRandomLinkToModel variant that takes in input the " "allowedJointTypes as bitset.") inline void addRandomLinkToModel(Model &model
Add a random link with random model.
if(onlyRevoluteJoints)
auto addRandomLinkToModel(model, parentLink, newLinkName, allowedJointTypes) -> return
void addRandomAdditionalFrameToModel(Model& model, std::string parentLink, std::string newFrameName)
Add a random additional frame to a model model.
auto getRandomLinkIndexOfModel(const Model& model) -> LinkIndex
auto getRandomLinkOfModel(const Model& model) -> std::string
auto int2string(int i) -> std::string
auto getRandomModel(unsigned int nrOfJoints, size_t nrOfAdditionalFrames = 10, unsigned int allowedJointTypes = SIMPLE_JOINT_TYPES) -> Model
Generate a random model with the specified number of joints and additional frames.
auto getRandomChain(unsigned int nrOfJoints, size_t nrOfAdditionalFrames = 10, unsigned int allowedJointTypes = SIMPLE_JOINT_TYPES) -> Model
Generate a random chain (sequential links) with the specified number of joints and additional frames.
IDYNTREE_DEPRECATED_WITH_MSG("Use getRandomModel variant that takes in input the allowedJointTypes " "as bitset.") inline Model getRandomModel(unsigned int nrOfJoints
auto getRandomModel(nrOfJoints, nrOfAdditionalFrames, allowedJointTypes) -> return
IDYNTREE_DEPRECATED_WITH_MSG("Use getRandomChain variant that takes in input the allowedJointTypes " "as bitset.") inline Model getRandomChain(unsigned int nrOfJoints
auto getRandomChain(nrOfJoints, nrOfAdditionalFrames, allowedJointTypes) -> return
void getRandomJointPositions(VectorDynSize& vec, const Model& model)
Get random joint position consistently with the limits of the model.
IDYNTREE_DEPRECATED_WITH_MSG("This function does not work properly with RevoluteSO2Joint joints. " "Use the version that takes a Model parameter instead.") inline bool getRandomInverseDynamicsInputs(FreeFloatingPos &pos deprecated
Get random robot positions, velocities and accelerations and external wrenches to be given as an input to InverseDynamics.
auto baseVel() -> vel
auto baseAcc() -> acc
for()
auto getRandomInverseDynamicsInputs(const Model& model, FreeFloatingPos& pos, FreeFloatingVel& vel, FreeFloatingAcc& acc, LinkNetExternalWrenches& extWrenches) -> bool
Get random robot positions, velocities and accelerations and external wrenches to be given as an input to InverseDynamics.

Variables

const unsigned int SIMPLE_JOINT_TYPES
const unsigned int ALL_JOINT_TYPES
std::string parentLink
std::string std::string newLinkName
std::string std::string bool onlyRevoluteJoints
size_t nrOfAdditionalFrames
FreeFloatingVel& vel
FreeFloatingVel FreeFloatingAcc& acc
FreeFloatingVel FreeFloatingAcc LinkNetExternalWrenches& extWrenches
return true

Function documentation

IDYNTREE_DEPRECATED_WITH_MSG("Use addRandomLinkToModel variant that takes in input the " "allowedJointTypes as bitset.") inline void addRandomLinkToModel(Model &model

Add a random link with random model.

This version is deprecated as it can only permit to either add revolute, prismatic and fixed joints (when onlyRevoluteJoints=false) or only revolute (when onlyRevoluteJoints=true). Please migrate to use addRandomLinkToModel in which the fourth argument is an unsigned int

Model getRandomModel(unsigned int nrOfJoints, size_t nrOfAdditionalFrames = 10, unsigned int allowedJointTypes = SIMPLE_JOINT_TYPES)

Generate a random model with the specified number of joints and additional frames.

Parameters
nrOfJoints Number of joints to add to the model
nrOfAdditionalFrames Number of additional frames to add (default: 10)
allowedJointTypes Bitfield specifying which joint types to include (default: Fixed, Revolute, Prismatic)

Example usage:

  • getRandomModel(5) // Uses default joint types (Fixed, Revolute, Prismatic)
  • getRandomModel(5, 10, JOINT_REVOLUTE | JOINT_PRISMATIC) // Only revolute and prismatic joints
  • getRandomModel(5, 10, JOINT_REVOLUTE) // Only revolute joints
  • getRandomModel(5, 10, SIMPLE_JOINT_TYPES | JOINT_REVOLUTE_SO2) // All joint types including SO2
  • getRandomModel(5, 10, ALL_JOINT_TYPES) // All available joint types including Spherical

Model getRandomChain(unsigned int nrOfJoints, size_t nrOfAdditionalFrames = 10, unsigned int allowedJointTypes = SIMPLE_JOINT_TYPES)

Generate a random chain (sequential links) with the specified number of joints and additional frames.

Parameters
nrOfJoints Number of joints to add to the chain
nrOfAdditionalFrames Number of additional frames to add (default: 10)
allowedJointTypes Bitfield specifying which joint types to include (default: Fixed, Revolute, Prismatic)

void getRandomJointPositions(VectorDynSize& vec, const Model& model)

Get random joint position consistently with the limits of the model.

If the input vector has the wrong size, it will be resized.

IDYNTREE_DEPRECATED_WITH_MSG("This function does not work properly with RevoluteSO2Joint joints. " "Use the version that takes a Model parameter instead.") inline bool getRandomInverseDynamicsInputs(FreeFloatingPos &pos

Get random robot positions, velocities and accelerations and external wrenches to be given as an input to InverseDynamics.