Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
command_mapping.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_COMMAND_MAPPING_HPP_
25#define TAPROOT_COMMAND_MAPPING_HPP_
26
27#include <vector>
28
29#include "remote_map_state.hpp"
30
31namespace tap
32{
33namespace control
34{
35class Command;
48{
49public:
59 CommandMapping(Drivers *drivers, const std::vector<Command *> cmds, const RemoteMapState &rms);
60
62
63
66 friend bool operator==(const CommandMapping &cm1, const CommandMapping &cm2);
67
71 friend bool mapStateEqual(const CommandMapping &cm1, const CommandMapping &cm2);
72
76 virtual ~CommandMapping() = default;
77
85 virtual void executeCommandMapping(const RemoteMapState &currState) = 0;
86
91 virtual bool mappingSubset(const RemoteMapState &mapState);
92
97 static inline bool negKeysSubset(const RemoteMapState &state1, const RemoteMapState &state2)
98 {
99 return state1.getNegKeys() == (state1.getNegKeys() & state2.getKeys());
100 }
101
103
104 const std::vector<Command *> &getAssociatedCommands() const { return mappedCommands; }
105
106protected:
111
115 std::vector<Command *> mappedCommands;
116
118
122 void addCommands();
123
127 void removeCommands();
128
132 bool noCommandsScheduled() const;
133}; // class CommandMapping
134} // namespace control
135} // namespace tap
136
137#endif // TAPROOT_COMMAND_MAPPING_HPP_
Definition drivers.hpp:70
Definition command_mapping.hpp:48
bool noCommandsScheduled() const
Definition command_mapping.cpp:76
virtual ~CommandMapping()=default
const std::vector< Command * > & getAssociatedCommands() const
Definition command_mapping.hpp:104
Drivers * drivers
Definition command_mapping.hpp:117
static bool negKeysSubset(const RemoteMapState &state1, const RemoteMapState &state2)
Definition command_mapping.hpp:97
virtual void executeCommandMapping(const RemoteMapState &currState)=0
std::vector< Command * > mappedCommands
Definition command_mapping.hpp:115
virtual bool mappingSubset(const RemoteMapState &mapState)
Definition command_mapping.cpp:57
friend bool mapStateEqual(const CommandMapping &cm1, const CommandMapping &cm2)
Definition command_mapping.cpp:52
friend bool operator==(const CommandMapping &cm1, const CommandMapping &cm2)
Definition command_mapping.cpp:47
const RemoteMapState mapState
Definition command_mapping.hpp:110
void addCommands()
Definition command_mapping.cpp:62
void removeCommands()
Definition command_mapping.cpp:69
const RemoteMapState & getAssociatedRemoteMapState() const
Definition command_mapping.hpp:102
Definition remote_map_state.hpp:56
uint16_t getNegKeys() const
Definition remote_map_state.hpp:233
uint16_t getKeys() const
Definition remote_map_state.hpp:243
Definition ballistics.cpp:29
#define DISALLOW_COPY_AND_ASSIGN(Typename)
Definition util_macros.hpp:27