forked from UBC-Thunderbots/Software
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackend.h
More file actions
45 lines (40 loc) · 1.62 KB
/
Copy pathbackend.h
File metadata and controls
45 lines (40 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include "proto/sensor_msg.pb.h"
#include "proto/tbots_software_msgs.pb.h"
#include "software/multithreading/first_in_first_out_threaded_observer.h"
#include "software/multithreading/subject.hpp"
#include "software/world/world.h"
/**
* A Backend is an abstraction around communication with robots, vision, and the
* gamecontroller (Referee). It produces SensorProtos, and consumes primitives that can be
* sent to the robots.
*
* This produce/consume pattern is performed by extending both "Observer" and
* "Subject". Please see the implementation of those classes for details.
*/
class Backend : public Subject<SensorProto>,
public Subject<TbotsProto::VirtualObstacles>,
public FirstInFirstOutThreadedObserver<World>,
public FirstInFirstOutThreadedObserver<TbotsProto::PrimitiveSet>
{
public:
Backend() = default;
virtual ~Backend() = default;
/**
* Callback function to send components of SensorProto via Subject<SensorProto>
* Immediately makes a SensorProto from msg and sends it to Observers
*
* @param msg The component of SensorProto
*/
void receiveRobotStatus(TbotsProto::RobotStatus msg);
void receiveSSLWrapperPacket(SSLProto::SSL_WrapperPacket msg);
void receiveSSLReferee(SSLProto::Referee msg);
void receiveSensorProto(SensorProto sensor_msg);
/**
* Callback function that receives a list of new virtual obstacles to send
* to Observers
*
* @param new_obstacles_list the received virtual obstacles list
*/
void receiveObstacleList(TbotsProto::VirtualObstacles new_obstacle_list);
};