Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
dji_motor_terminal_serial_handler.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_DJI_MOTOR_TERMINAL_SERIAL_HANDLER_HPP_
25#define TAPROOT_DJI_MOTOR_TERMINAL_SERIAL_HANDLER_HPP_
26
28#include "tap/util_macros.hpp"
29
30#include "dji_motor_ids.hpp"
31
32namespace tap
33{
34class Drivers;
35namespace motor
36{
37class DjiMotor;
38class DjiMotorTxHandler;
40{
41public:
42 static constexpr char HEADER[] = "motorinfo";
43
45
46 mockable void init();
47
49 char* inputLine,
50 modm::IOStream& outputStream,
51 bool streamingEnabled) override;
52
53 void terminalSerialStreamCallback(modm::IOStream& outputStream) override;
54
55private:
56 typedef DjiMotor const* (DjiMotorTxHandler::*getMotorByIdFunc)(MotorId);
57
58 static constexpr char USAGE[] =
59 "Usage: motorinfo <[-H] | [all] | [motor [mid]] [can [cid]]>\n"
60 " Where:\n"
61 " - [-H] prints usage\n"
62 " - [all] prints all motor info\n"
63 " Or specifiy a motor id and/or can id, where\n"
64 " - [mid] is the id of a motor, in [1, 8]\n"
65 " - [cid] is some the can id, in [1, 2]\n";
66
67 Drivers* drivers;
68
69 bool motorIdValid = false;
70 uint32_t motorId = 0;
71 bool canBusValid = false;
72 int canBus = 0;
73 bool printAll = false;
74
75 bool printInfo(modm::IOStream& outputStream);
76
77 void getMotorInfoToString(const DjiMotor* motor, modm::IOStream& outputStream);
78
79 void printAllMotorInfo(getMotorByIdFunc func, modm::IOStream& outputStream);
80}; // class DjiMotorTerminalSerialHandler
81} // namespace motor
82} // namespace tap
83
84#endif // TAPROOT_DJI_MOTOR_TERMINAL_SERIAL_HANDLER_HPP_
Definition drivers.hpp:70
Definition dji_motor_terminal_serial_handler.hpp:40
mockable void init()
Definition dji_motor_terminal_serial_handler.cpp:44
static constexpr char HEADER[]
Definition dji_motor_terminal_serial_handler.hpp:42
void terminalSerialStreamCallback(modm::IOStream &outputStream) override
Definition dji_motor_terminal_serial_handler.cpp:39
DjiMotorTerminalSerialHandler(Drivers *drivers)
Definition dji_motor_terminal_serial_handler.hpp:44
bool terminalSerialCallback(char *inputLine, modm::IOStream &outputStream, bool streamingEnabled) override
Definition dji_motor_terminal_serial_handler.cpp:46
Definition dji_motor_tx_handler.hpp:74
Definition dji_motor.hpp:71
Definition brushlessutils.cpp:4
MotorId
Definition dji_motor_ids.hpp:38
Definition ballistics.cpp:29
tap::Drivers Drivers
Definition drivers.hpp:11
fang::Drivers & drivers
Definition robot_singleton.cpp:45
#define mockable
Wrap class functions that are not already virtual in this function if you wish to mock them.
Definition util_macros.hpp:38