RobotUnitReader.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
* @author Fabian Reister ( fabian dot reister at kit dot edu )
17
* @date 2022
18
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19
* GNU General Public License
20
*/
21
22
#pragma once
23
24
25
#include "
ArmarXCore/core/services/tasks/TaskUtil.h
"
26
#include "
ArmarXCore/libraries/logging/FrequencyReporter.h
"
27
28
#include "
RobotAPI/libraries/RobotUnitDataStreamingReceiver/RobotUnitDataStreamingReceiver.h
"
29
#include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
30
31
#include "
armarx/localization_and_mapping/cartographer_adapter/MessageQueue.h
"
32
#include <
armarx/localization_and_mapping/cartographer_adapter/CartographerAdapter.h
>
33
34
namespace
armarx::plugins
35
{
36
class
RobotUnitComponentPlugin;
37
class
DebugObserverComponentPlugin;
38
}
// namespace armarx::plugins
39
40
namespace
armarx::components::cartographer_localization_and_mapping
41
{
42
43
/**
44
* @brief The RobotUnitReader class. The aim of this class is to receive data from the robot unit via streaming.
45
* Once data is received, it will be added to the odometry message queue.
46
*
47
*
48
*/
49
class
RobotUnitReader
50
{
51
public
:
52
RobotUnitReader
(
armarx::plugins::RobotUnitComponentPlugin
& robotUnitPlugin,
53
MessageQueue<
armarx::localization_and_mapping::cartographer_adapter
::
54
CartographerAdapter::OdomData>& odomMessageQueue,
55
FrequencyReporter
& odomDataReporter);
56
57
~RobotUnitReader
();
58
59
protected
:
60
/**
61
* @brief Sets up the robot unit streaming channel
62
*
63
*/
64
void
connect
();
65
66
/**
67
* @brief Reads the available data and fills the odomMessageQeueu
68
*
69
*/
70
void
readRobotUnitData
();
71
72
std::shared_ptr<
73
armarx::localization_and_mapping::cartographer_adapter::CartographerAdapter::OdomData
>
74
convert
(
const
RobotUnitDataStreaming::TimeStep&
data
);
75
76
77
private
:
78
armarx::plugins::RobotUnitComponentPlugin
& robotUnitPlugin;
79
80
/// reference to the message queue that will be filled when odometry data is available
81
MessageQueue<
82
armarx::localization_and_mapping::cartographer_adapter::CartographerAdapter::OdomData
>&
83
odomMessageQueue;
84
85
/// logging: will allow introspection of the reliability of the received data
86
FrequencyReporter
& odomDataReporter;
87
88
89
// do not change this or mysterious things will happen
90
const
std::string sensorDataPrefix =
"sens.Platform.relativePosition*"
;
91
92
93
RobotUnitDataStreamingReceiverPtr
receiver;
94
RobotUnitDataStreaming::DataStreamingDescription description;
95
96
97
SimplePeriodicTask<>::pointer_type
periodicTask;
98
99
100
const
float
updatePeriodMs = 10;
101
};
102
}
// namespace armarx::components::cartographer_localization_and_mapping
armarx::components::cartographer_localization_and_mapping::RobotUnitReader::convert
std::shared_ptr< armarx::localization_and_mapping::cartographer_adapter::CartographerAdapter::OdomData > convert(const RobotUnitDataStreaming::TimeStep &data)
armarx::RobotUnitDataStreamingReceiverPtr
std::shared_ptr< class RobotUnitDataStreamingReceiver > RobotUnitDataStreamingReceiverPtr
Definition:
RobotUnitReader.h:30
armarx::components::cartographer_localization_and_mapping::RobotUnitReader::RobotUnitReader
RobotUnitReader(armarx::plugins::RobotUnitComponentPlugin &robotUnitPlugin, MessageQueue< armarx::localization_and_mapping::cartographer_adapter::CartographerAdapter::OdomData > &odomMessageQueue, FrequencyReporter &odomDataReporter)
armarx::FrequencyReporter
The FrequencyReporter class.
Definition:
FrequencyReporter.h:22
armarx::localization_and_mapping::cartographer_adapter::CartographerAdapter::OdomData
Definition:
CartographerAdapter.h:99
RobotUnitDataStreamingReceiver.h
armarx::components::cartographer_localization_and_mapping::RobotUnitReader::connect
void connect()
Sets up the robot unit streaming channel.
CartographerAdapter.h
armarx::plugins
This file is part of ArmarX.
Definition:
DebugObserverComponentPlugin.cpp:27
armarx::components::cartographer_localization_and_mapping::RobotUnitReader
The RobotUnitReader class.
Definition:
RobotUnitReader.h:49
data
uint8_t data[1]
Definition:
EtherCATFrame.h:68
armarx::localization_and_mapping::cartographer_adapter
This file is part of ArmarX.
Definition:
ApproximateTimeQueue.cpp:15
TaskUtil.h
armarx::plugins::RobotUnitComponentPlugin
Definition:
RobotUnitComponentPlugin.h:11
FrequencyReporter.h
armarx::components::cartographer_localization_and_mapping::RobotUnitReader::readRobotUnitData
void readRobotUnitData()
Reads the available data and fills the odomMessageQeueu.
armarx::components::cartographer_localization_and_mapping
Definition:
RobotUnitReader.h:40
armarx::components::cartographer_localization_and_mapping::RobotUnitReader::~RobotUnitReader
~RobotUnitReader()
MessageQueue.h
armarx::SimplePeriodicTask
Usage:
Definition:
ApplicationNetworkStats.h:32
armarx
localization_and_mapping
components
cartographer_mapping_and_localization
RobotUnitReader.h
Generated by
1.8.17