Viam C++ SDK current
Loading...
Searching...
No Matches
pose_tracker.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <string>
7#include <unordered_map>
8#include <vector>
9
10#include <viam/api/common/v1/common.pb.h>
11#include <viam/api/component/posetracker/v1/pose_tracker.pb.h>
12
13#include <viam/sdk/common/pose.hpp>
14#include <viam/sdk/components/component.hpp>
15#include <viam/sdk/spatialmath/geometry.hpp>
16
17namespace viam {
18namespace sdk {
19
21
27class PoseTracker : public Component {
28 public:
29 using pose_map = std::unordered_map<std::string, pose_in_frame>;
30
31 API api() const override;
32
38 inline pose_map get_poses(const std::vector<std::string>& body_names) {
39 return get_poses(body_names, {});
40 }
41
48 virtual pose_map get_poses(const std::vector<std::string>& body_names,
49 const ProtoStruct& extra) = 0;
50
54 virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
55
57 inline std::vector<GeometryConfig> get_geometries() {
58 return get_geometries({});
59 }
60
63 virtual std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) = 0;
64
65 protected:
66 using Component::Component;
67};
68
69template <>
71 static API api();
72};
73
74} // namespace sdk
75} // namespace viam
Extends APIType to additionally define a resource's subtype (e.g., camera).
Definition resource_api.hpp:33
Definition component.hpp:14
A PoseTracker represents a physical pose or motion tracking device.
Definition pose_tracker.hpp:27
virtual pose_map get_poses(const std::vector< std::string > &body_names, const ProtoStruct &extra)=0
Get the poses of each body tracked by the pose tracker.
virtual ProtoStruct do_command(const ProtoStruct &command)=0
Send/receive arbitrary commands to the resource.
API api() const override
Returns the API associated with a particular resource.
virtual std::vector< GeometryConfig > get_geometries(const ProtoStruct &extra)=0
Returns GeometryConfigs associated with the calling pose tracker.
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling pose tracker.
Definition pose_tracker.hpp:57
pose_map get_poses(const std::vector< std::string > &body_names)
Get the poses of each body tracked by the pose tracker.
Definition pose_tracker.hpp:38
Definition resource_api.hpp:50