|
| 1 | +// This file is part of servoarray. |
| 2 | +// |
| 3 | +// servoarray is free software: you can redistribute it and/or modify |
| 4 | +// it under the terms of the GNU General Public License as published by |
| 5 | +// the Free Software Foundation, either version 3 of the License, or |
| 6 | +// (at your option) any later version. |
| 7 | +// |
| 8 | +// servoarray is distributed in the hope that it will be useful, |
| 9 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | +// GNU General Public License for more details. |
| 12 | +// |
| 13 | +// You should have received a copy of the GNU General Public License |
| 14 | +// along with servoarray. If not, see <http://www.gnu.org/licenses/>. |
| 15 | + |
| 16 | +#include "servoarray/servoarray.h" |
| 17 | + |
| 18 | +#include <args.hxx> |
| 19 | + |
| 20 | +#include <iostream> |
| 21 | +#include <cstdint> |
| 22 | + |
| 23 | +int main(int argc, char **argv) { |
| 24 | + args::ArgumentParser argparser("Reset all joints"); |
| 25 | + args::HelpFlag help(argparser, "help", "Print this help", {'h', "help"}); |
| 26 | + args::Positional<std::string> arg_driver(argparser, "driver", "Driver name"); |
| 27 | + |
| 28 | + try { |
| 29 | + argparser.ParseCLI(argc, argv); |
| 30 | + } catch (const args::Help&){ |
| 31 | + std::cout << argparser; |
| 32 | + return 0; |
| 33 | + } catch (const args::ParseError& e){ |
| 34 | + std::cerr << e.what() << std::endl; |
| 35 | + std::cerr << argparser; |
| 36 | + return -1; |
| 37 | + } |
| 38 | + |
| 39 | + const std::string driver {arg_driver ? args::get(arg_driver) : ""}; |
| 40 | + |
| 41 | + auto sa = ServoArray::ServoArray(driver); |
| 42 | + |
| 43 | + for (std::size_t i = 0; i < sa.size(); i++) { |
| 44 | + sa[i] = 0; |
| 45 | + } |
| 46 | +} |
0 commit comments