MetaWearIMUObserver.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package RobotAPI::units
19  * @author David Schiebener <schiebener at kit dot edu>
20  * @date 2014
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 #include <mutex>
28 
30 
31 #include <RobotAPI/interface/units/MetaWearIMU.h>
32 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
34 
35 namespace armarx
36 {
37  /**
38  * \class MetaWearIMUObserverPropertyDefinitions
39  * \brief
40  */
42  {
43  public:
46  {
47  defineOptionalProperty<std::string>(
48  "MetaWearTopicName", "MetaWearData", "Name of the MetaWear topic");
49  defineOptionalProperty<std::string>(
50  "DebugDrawerTopic", "DebugDrawerUpdates", "Name of the DebugDrawerTopic");
51  }
52  };
53 
54  class MetaWearIMUObserver : virtual public Observer, virtual public MetaWearIMUObserverInterface
55  {
56  public:
58  {
59  }
60 
61  std::string
62  getDefaultName() const override
63  {
64  return "MetaWearIMUObserver";
65  }
66 
67  void onInitObserver() override;
68  void onConnectObserver() override;
69  void onExitObserver() override;
70 
71  void reportIMUValues(const std::string& name,
72  const MetaWearIMUData& data,
73  const TimestampBasePtr& timestamp,
74  const Ice::Current&) override;
75 
76  /**
77  * @see PropertyUser::createPropertyDefinitions()
78  */
80 
81 
82  private:
83  std::mutex dataMutex;
84  DebugDrawerInterfacePrx debugDrawerPrx;
85 
86  void offerVector3(const std::string& channelName,
87  const std::string& dfName,
88  const std::vector<float>& data);
89  void offerQuaternion(const std::string& channelName,
90  const std::string& dfName,
91  const std::vector<float>& data);
92  };
93 } // namespace armarx
armarx::MetaWearIMUObserver::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: MetaWearIMUObserver.cpp:82
armarx::MetaWearIMUObserver::onConnectObserver
void onConnectObserver() override
Framework hook.
Definition: MetaWearIMUObserver.cpp:50
armarx::Observer
Baseclass for all ArmarX Observers.
Definition: Observer.h:84
Pose.h
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
Observer.h
armarx::MetaWearIMUObserverPropertyDefinitions::MetaWearIMUObserverPropertyDefinitions
MetaWearIMUObserverPropertyDefinitions(std::string prefix)
Definition: MetaWearIMUObserver.h:44
armarx::MetaWearIMUObserver::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: MetaWearIMUObserver.h:62
armarx::MetaWearIMUObserver::onExitObserver
void onExitObserver() override
Framework hook.
Definition: MetaWearIMUObserver.cpp:57
armarx::MetaWearIMUObserver::onInitObserver
void onInitObserver() override
Framework hook.
Definition: MetaWearIMUObserver.cpp:37
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::MetaWearIMUObserverPropertyDefinitions
Definition: MetaWearIMUObserver.h:41
armarx::MetaWearIMUObserver::reportIMUValues
void reportIMUValues(const std::string &name, const MetaWearIMUData &data, const TimestampBasePtr &timestamp, const Ice::Current &) override
Definition: MetaWearIMUObserver.cpp:62
IceUtil::Handle
Definition: forward_declarations.h:30
armarx::MetaWearIMUObserver
Definition: MetaWearIMUObserver.h:54
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
armarx::MetaWearIMUObserver::MetaWearIMUObserver
MetaWearIMUObserver()
Definition: MetaWearIMUObserver.h:57
armarx::ObserverPropertyDefinitions
Definition: Observer.h:49
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27