|
mc_rtc
2.14.0
|
#include <mc_control/ControllerClient.h>

Public Member Functions | |
| ControllerClient () | |
| ControllerClient (const std::string &sub_conn_uri, const std::string &push_conn_uri, double timeout=0) | |
| ControllerClient (ControllerServer &server, mc_rtc::gui::StateBuilder &gui) | |
| ControllerClient (const ControllerClient &)=delete | |
| ControllerClient & | operator= (const ControllerClient &)=delete |
| ~ControllerClient () | |
| void | connect (const std::string &sub_conn_uri, const std::string &push_conn_uri) |
| void | connect (ControllerServer &server, mc_rtc::gui::StateBuilder &gui) |
| void | send_request (const ElementId &id, const mc_rtc::Configuration &data) |
| template<typename T > | |
| void | send_request (const ElementId &id, const T &data) |
| void | send_request (const ElementId &id) |
| void | raw_request (const ElementId &id, const mc_rtc::Configuration &data, std::string &out) |
| template<typename T > | |
| void | raw_request (const ElementId &id, const T &data, std::string &out) |
| void | raw_request (const ElementId &id, std::string &out) |
| void | timeout (double t) |
| double | timeout () |
| void | run (std::vector< char > &buffer, std::chrono::system_clock::time_point &t_last_received) |
| void | run (const char *buffer, size_t bufferSize) |
Protected Member Functions | |
| void | start () |
| void | reconnect (const std::string &sub_conn_uri, const std::string &push_conn_uri) |
| void | stop () |
| void | handle_gui_state (mc_rtc::Configuration state) |
| void | handle_category (const std::vector< std::string > &parent, const std::string &category, const mc_rtc::Configuration &data) |
| void | handle_widget (const ElementId &id, const mc_rtc::Configuration &data) |
| virtual void | started () |
| virtual void | stopped () |
| virtual void | category (const std::vector< std::string > &parent, const std::string &category) |
| virtual void | label (const ElementId &id, const std::string &) |
| virtual void | array_label (const ElementId &id, const std::vector< std::string > &, const Eigen::VectorXd &) |
| virtual void | button (const ElementId &id) |
| virtual void | checkbox (const ElementId &id, bool) |
| virtual void | string_input (const ElementId &id, const std::string &) |
| virtual void | integer_input (const ElementId &id, int) |
| virtual void | number_input (const ElementId &id, double) |
| virtual void | number_slider (const ElementId &id, double, double, double) |
| virtual void | array_input (const ElementId &id, const std::vector< std::string > &, const Eigen::VectorXd &) |
| virtual void | combo_input (const ElementId &id, const std::vector< std::string > &, const std::string &) |
| virtual void | data_combo_input (const ElementId &id, const std::vector< std::string > &, const std::string &) |
| virtual void | point3d (const ElementId &id, const ElementId &, bool, const Eigen::Vector3d &, const mc_rtc::gui::PointConfig &) |
| virtual void | trajectory (const ElementId &id, const std::vector< Eigen::Vector3d > &, const mc_rtc::gui::LineConfig &) |
| virtual void | trajectory (const ElementId &id, const std::vector< sva::PTransformd > &, const mc_rtc::gui::LineConfig &) |
| virtual void | trajectory (const ElementId &id, const Eigen::Vector3d &, const mc_rtc::gui::LineConfig &) |
| virtual void | trajectory (const ElementId &id, const sva::PTransformd &, const mc_rtc::gui::LineConfig &) |
| virtual void | polygon (const ElementId &id, const std::vector< std::vector< Eigen::Vector3d >> &, const mc_rtc::gui::Color &) |
| virtual void | polygon (const ElementId &id, const std::vector< std::vector< Eigen::Vector3d >> &points, const mc_rtc::gui::LineConfig &config) |
| virtual void | polyhedron (const ElementId &id, const std::vector< std::array< Eigen::Vector3d, 3 >> &triangles, const std::vector< std::array< mc_rtc::gui::Color, 3 >> &colors, const mc_rtc::gui::PolyhedronConfig &config) |
| virtual void | polyhedron (const ElementId &id, const std::vector< Eigen::Vector3d > &vertices, const std::vector< std::array< size_t, 3 >> &triangles, const std::vector< mc_rtc::gui::Color > &colors, const mc_rtc::gui::PolyhedronConfig &config) |
| virtual void | force (const ElementId &id, const ElementId &, const sva::ForceVecd &, const sva::PTransformd &, const mc_rtc::gui::ForceConfig &, bool) |
| virtual void | arrow (const ElementId &id, const ElementId &, const Eigen::Vector3d &, const Eigen::Vector3d &, const mc_rtc::gui::ArrowConfig &, bool) |
| virtual void | rotation (const ElementId &id, const ElementId &, bool, const sva::PTransformd &) |
| virtual void | transform (const ElementId &id, const ElementId &, bool, const sva::PTransformd &) |
| virtual void | xytheta (const ElementId &id, const ElementId &, bool, const Eigen::Vector3d &, double) |
| virtual void | table_start (const ElementId &id, const std::vector< std::string > &) |
| virtual void | table_row (const ElementId &, const std::vector< std::string > &) |
| virtual void | table_end (const ElementId &) |
| virtual void | robot (const ElementId &id, const std::vector< std::string > &, const std::vector< std::vector< double >> &, const sva::PTransformd &) |
| virtual void | robot_msg (const ElementId &id, const mc_rtc::gui::RobotMsgData &) |
| virtual void | visual (const ElementId &id, [[maybe_unused]] const rbd::parsers::Visual &visual, [[maybe_unused]] const sva::PTransformd &pose) |
| virtual void | schema (const ElementId &id, const std::string &) |
| virtual void | form (const ElementId &id) |
| virtual void | form_checkbox (const ElementId &, const std::string &, bool, bool) |
| virtual void | form_checkbox (const ElementId &formId, const std::string &name, bool required, bool default_, bool) |
| virtual void | form_integer_input (const ElementId &, const std::string &, bool, int) |
| virtual void | form_integer_input (const ElementId &formId, const std::string &name, bool required, int default_, bool) |
| virtual void | form_number_input (const ElementId &, const std::string &, bool, double) |
| virtual void | form_number_input (const ElementId &formId, const std::string &name, bool required, double default_, bool) |
| virtual void | form_string_input (const ElementId &, const std::string &, bool, const std::string &) |
| virtual void | form_string_input (const ElementId &formId, const std::string &name, bool required, const std::string &default_, bool) |
| virtual void | form_array_input (const ElementId &, const std::string &, bool, const Eigen::VectorXd &, bool) |
| virtual void | form_array_input (const ElementId &formId, const std::string &name, bool required, const Eigen::VectorXd &default_, bool fixed_size, bool) |
| virtual void | form_array_input (const ElementId &formId, const std::string &name, bool required, const std::vector< std::string > &, const Eigen::VectorXd &default_, bool fixed_size, bool default_from_user) |
| virtual void | form_combo_input (const ElementId &, const std::string &, bool, const std::vector< std::string > &, bool) |
| virtual void | form_combo_input (const ElementId &formId, const std::string &name, bool required, const std::vector< std::string > &values, bool send_index, int) |
| virtual void | form_data_combo_input (const ElementId &, const std::string &, bool, const std::vector< std::string > &, bool) |
| virtual void | form_point3d_input (const ElementId &, const std::string &, bool, const Eigen::Vector3d &, bool, bool) |
| virtual void | form_rotation_input (const ElementId &, const std::string &, bool, const sva::PTransformd &, bool, bool) |
| virtual void | form_transform_input (const ElementId &, const std::string &, bool, const sva::PTransformd &, bool, bool) |
| virtual void | start_form_object_input (const std::string &, bool) |
| virtual void | end_form_object_input () |
| virtual void | start_form_generic_array_input (const std::string &, bool, std::optional< std::vector< Configuration >>) |
| virtual void | end_form_generic_array_input () |
| virtual void | start_form_one_of_input (const std::string &, bool, const std::optional< std::pair< size_t, Configuration >> &) |
| virtual void | end_form_one_of_input () |
| virtual void | start_plot (uint64_t, const std::string &) |
| virtual void | plot_setup_xaxis (uint64_t, const std::string &, const mc_rtc::gui::plot::Range &) |
| virtual void | plot_setup_yaxis_left (uint64_t, const std::string &, const mc_rtc::gui::plot::Range &) |
| virtual void | plot_setup_yaxis_right (uint64_t, const std::string &, const mc_rtc::gui::plot::Range &) |
| virtual void | plot_point (uint64_t, uint64_t, const std::string &, double, double, mc_rtc::gui::Color, mc_rtc::gui::plot::Style, mc_rtc::gui::plot::Side) |
| virtual void | plot_polygon (uint64_t, uint64_t, const std::string &, const mc_rtc::gui::plot::PolygonDescription &, mc_rtc::gui::plot::Side) |
| virtual void | plot_polygons (uint64_t, uint64_t, const std::string &, const std::vector< mc_rtc::gui::plot::PolygonDescription > &, mc_rtc::gui::plot::Side) |
| virtual void | end_plot (uint64_t) |
Protected Attributes | |
| bool | run_ = true |
| int | sub_socket_ = -1 |
| std::thread | sub_th_ |
| int | push_socket_ = -1 |
| double | timeout_ |
| mc_rtc::Configuration | data_ |
| ControllerServer * | server_ = nullptr |
| mc_rtc::gui::StateBuilder * | gui_ = nullptr |
Receives data and interact with a ControllerServer
| mc_control::ControllerClient::ControllerClient | ( | ) |
Constructor
Default (disconnected) client
| mc_control::ControllerClient::ControllerClient | ( | const std::string & | sub_conn_uri, |
| const std::string & | push_conn_uri, | ||
| double | timeout = 0 |
||
| ) |
Constructor
| sub_conn_uri | URI the SUB socket should connect to |
| push_conn_uri | URI the PUSH socket should connect to |
| timeout | After timeout has elapsed without receiving messages from the SUB socket, pass an empty message to handle_gui_state. It should be expressed in secondd. If timeout <= 0, this is ignored. |
Check nanomsg documentation for supported protocols
| mc_control::ControllerClient::ControllerClient | ( | ControllerServer & | server, |
| mc_rtc::gui::StateBuilder & | gui | ||
| ) |
Constructor
| server | In-memory ControllerServer instance |
| gui | GUI updated by the server |
|
delete |
| mc_control::ControllerClient::~ControllerClient | ( | ) |
|
inlineprotectedvirtual |
Should be implemented to create a widget able to input array of numbers
|
inlineprotectedvirtual |
Should be implemented to create a label for a numeric array
category Category under which the label appears label Name of the data labels Per-dimension label (can be empty) data Data to display
|
inlineprotectedvirtual |
Should display an arrow in 3D environment
|
inlineprotectedvirtual |
Should be implemented to create a button
|
inlineprotectedvirtual |
Should be implemented to create a new category container
|
inlineprotectedvirtual |
Should be implemented to create a checkbox
|
inlineprotectedvirtual |
Should be implemented to create a widget able to select one string among many
| void mc_control::ControllerClient::connect | ( | const std::string & | sub_conn_uri, |
| const std::string & | push_conn_uri | ||
| ) |
Connect to the provided uris
| void mc_control::ControllerClient::connect | ( | ControllerServer & | server, |
| mc_rtc::gui::StateBuilder & | gui | ||
| ) |
Connect to an in-memory server
|
inlineprotectedvirtual |
Should be implemented to create a widget able to select one string among entries available in the data part of the GUI message
|
inlineprotectedvirtual |
Pendant to start_form_generic_array_input
After this call, all calls related to form elements must be interpreted as belonging to the form's parent
|
inlineprotectedvirtual |
Pendant to start_form_object_input
After this call, all calls related to form elements must be interpreted as belonging to the form's parent
|
inlineprotectedvirtual |
Pendant to start_form_one_of_input
After this call, all calls related to form elements must be interpreted as belonging to the form's parent
|
inlineprotectedvirtual |
Called when no more data for a plot will come this iteration
This typically should refresh the log display
|
inlineprotectedvirtual |
Should display a force in 3D environment
|
inlineprotectedvirtual |
Create a form
|
inlineprotectedvirtual |
An array input within a form
This is kept for backward compatibility, mc_rtc never calls this version and you should implement the full version
|
inlineprotectedvirtual |
An array input within a form
This is kept for backward compatibility, mc_rtc never calls this version and you should implement the full version
|
inlineprotectedvirtual |
An array input within a form
|
inlineprotectedvirtual |
A checkbox within a form
This is kept for backward compatibility, mc_rtc never calls this version and you should implement the full version
|
inlineprotectedvirtual |
A checkbox within a form
|
inlineprotectedvirtual |
A combo input within a form
This is kept for backward compatibility, mc_rtc never calls this version and you should implement the full version
|
inlineprotectedvirtual |
A combo input within a form
formId Identifier of the form
name Name of the entry
required If true, it must hold a value when the form is sent
values Possible values
send_index If true, the implementation should send back the index rather than the value
|
inlineprotectedvirtual |
A data combo input within a form
formId Identifier of the form
name Name of the entry
required If true, it must hold a value when the form is sent
ref Reference to GUI data store, can reference other fields of the form, e.g. {"$R0", "surfaces"} depends on the value of the R0 entry in the form
send_index If true, the implementation should send back the index in the list rather than the value
|
inlineprotectedvirtual |
An integer input within a form
This is kept for backward compatibility, mc_rtc never calls this version and you should implement the full version
|
inlineprotectedvirtual |
An integer input within a form
|
inlineprotectedvirtual |
A number input within a form
This is kept for backward compatibility, mc_rtc never calls this version and you should implement the full version
|
inlineprotectedvirtual |
A number input within a form
|
inlineprotectedvirtual |
A 3D point that can be edited within a Form
formId Identifier of the form
name Name of the entry
required If true, it must hold a value when the form is sent
default_ Default value in the form
default_from_user Default is provided by the user
interactive Should display an interactive marker
|
inlineprotectedvirtual |
A rotation that can be edited within a Form
Note: this requires a PTransformd to place the rotation in space but only the rotation should be provided in the callback
formId Identifier of the form
name Name of the entry
required If true, it must hold a value when the form is sent
default_ Default value in the form
default_from_user Default is provided by the user
interactive Should display an interactive marker
|
inlineprotectedvirtual |
A string input within a form
This is kept for backward compatibility, mc_rtc never calls this version and you should implement the full version
|
inlineprotectedvirtual |
A string input within a form
|
inlineprotectedvirtual |
A transform that can be edited within a Form
formId Identifier of the form
name Name of the entry
required If true, it must hold a value when the form is sent
default_ Default value in the form
default_from_user Default is provided by the user
interactive Should display an interactive marker
|
protected |
|
protected |
|
protected |
|
inlineprotectedvirtual |
Should be implemented to create a widget able to input integers
|
inlineprotectedvirtual |
Should be implemented to create a label for data that can be displayed as string
|
inlineprotectedvirtual |
Should be implemented to create a widget able to input numbers
|
inlineprotectedvirtual |
|
delete |
|
inlineprotectedvirtual |
Add data to be displayed on a plot
id Plot id
did Id for this data, this is strictly increasing from 0 to the number of plots - 1
legend Legend for this data
x X value
y Y value
style How to link data points together
side Add on the Y left or right side
|
inlineprotectedvirtual |
Plot a polygon
id Id for the plot
did Id for this polygon
legen Legend to describe this polygon
polygon Description of the polygon
side Side where the polygon should be displayed
|
inlineprotectedvirtual |
Plot several polygons under the same legend
id Id for the plot
did Id for these polygons
legen Legend to describe these polygons
polygons Description of the polygons
side Side where the polygons should be displayed
|
inlineprotectedvirtual |
Setup the X-axis
id Plot id
legend Legend on the X-axis
range Range on the X-axis plot
|
inlineprotectedvirtual |
Setup the Y-axis on the left side
id Plot id
legend Legend on the Y-axis
range Range on the Y-axis plot
|
inlineprotectedvirtual |
Setup the Y-axis on the right side
id Plot id
legend Legend on the Y-axis
range Range on the Y-axis plot
|
inlineprotectedvirtual |
Should display an interactive point in 3D environment
requestId should be in requests instead of id
bool ro indicates whether this point is interactive or not
|
inlineprotectedvirtual |
Should display a list of polygons of 3d points in 3D environment
For backward compatibility, this version has the default implementation and the version that accepts a LineConfig configuration instead of a Color is implemented in terms of this one. The opposite makes more sense in actual implementation of ControllerClient.
points Each entry in the vector is a polygon described by its 3D points
color Color of the polygon
|
inlineprotectedvirtual |
Should display a list of polygons of 3D points in 3D environment
For backward compatibility, this version is implemented to forward the call to the color variant, the concrete implementation makes more sense the other way around.
points Each entry in the vector is a polygon described by its 3D points
config Describe how to display the polygon
|
protectedvirtual |
Should display a polyhedron
The polygon is described by a list of vertices and a list of triangles
A triangle list version is also available, this default implementation calls that by default.
| colors | might be empty |
| config | contains additional information about handling the drawing |
|
protectedvirtual |
Should display a polyhedron
The polyhedron is described by a list of clockwise-ordered triangles.
A vertices/triangles version is also available, this default implementation calls that by default.
| colors | might be empty |
| config | contains additional information about handling the drawing |
| void mc_control::ControllerClient::raw_request | ( | const ElementId & | id, |
| const mc_rtc::Configuration & | data, | ||
| std::string & | out | ||
| ) |
Get the raw request data
out.c_str() can be used to send requests to the raw data interface of ControllerServer
|
inline |
Helper for raw request in simple cases
| void mc_control::ControllerClient::raw_request | ( | const ElementId & | id, |
| std::string & | out | ||
| ) |
Helper for the void case
|
protected |
Connect/Reconnect the client and start receiving data asap
| sub_conn_uri | URI the SUB socket should connect to |
| push_conn_uri | URI the PUSH socket should connect to |
Check nanomsg documentation for supported protocols
|
inlineprotectedvirtual |
Should display a robot model, the RobotModule can be created using parameters, its configuration is in \q and its world position is in posW
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
Should display a rotation in 3D environment
requestId should be in requests instead of id
bool ro indicates whether this point is interactive or not
| void mc_control::ControllerClient::run | ( | const char * | buffer, |
| size_t | bufferSize | ||
| ) |
Run with raw data received from any possible way
| buffer | Data to be processed |
| bufferSize | Size of data |
| void mc_control::ControllerClient::run | ( | std::vector< char > & | buffer, |
| std::chrono::system_clock::time_point & | t_last_received | ||
| ) |
Check if there is an available message from the server and process it
This is the synchronous pendant to start()
| buffer | Buffer to receive data from the server, if it is too small, the buffer is resized and the message is discarded |
| t_last_received | Time when the last message was received, it is updated if the client receives a message. If a message has not been received since timeout() then act as if we received an empty message (server offline). |
|
inlineprotectedvirtual |
Should display a form to send schema-based request to the server
schema is the schema directory relative to mc_rtc JSON schema installation
| void mc_control::ControllerClient::send_request | ( | const ElementId & | id | ) |
Helper for the void case
| void mc_control::ControllerClient::send_request | ( | const ElementId & | id, |
| const mc_rtc::Configuration & | data | ||
| ) |
Send a request to the given element in the given category using data
|
inline |
Helper for send_request in simple cases
|
protected |
Should be called when the client is ready to receive data
|
inlineprotectedvirtual |
Starts a generic array input
The next call related to form elements must be interpreted as describing the type of members the array expects
name Name of the array this generates
required If true, it must hold a value (can be an empty array) when the form is sent
data Existing data in the array, must be sent along with the form if provided
|
inlineprotectedvirtual |
Starts a form within a form
After this call, all calls related to form elements must be interpreted as belonging to this sub-form
name Name of the object
required If true, it must hold a value when the form is sent
|
inlineprotectedvirtual |
Start a one-of input within a form
After this call, each call related to form elements is one option offered by the one-of selector. The name of the element should be used to distinguish the selected type
name Name of the one-of selection
required If true, it must hold a valid value when sent
data Active data
|
inlineprotectedvirtual |
Called when new plot data arrives
This should open a new plotting window with the provided title.
id The plot id, this serves to disambiguate plots with the same title that are started right after closing the previous one
title Title of the plot
|
inlineprotectedvirtual |
Called when a message starts being processed, can be used to lock the GUI
|
protected |
Kill the connection and data flow
|
inlineprotectedvirtual |
Called when a message has been processed
|
inlineprotectedvirtual |
Should be implemented to create a widget able to input strings
|
inlineprotectedvirtual |
Called to close a table identified by id
|
inlineprotectedvirtual |
Called for each element appearing in the table identified by id
|
inlineprotectedvirtual |
Called when a table starts
| double mc_control::ControllerClient::timeout | ( | ) |
Get the current timeout
| void mc_control::ControllerClient::timeout | ( | double | t | ) |
Set the timeout of the SUB socket
|
inlineprotectedvirtual |
Should display a trajectory of points, points are added one by one by the server
point New point added to the trajectory
|
inlineprotectedvirtual |
Should display a trajectory of 3d points in 3D environment
points Vector of 3D points
|
inlineprotectedvirtual |
Should display a trajectory of transforms in 3D environment
points Vector of poses
|
inlineprotectedvirtual |
Should display a trajectory of points, points are added one by one by the server
point New point added to the trajectory
|
inlineprotectedvirtual |
Should display a PTransform in 3D environment
requestId should be in requests instead of id
bool ro indicates whether this point is interactive or not
|
inlineprotectedvirtual |
Should display the visual element visual at the position pose
|
inlineprotectedvirtual |
Should display X,Y,theta in a 3D environment
requestId should be in requests instead of id
bool ro indicates whether this point is interactive or not
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |