WB-Toolbox  6.0.0
ASimulinkToolboxforWholeBodyControl
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
wbt::base::WBBlock Class Reference

Extension of blockfactory::core::Block for simplifying the development of whole-body blocks. More...

#include <WBBlock.h>

Inheritance diagram for wbt::base::WBBlock:
[legend]

Detailed Description

Extension of blockfactory::core::Block for simplifying the development of whole-body blocks.

This class provides support of parsing the parameters for creating a wbt::RobotInterface object, and helpers for retrieving iDynTree::KinDynComputations and wbt::RobotInterface objects.

See also
blockfactory::core::block

WBBlock Parameters

In addition to block_parameters, wbt::WBBlock requires:

Type Index Rows Cols Name
::STRUCT_STRING 0 + Block::NumberOfParameters 1 1 "RobotName"
::STRUCT_STRING 0 + Block::NumberOfParameters 1 1 "UrdfFile"
::STRUCT_CELL_STRING 0 + Block::NumberOfParameters 1 1 "ControlledJoints"
::STRUCT_CELL_STRING 0 + Block::NumberOfParameters 1 1 "ControlBoardsNames"
::STRUCT_STRING 0 + Block::NumberOfParameters 1 1 "LocalName"
::STRUCT_DOUBLE 0 + Block::NumberOfParameters 1 3 "GravityVector"
::STRING 1 + Block::NumberOfParameters 1 1 "ConfBlockName"
Note
The first set of parameters are fields of the same struct. For this reason they share the same index.

Classes

struct  iDynTreeRobotState
 Container for data structures used for using iDynTree::KinDynComputations::setRobotState More...
 

Public Member Functions

 WBBlock ()
 
 ~WBBlock () override
 
unsigned numberOfParameters () override
 
bool parseParameters (blockfactory::core::BlockInformation *blockInfo) override
 
bool configureSizeAndPorts (blockfactory::core::BlockInformation *blockInfo) override
 
bool initialize (blockfactory::core::BlockInformation *blockInfo) override
 

Static Public Attributes

static constexpr unsigned NumberOfParameters = Block::NumberOfParameters + 2
 The number of parameters WBBlock requires. More...
 

Protected Member Functions

std::shared_ptr< iDynTree::KinDynComputations > getKinDynComputations () const
 Helper for retrieving the iDynTree::KinDynComputations object. More...
 
const std::shared_ptr< wbt::base::RobotInterfacegetRobotInterface () const
 Helper for retrieving the wbt::RobotInterface object. More...
 
bool setRobotState (wbt::base::InputSignalPtr basePose, wbt::base::InputSignalPtr jointsPos, wbt::base::InputSignalPtr baseVelocity, wbt::base::InputSignalPtr jointsVelocity, iDynTree::KinDynComputations *kinDyn)
 Helper for setting the robot state inside the iDynTree::KinDynComputations object. More...
 

Protected Attributes

std::unique_ptr< iDynTreeRobotStatem_robotState
 
std::string m_confBlockName
 
std::shared_ptr< wbt::base::RobotInterfacem_robotInterface
 

Constructor & Destructor Documentation

◆ WBBlock()

WBBlock::WBBlock ( )

◆ ~WBBlock()

WBBlock::~WBBlock ( )
overridedefault

Member Function Documentation

◆ configureSizeAndPorts()

bool WBBlock::configureSizeAndPorts ( blockfactory::core::BlockInformation *  blockInfo)
override

◆ getKinDynComputations()

std::shared_ptr< iDynTree::KinDynComputations > WBBlock::getKinDynComputations ( ) const
protected

Helper for retrieving the iDynTree::KinDynComputations object.

Returns
A pointer to iDynTree::KinDynComputations.

◆ getRobotInterface()

const std::shared_ptr< wbt::base::RobotInterface > WBBlock::getRobotInterface ( ) const
protected

Helper for retrieving the wbt::RobotInterface object.

Returns
A pointer to wbt::RobotInterface.

◆ initialize()

bool WBBlock::initialize ( blockfactory::core::BlockInformation *  blockInfo)
override

◆ numberOfParameters()

unsigned WBBlock::numberOfParameters ( )
override

◆ parseParameters()

bool WBBlock::parseParameters ( blockfactory::core::BlockInformation *  blockInfo)
override

◆ setRobotState()

bool WBBlock::setRobotState ( wbt::base::InputSignalPtr  basePose,
wbt::base::InputSignalPtr  jointsPos,
wbt::base::InputSignalPtr  baseVelocity,
wbt::base::InputSignalPtr  jointsVelocity,
iDynTree::KinDynComputations *  kinDyn 
)
protected

Helper for setting the robot state inside the iDynTree::KinDynComputations object.

Parameters
basePoseThe vector containing the base pose.
jointsPosThe vector containing the joints positions.
baseVelocityThe vector containing the base velocity.
jointsVelocityThe vector containing the joints velocities.
kinDynA pointer to the block's KinDynComputations object.
Returns
True if success, false otherwise.
See also
iDynTree::KinDynComputations::setRobotState, wbt::iDynTreeRobotState

Member Data Documentation

◆ m_confBlockName

std::string wbt::base::WBBlock::m_confBlockName
protected

◆ m_robotInterface

std::shared_ptr<wbt::base::RobotInterface> wbt::base::WBBlock::m_robotInterface
protected

◆ m_robotState

std::unique_ptr<iDynTreeRobotState> wbt::base::WBBlock::m_robotState
protected

◆ NumberOfParameters

constexpr unsigned wbt::base::WBBlock::NumberOfParameters = Block::NumberOfParameters + 2
staticconstexpr

The number of parameters WBBlock requires.


The documentation for this class was generated from the following files: