Goliath II
Controller Receiver
 All Classes Namespaces Files Functions Enumerations
convert.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 #include <MessageCarrier.pb.h>
5 #include <boost/log/trivial.hpp>
6 #include <deque>
7 
8 #include "config.h"
9 #include "control.h"
10 #include "map.h"
11 
17 using namespace goliath::proto;
18 
23 enum TYPE {
24  CONTROL_TYPE = 0,
25  CONFIG_TYPE = 1,
26  LAST_STATUS_TYPE = 2,
27  COMMAND_TYPE = 3
28 };
29 
36 goliath::proto::MessageCarrier dualJoystickToMove(CONTROL control, int value);
37 
44 goliath::proto::MessageCarrier buttonToFrontWing(CONTROL control, int value);
45 
52 goliath::proto::MessageCarrier buttonToBackWing(CONTROL control, int value);
53 
60 goliath::proto::MessageCarrier buttonToAllWing(CONTROL control, int value);
61 
67 goliath::proto::MessageCarrier inputToCommand(goliath::proto::CommandMessage::CommandCase command, int value = 0);
68 
75 goliath::proto::MessageCarrier convertControl(CONTROL control, int value, std::map<CONTROL, std::function<goliath::proto::MessageCarrier(CONTROL,int)>> function);
76 
84 goliath::proto::MessageCarrier toMoveWingMessage(goliath::proto::commands::ServoCommand_Motor wing, goliath::proto::commands::ServoCommand_Direction direction, int speed);
85 
93 goliath::proto::MessageCarrier toMoveWingMessage(std::vector<commands::ServoCommand_Motor> wings, commands::ServoCommand_Direction direction, int speed);
94 
100 TYPE stringToType (std::string string);
101 
107 goliath::proto::CommandMessage::CommandCase stringToCommandCase (std::string string);
goliath::proto::MessageCarrier buttonToFrontWing(CONTROL control, int value)
Converts button presses to message with MoveWingCommand for front wings.
Definition: convert.cpp:58
goliath::proto::MessageCarrier buttonToAllWing(CONTROL control, int value)
Converts button presses to message with MoveWingCommand for front/back wings.
Definition: convert.cpp:122
TYPE stringToType(std::string string)
Converts type string from controller to TYPE enum.
Definition: convert.cpp:265
TYPE
enum for all input types
Definition: convert.h:23
goliath::proto::MessageCarrier buttonToBackWing(CONTROL control, int value)
Converts button presses to message with MoveWingCommand for back wings.
Definition: convert.cpp:90
CONTROL
enum for all axes and buttons
Definition: control.h:14
goliath::proto::MessageCarrier toMoveWingMessage(goliath::proto::commands::ServoCommand_Motor wing, goliath::proto::commands::ServoCommand_Direction direction, int speed)
Converts input to Message with MoveWingCommand.
goliath::proto::MessageCarrier dualJoystickToMove(CONTROL control, int value)
Converts joystick movement into Message with a MoveCommand.
Definition: convert.cpp:13
goliath::proto::CommandMessage::CommandCase stringToCommandCase(std::string string)
Converts command string from controller to CommandCase.
Definition: convert.cpp:269
goliath::proto::MessageCarrier convertControl(CONTROL control, int value, std::map< CONTROL, std::function< goliath::proto::MessageCarrier(CONTROL, int)>> function)
Calls function mapped to the input.