RobotStatePredictionClient.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI::ArmarXObjects::RobotStatePredictionClientExample
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2022
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 
24 #pragma once
25 
26 #include <optional>
27 #include <vector>
28 
29 #include <Eigen/Geometry>
30 
34 
35 
37 {
38 
40  {
41  public:
43 
44 
46  {
47  std::optional<Eigen::Affine3f> globalPose;
48  std::optional<std::map<std::string, float>> jointPositions;
49  };
51  predictWholeBody(const std::vector<armem::MemoryID>& localizationEntityIDs,
52  const std::vector<armem::MemoryID>& proprioceptionEntityIDs,
53  armem::Time predictedTime,
54  const std::string& robotName,
55  const std::string& engineID = "Linear");
56 
57  std::optional<Eigen::Affine3f>
58  predictGlobalPose(const std::vector<armem::MemoryID>& entityIDs,
59  armem::Time predictedTime,
60  const std::string& engineID = "Linear");
61 
62  std::optional<std::map<std::string, float>>
63  predictJointPositions(const std::vector<armem::MemoryID>& entityIDs,
64  armem::Time predictedTime,
65  const std::string& robotName,
66  const std::string& engineID = "Linear");
67 
68 
69  std::vector<armem::PredictionResult> predict(const std::vector<armem::MemoryID>& entityIDs,
70  armem::Time predictedTime,
71  const std::string& engineID = "Linear");
72  std::vector<armem::PredictionResult>
73  predict(const std::vector<armem::PredictionRequest>& requests);
74 
75 
76  std::vector<armem::MemoryID> queryLocalizationEntityIDs();
77  std::vector<armem::MemoryID> queryProprioceptionEntityIDs();
78 
79  std::vector<armem::PredictionRequest>
80  makePredictionRequests(const std::vector<armem::MemoryID>& entityIDs,
81  armem::Time predictedTime,
82  const std::string& engineID = "Linear");
83 
84  std::optional<Eigen::Affine3f>
85  lookupGlobalPose(const std::vector<armem::PredictionResult>& localizationPredictionResults,
86  const std::vector<armem::MemoryID>& localizationEntityIDs,
87  armem::Time predictedTime);
88 
89  std::optional<std::map<std::string, float>> lookupJointPositions(
90  const std::vector<armem::PredictionResult>& proprioceptionPredictionResults,
91  const std::string& robotName);
92 
93 
94  private:
95  std::vector<armem::MemoryID> _queryEntityIDs(const std::string& coreSegmentName);
96 
97  public:
98  struct Remote
99  {
101  std::optional<armem::robot_state::VirtualRobotReader> robotReader;
102  };
104  };
105 
106 } // namespace armarx::armem::robot_state
armarx::armem::client::Reader
Reads data from a memory server.
Definition: Reader.h:24
armarx::armem::robot_state::RobotStatePredictionClient::Remote
Definition: RobotStatePredictionClient.h:98
armarx::armem::robot_state::RobotStatePredictionClient::lookupJointPositions
std::optional< std::map< std::string, float > > lookupJointPositions(const std::vector< armem::PredictionResult > &proprioceptionPredictionResults, const std::string &robotName)
Definition: RobotStatePredictionClient.cpp:203
armarx::armem::robot_state::RobotStatePredictionClient::remote
Remote remote
Definition: RobotStatePredictionClient.h:103
Reader.h
armarx::armem::robot_state::RobotStatePredictionClient::Remote::reader
armem::client::Reader reader
Definition: RobotStatePredictionClient.h:100
armarx::armem::robot_state::RobotStatePredictionClient::WholeBodyPrediction
Definition: RobotStatePredictionClient.h:45
forward_declarations.h
armarx::armem::robot_state::RobotStatePredictionClient::RobotStatePredictionClient
RobotStatePredictionClient()
Definition: RobotStatePredictionClient.cpp:45
armarx::armem::robot_state
Definition: RobotStatePredictionClient.cpp:42
armarx::armem::robot_state::RobotStatePredictionClient::queryProprioceptionEntityIDs
std::vector< armem::MemoryID > queryProprioceptionEntityIDs()
Definition: RobotStatePredictionClient.cpp:58
armarx::armem::robot_state::RobotStatePredictionClient::WholeBodyPrediction::globalPose
std::optional< Eigen::Affine3f > globalPose
Definition: RobotStatePredictionClient.h:47
armarx::armem::robot_state::RobotStatePredictionClient::Remote::robotReader
std::optional< armem::robot_state::VirtualRobotReader > robotReader
Definition: RobotStatePredictionClient.h:101
armarx::armem::robot_state::RobotStatePredictionClient::predict
std::vector< armem::PredictionResult > predict(const std::vector< armem::MemoryID > &entityIDs, armem::Time predictedTime, const std::string &engineID="Linear")
Definition: RobotStatePredictionClient.cpp:109
armarx::armem::robot_state::RobotStatePredictionClient
Definition: RobotStatePredictionClient.h:39
VirtualRobotReader.h
armarx::armem::robot_state::RobotStatePredictionClient::predictJointPositions
std::optional< std::map< std::string, float > > predictJointPositions(const std::vector< armem::MemoryID > &entityIDs, armem::Time predictedTime, const std::string &robotName, const std::string &engineID="Linear")
Definition: RobotStatePredictionClient.cpp:236
armarx::armem::robot_state::RobotStatePredictionClient::queryLocalizationEntityIDs
std::vector< armem::MemoryID > queryLocalizationEntityIDs()
Definition: RobotStatePredictionClient.cpp:51
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::robot_state::RobotStatePredictionClient::predictGlobalPose
std::optional< Eigen::Affine3f > predictGlobalPose(const std::vector< armem::MemoryID > &entityIDs, armem::Time predictedTime, const std::string &engineID="Linear")
Definition: RobotStatePredictionClient.cpp:225
armarx::armem::robot_state::RobotStatePredictionClient::predictWholeBody
WholeBodyPrediction predictWholeBody(const std::vector< armem::MemoryID > &localizationEntityIDs, const std::vector< armem::MemoryID > &proprioceptionEntityIDs, armem::Time predictedTime, const std::string &robotName, const std::string &engineID="Linear")
Definition: RobotStatePredictionClient.cpp:247
armarx::armem::robot_state::RobotStatePredictionClient::makePredictionRequests
std::vector< armem::PredictionRequest > makePredictionRequests(const std::vector< armem::MemoryID > &entityIDs, armem::Time predictedTime, const std::string &engineID="Linear")
Definition: RobotStatePredictionClient.cpp:90
armarx::armem::robot_state::RobotStatePredictionClient::lookupGlobalPose
std::optional< Eigen::Affine3f > lookupGlobalPose(const std::vector< armem::PredictionResult > &localizationPredictionResults, const std::vector< armem::MemoryID > &localizationEntityIDs, armem::Time predictedTime)
Definition: RobotStatePredictionClient.cpp:129
armarx::armem::robot_state::RobotStatePredictionClient::WholeBodyPrediction::jointPositions
std::optional< std::map< std::string, float > > jointPositions
Definition: RobotStatePredictionClient.h:48