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 }
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.
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.
auto getRandomModel(unsigned int nrOfJoints, size_t nrOfAdditionalFrames, bool onlyRevoluteJoints) -> Model
auto getRandomChain(unsigned int nrOfJoints, size_t nrOfAdditionalFrames, bool onlyRevoluteJoints) -> Model
void getRandomJointPositions(VectorDynSize& vec, const Model& model)
Get random joint position consistently with the limits of the model.
auto getRandomInverseDynamicsInputs(FreeFloatingPos& pos, FreeFloatingVel& vel, FreeFloatingAcc& acc, LinkNetExternalWrenches& extWrenches) -> bool deprecated
Get random robot positions, velocities and accelerations and external wrenches to be given as an input to InverseDynamics.
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

Function documentation

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

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.

bool getRandomInverseDynamicsInputs(FreeFloatingPos& pos, FreeFloatingVel& vel, FreeFloatingAcc& acc, LinkNetExternalWrenches& extWrenches)

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