Viam C++ SDK current
Loading...
Searching...
No Matches
world_state.hpp
1#pragma once
2
3#include <boost/optional/optional.hpp>
4
5#include <viam/sdk/common/pose.hpp>
6#include <viam/sdk/common/proto_convert.hpp>
7#include <viam/sdk/spatialmath/geometry.hpp>
8
9namespace viam {
10namespace common {
11namespace v1 {
12
13class GeometriesInFrame;
14class Transform;
15class WorldState;
16
17} // namespace v1
18} // namespace common
19} // namespace viam
20
21namespace viam {
22namespace sdk {
23
24// TODO(RSDK-4553) Add documentation for these types
26 public:
28 std::vector<GeometryConfig> geometries;
29 std::string reference_frame;
30 };
31
32 struct transform {
33 std::string reference_frame;
34 pose_in_frame pose_in_observer_frame;
35 boost::optional<GeometryConfig> physical_object;
36 };
37
38 WorldState() = default;
39
40 WorldState(std::vector<geometries_in_frame> obstacles, std::vector<transform> transforms);
41
42 const std::vector<geometries_in_frame>& obstacles() const;
43 const std::vector<transform>& transforms() const;
44
45 friend bool operator==(const WorldState& lhs, const WorldState& rhs);
46 friend bool operator==(const geometries_in_frame& lhs, const geometries_in_frame& rhs);
47 friend bool operator==(const transform& lhs, const transform& rhs);
48
49 private:
50 std::vector<geometries_in_frame> obstacles_;
51 std::vector<transform> transforms_;
52};
53
54namespace proto_convert_details {
55
56template <>
57struct to_proto_impl<WorldState::geometries_in_frame> {
58 void operator()(const WorldState::geometries_in_frame&, common::v1::GeometriesInFrame*) const;
59};
60
61template <>
62struct from_proto_impl<common::v1::GeometriesInFrame> {
63 WorldState::geometries_in_frame operator()(const common::v1::GeometriesInFrame*) const;
64};
65
66template <>
67struct to_proto_impl<WorldState::transform> {
68 void operator()(const WorldState::transform&, common::v1::Transform*) const;
69};
70
71template <>
72struct from_proto_impl<common::v1::Transform> {
73 WorldState::transform operator()(const common::v1::Transform*) const;
74};
75
76template <>
78 void operator()(const WorldState&, common::v1::WorldState*) const;
79};
80
81template <>
82struct from_proto_impl<common::v1::WorldState> {
83 WorldState operator()(const common::v1::WorldState*) const;
84};
85
86} // namespace proto_convert_details
87} // namespace sdk
88} // namespace viam
Definition world_state.hpp:25
Definition world_state.hpp:27
Definition world_state.hpp:32
Definition pose.hpp:39