Thunderbots Project
Loading...
Searching...
No Matches
tbots_protobuf.h
1#pragma once
2
3#include "proto/message_translation/tbots_geometry.h"
4#include "proto/tbots_software_msgs.pb.h"
5#include "proto/vision.pb.h"
6#include "proto/visualization.pb.h"
7#include "proto/world.pb.h"
8#include "software/ai/navigator/trajectory/bang_bang_trajectory_1d_angular.h"
9#include "software/ai/navigator/trajectory/trajectory_path.h"
10#include "software/ai/passing/pass_with_rating.h"
11#include "software/world/world.h"
12
21std::unique_ptr<TbotsProto::World> createWorld(const World& world);
22
33std::unique_ptr<TbotsProto::World> createWorldWithSequenceNumber(
34 const World& world, const uint64_t sequence_number);
35
44std::unique_ptr<TbotsProto::Team> createTeam(const Team& team);
45
54std::unique_ptr<TbotsProto::Robot> createRobot(const Robot& robot);
55
64std::unique_ptr<TbotsProto::Ball> createBall(const Ball& ball);
65
74std::unique_ptr<TbotsProto::Field> createField(const Field& field);
75
83std::unique_ptr<TbotsProto::RobotState> createRobotStateProto(const Robot& robot);
84std::unique_ptr<TbotsProto::RobotState> createRobotStateProto(
85 const RobotState& robot_state);
86std::unique_ptr<TbotsProto::GameState> createGameState(const GameState& game_state);
87std::unique_ptr<TbotsProto::BallState> createBallState(const Ball& ball);
88
97std::unique_ptr<TbotsProto::Timestamp> createTimestamp(const Timestamp& timestamp);
98
108std::unique_ptr<TbotsProto::NamedValue> createNamedValue(const std::string name,
109 float value);
110
126std::unique_ptr<TbotsProto::PlotJugglerValue> createPlotJugglerValue(
127 const std::map<std::string, double>& values);
128
143template <class Shape>
144std::unique_ptr<TbotsProto::DebugShapes::DebugShape> createDebugShape(
145 const Shape& shape, const std::string& unique_id, const std::string& debug_text = "")
146{
147 auto debug_shape = std::make_unique<TbotsProto::DebugShapes::DebugShape>();
148 (*debug_shape->mutable_shape()) = *createShapeProto(shape);
149 debug_shape->set_unique_id(unique_id);
150 debug_shape->set_debug_text(debug_text);
151 return debug_shape;
152};
153
169std::unique_ptr<TbotsProto::DebugShapes> createDebugShapes(
170 const std::vector<TbotsProto::DebugShapes::DebugShape>& debug_shapes);
171
179std::unique_ptr<TbotsProto::Shape> createShapeProto(const Circle& circle);
180std::unique_ptr<TbotsProto::Shape> createShapeProto(const Polygon& polygon);
181std::unique_ptr<TbotsProto::Shape> createShapeProto(const Stadium& stadium);
182
188std::unique_ptr<TbotsProto::Timestamp> createCurrentTimestamp();
189
196RobotState createRobotState(const TbotsProto::RobotState robot_state);
197
204BallState createBallState(const TbotsProto::BallState ball_state);
205
213std::unique_ptr<TbotsProto::PassVisualization> createPassVisualization(
214 const std::vector<PassWithRating>& passes_with_rating);
215
223std::unique_ptr<TbotsProto::WorldStateReceivedTrigger> createWorldStateReceivedTrigger();
224
234std::unique_ptr<TbotsProto::CostVisualization> createCostVisualization(
235 const std::vector<double>& costs, int num_rows, int num_cols);
236
246std::optional<TrajectoryPath> createTrajectoryPathFromParams(
247 const TbotsProto::TrajectoryPathParams2D& params, const Vector& initial_velocity,
248 const RobotConstants& robot_constants);
249
258BangBangTrajectory1DAngular createAngularTrajectoryFromParams(
259 const TbotsProto::TrajectoryParamsAngular1D& params,
260 const AngularVelocity& initial_velocity, const RobotConstants& robot_constants);
261
270int convertDribblerModeToDribblerSpeed(TbotsProto::DribblerMode dribbler_mode,
271 RobotConstants_t robot_constants);
272
281double convertMaxAllowedSpeedModeToMaxAllowedSpeed(
282 TbotsProto::MaxAllowedSpeedMode max_allowed_speed_mode,
283 RobotConstants_t robot_constants);
Definition angle.h:15
Definition ball_state.h:11
Definition ball.h:11
Definition bang_bang_trajectory_1d_angular.h:10
Definition circle.h:10
Definition field.h:36
Holds the state of the game according to the referee.
Definition game_state.h:80
Definition polygon.h:12
Definition robot_state.h:19
Definition robot.h:16
Definition shape.h:9
Definition stadium.h:12
Definition team.h:15
Definition timestamp.h:21
Definition vector.h:12
Definition world.h:23
Definition robot_constants.h:7