69 using funcptr_t = bool (*)(
const double,
const double,
const double,
const double);
75 static constexpr const char*
s_tag{
"applyVelocityCommandRPC"};
79 static constexpr const char*
s_prototype{
"bool MobileBaseVelocityControlRPC::applyVelocityCommandRPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout)"};
80 static constexpr const char*
s_help{
""};
133 static constexpr const char*
s_tag{
"getLastVelocityCommandRPC"};
137 static constexpr const char*
s_prototype{
"return_getLastVelocityCommand MobileBaseVelocityControlRPC::getLastVelocityCommandRPC()"};
143 cmd{x_vel, y_vel, theta_vel, timeout}
160 theta_vel{theta_vel},
171 return write(writer);
186 if (!writeTag(writer)) {
189 if (!writeArgs(writer)) {
222 if (!readTag(reader)) {
225 if (!readArgs(reader)) {
288 return write(writer);
319 if (!reader.
readBool(return_helper)) {
348 return write(writer);
363 if (!writeTag(writer)) {
366 if (!writeArgs(writer)) {
387 if (!readTag(reader)) {
390 if (!readArgs(reader)) {
421 return write(writer);
436 if (!writer.
write(return_helper)) {
452 if (!reader.
read(return_helper)) {
467 yarp().setOwner(*
this);
472 if (!
yarp().canWrite()) {
476 bool ok =
yarp().write(helper, helper);
477 return ok ? helper.reply.return_helper :
bool{};
482 if (!
yarp().canWrite()) {
486 bool ok =
yarp().write(helper, helper);
493 bool showAll = (functionName ==
"--all");
494 std::vector<std::string> helpString;
496 helpString.emplace_back(
"*** Available commands:");
499 helpString.emplace_back(
"help");
507 if (functionName ==
"help") {
508 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
509 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
510 helpString.emplace_back(
"@param functionName name of command for which to get a detailed description. If none or '--all' is provided, print list of available commands");
511 helpString.emplace_back(
"@return list of strings (one string per line)");
514 if (helpString.empty()) {
515 helpString.emplace_back(
"Command not found");
523 constexpr size_t max_tag_len = 1;
533 std::string tag = reader.
readTag(1);
534 bool direct = (tag ==
"__direct__");
538 while (tag_len <= max_tag_len && !reader.
isError()) {
570 std::string functionName;
572 functionName =
"--all";
574 auto help_strings = help(functionName);
580 if (!writer.
writeTag(
"many", 1, 0)) {
586 for (
const auto& help_string : help_strings) {
602 std::string next_tag = reader.
readTag(1);
603 if (next_tag.empty()) {
606 tag.append(
"_").append(next_tag);
607 tag_len = std::count(tag.begin(), tag.end(),
'_') + 1;
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
~Command() override=default
bool readTag(yarp::os::idl::WireReader &reader)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * s_prototype
bool(*)(const double, const double, const double, const double) funcptr_t
static constexpr size_t s_cmd_len
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void call(MobileBaseVelocityControlRPC *ptr)
static constexpr size_t s_tag_len
MobileBaseVelocityControlRPC_applyVelocityCommandRPC_helper()=default
static constexpr const char * s_help
static constexpr const char * s_tag
static constexpr size_t s_reply_len
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Command() override=default
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readTag(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
~Reply() override=default
return_getLastVelocityCommand return_helper
void call(MobileBaseVelocityControlRPC *ptr)
static constexpr const char * s_help
static constexpr size_t s_reply_len
static constexpr size_t s_cmd_len
MobileBaseVelocityControlRPC_getLastVelocityCommandRPC_helper()=default
static constexpr size_t s_tag_len
static constexpr const char * s_prototype
static constexpr const char * s_tag
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
return_getLastVelocityCommand(*)() funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual std::vector< std::string > help(const std::string &functionName="--all")
MobileBaseVelocityControlRPC()
virtual bool applyVelocityCommandRPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout)
virtual return_getLastVelocityCommand getLastVelocityCommandRPC()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
An interface for reading from a network connection.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
IDL-friendly connection reader.
bool readString(std::string &str, bool *is_vocab=nullptr)
std::string readTag(size_t len=static_cast< size_t >(-1))
bool read(WirePortable &obj)
bool readFloat64(yarp::conf::float64_t &x)
IDL-friendly connection writer.
bool writeBool(bool x, bool skip_tag=false) const
bool write(const WirePortable &obj) const
bool writeListHeader(int len) const
bool writeTag(const char *tag, int split, int len) const
bool writeFloat64(yarp::conf::float64_t x, bool skip_tag=false) const
bool writeString(const std::string &str, bool skip_tag=false) const
bool writeListEnd() const
bool writeListBegin(int tag, size_t len) const
The main, catch-all namespace for YARP.