Skip to content

Generic sendCommand methods

Compare
Choose a tag to compare
@branoholy branoholy released this 10 Jun 18:55
· 43 commits to master since this release
1bcee5f

This release adds a support for generic sendCommand methods. From now, there are two ways how to send a command. You can send it

  • with a string format

    std::string commandFormat = "setmotor %d %d %d";
    
    // No response is expected.
    controller.sendFormattedCommand(commandFormat, 20, 20, 5);
    
    // A string response is expected.
    std::string response = controller.sendFormattedCommand<std::string>(commandFormat, 20, 20, 5);
  • or with any value that can be written to a stream (parameters are separated by space).

    // No response is expected.
    controller.sendCommand("setmotor", 20, 20, 5);
    
    // An integer response is expected.
    int response = controller.sendCommand<int>("setmotor", 20, 20, 5);