VisualContactDetectionObserver.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-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
19 * @author
20 * @date
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
25
28
29namespace visionx
30{
31 void
40
41 void
43 {
44 offerChannel("collisionDetector",
45 "Indicates whether the robot hand is colliding with an object.");
46 armarx::Variant defaultValue(0);
48 "collisionDetector",
49 "collisionDetected",
50 defaultValue,
51 "Is 1 when a collision between hand and object was detected, 0 if not.");
52 }
53
54 void
56 const Ice::Current&)
57 {
58 if (collisionDetected)
59 {
60 setDataField("collisionDetector", "collisionDetected", 1);
61 ARMARX_IMPORTANT << "Collision detected!";
62 }
63 else
64 {
65 setDataField("collisionDetector", "collisionDetected", 0);
66 }
67
68 updateChannel("collisionDetector");
69 }
70} // namespace visionx
Checks if the numbers published in the relevant data fields equal a reference value.
Checks if the relevant data fields have been updated since the installation of this condition.
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
void offerChannel(std::string channelName, std::string description)
Offer a channel.
Definition Observer.cpp:131
void offerConditionCheck(std::string checkName, ConditionCheck *conditionCheck)
Offer a condition check.
Definition Observer.cpp:301
void updateChannel(const std::string &channelName, const std::set< std::string > &updatedDatafields=std::set< std::string >())
Update all conditions for a channel.
Definition Observer.cpp:788
void offerDataFieldWithDefault(std::string channelName, std::string datafieldName, const Variant &defaultValue, std::string description)
Offer a datafield with default value.
Definition Observer.cpp:160
void setDataField(const std::string &channelName, const std::string &datafieldName, const Variant &value, bool triggerFilterUpdate=true)
set datafield with datafieldName and in channel channelName
Definition Observer.cpp:508
The Variant class is described here: Variants.
Definition Variant.h:224
void reportContactDetected(bool collisionDetected, const Ice::Current &) override
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
Definition Logging.h:190
ArmarX headers.