RobotCommandStreamHandler#

rb::RobotCommandStreamHandler<T> keeps a command stream open so multiple commands can be sent over the same stream. Use it when one-shot submission is too restrictive or when feedback must be requested incrementally.

Header

Header

#include <rby1-sdk/robot.h>

Declaration

Namespace

rb

Kind

class template

Primary role

Send commands through a persistent stream and request feedback on demand.

Public Member Functions

Method

Purpose

Notes

SendCommand(...)

Push one command into the open stream.

The payload still uses RobotCommandBuilder.

RequestFeedback(...)

Pull feedback from the stream.

Use after one or more streamed commands have been sent.

Wait() and WaitFor(...)

Block until the stream has completed or terminated.

WaitFor(...) is the timed variant.

IsDone() and Cancel()

Check stream completion or cancel the stream.

Useful when the producer side must shut down early.

Numeric Parameters & Returns

Method

Unit / encoding

Notes

SendCommand(..., timeout_ms)

ms

Feedback-receive timeout for the streamed command, not the full command execution duration.

RequestFeedback(timeout_ms)

ms

Timeout for requesting in-flight controller feedback.

WaitFor(timeout_ms)

ms

Timed wait for the stream itself to finish.

Detailed Reference

template<typename T>
class RobotCommandStreamHandler#

Robot command stream handler for continuous command sending.

Provides a streaming interface for sending multiple commands to the robot in sequence while maintaining a persistent connection. This is more efficient than creating individual command handlers for each command.

Template Parameters:

TRobot model type

Public Functions

~RobotCommandStreamHandler()#
void Cancel()#
bool IsDone() const#

Check if the command stream is complete.

Returns:

True if the stream is done/closed, false otherwise.

RobotCommandFeedback RequestFeedback(int timeout_ms = 1000)#

Request feedback from the current command stream.

Requests current controller state information from the ongoing command execution. The feedback includes control errors, target vs actual positions, and execution status.

Parameters:

timeout_ms – Timeout for receiving controller feedback in milliseconds (default: 1000).

Returns:

RobotCommandFeedback Current controller state including position errors, control status, and execution progress.

RobotCommandFeedback SendCommand(const RobotCommandBuilder &builder, int timeout_ms = 1000)#

Send a command through the stream.

Sends a command via the established stream connection and waits for feedback. The command is executed asynchronously by the robot, and this method returns current controller state information (e.g., position error, control status).

Parameters:
  • builder – Command builder containing the command to send.

  • timeout_ms – Timeout for receiving controller feedback in milliseconds (default: 1000). This is the time to wait for controller state information, not the command execution timeout.

Returns:

RobotCommandFeedback Current controller state information including position errors, control status, and execution progress.

void Wait()#

Wait for the command stream to complete.

This method blocks until the stream is closed or cancelled.

bool WaitFor(int timeout_ms)#

Wait for the command stream to complete with timeout.

Parameters:

timeout_ms – Timeout in milliseconds.

Returns:

True if stream completed, false if timeout occurred.

Related Types

Examples

  • demo_motion.cpp is the easiest place to compare one-shot submission against a longer-lived command path.