vulp  2.3.0
vulp::actuation::MockInterface Class Reference

#include <MockInterface.h>

Public Member Functions

 MockInterface (const ServoLayout &layout, const double dt)
 Create mock actuator interface. More...
 
 ~MockInterface ()=default
 Default destructor. More...
 
void reset (const Dictionary &config) override
 Reset interface. More...
 
void observe (Dictionary &observation) const override
 Write actuation-interface observations to dictionary. More...
 
void cycle (const moteus::Data &data, std::function< void(const moteus::Output &)> callback) final
 Simulate a new communication cycle. More...
 
- Public Member Functions inherited from vulp::actuation::Interface
 Interface (const ServoLayout &servo_layout)
 Initialize actuation interface for a given servo layout. More...
 
virtual ~Interface ()=default
 Virtual destructor so that derived destructors are called properly. More...
 
const ServoLayoutservo_layout () const noexcept
 Get servo layout. More...
 
const std::map< int, int > & servo_bus_map () const noexcept
 Map from servo ID to the CAN bus the servo is connected to. More...
 
const std::map< int, std::string > & servo_joint_map () const noexcept
 Map from servo ID to joint name. More...
 
std::vector< moteus::ServoCommand > & commands ()
 Get servo commands. More...
 
const std::vector< moteus::ServoReply > & replies () const
 Get servo replies. More...
 
moteus::Data & data ()
 Get joint command-reply data. More...
 
void initialize_action (Dictionary &action)
 Initialize action dictionary with keys corresponding to the servo layout. More...
 
void write_position_commands (const Dictionary &action)
 Write position commands from an action dictionary. More...
 
void write_stop_commands () noexcept
 Stop all servos. More...
 

Detailed Description

Definition at line 20 of file MockInterface.h.

Constructor & Destructor Documentation

◆ MockInterface()

vulp::actuation::MockInterface::MockInterface ( const ServoLayout layout,
const double  dt 
)

Create mock actuator interface.

Parameters
[in]paramsInterface parameters.

Definition at line 11 of file MockInterface.cpp.

◆ ~MockInterface()

vulp::actuation::MockInterface::~MockInterface ( )
default

Default destructor.

Member Function Documentation

◆ cycle()

void vulp::actuation::MockInterface::cycle ( const moteus::Data &  data,
std::function< void(const moteus::Output &)>  callback 
)
finalvirtual

Simulate a new communication cycle.

Parameters
dataBuffer to read commands from and write replies to.
callbackFunction to call when the cycle is over.

The callback will be invoked from an arbitrary thread when the communication cycle has completed. All memory pointed to by data must remain valid until the callback is invoked.

Implements vulp::actuation::Interface.

Definition at line 39 of file MockInterface.cpp.

◆ observe()

void vulp::actuation::MockInterface::observe ( Dictionary &  observation) const
overridevirtual

Write actuation-interface observations to dictionary.

Parameters
[out]observationDictionary to write ot.

Implements vulp::actuation::Interface.

Definition at line 29 of file MockInterface.cpp.

◆ reset()

void vulp::actuation::MockInterface::reset ( const Dictionary &  config)
overridevirtual

Reset interface.

Parameters
[in]configAdditional configuration dictionary.

Implements vulp::actuation::Interface.

Definition at line 27 of file MockInterface.cpp.


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