Template Class URProducer

Inheritance Relationships

Base Type

Class Documentation

template<typename T>
class URProducer : public urcl::comm::IProducer<T>

A general producer for URPackages. Implements funcionality to produce packages by reading and parsing from a byte stream.

Template Parameters:

HeaderT – Header type of packages to produce.

Public Functions

inline URProducer(URStream<T> &stream, Parser<T> &parser)

Creates a URProducer object, registering a stream and a parser.

Parameters:
  • stream – The stream to read from

  • parser – The parser to use to interpret received byte information

inline virtual void setupProducer(const size_t max_num_tries = 0, const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10)) override

Triggers the stream to connect to the robot.

Parameters:
  • max_num_tries – Maximum number of connection attempts before counting the connection as failed. Unlimited number of attempts when set to 0.

  • reconnection_time – time in between connection attempts to the server

inline virtual void teardownProducer() override

Tears down the producer. Currently no special handling needed.

inline virtual void stopProducer() override

Stops the producer. Currently no functionality needed.

inline virtual void startProducer() override
inline virtual bool tryGet(std::vector<std::unique_ptr<T>> &products) override

Attempts to read byte stream from the robot and parse it as a URPackage.

Parameters:

products – Unique pointer to hold the produced package

Returns:

Success of reading and parsing the package