RobotControlUI.cpp
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 ArmarX::Applications
19  * @author Jan Issac (jan dot issac at gmx dot net)
20  * @date 2011
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #include "RobotControlUI.h"
26 
27 #include <iostream>
28 
31 
32 namespace armarx
33 {
34  void
36  {
37  usingProxy("RobotControl");
38  stateId = -1;
39  controlTask = new RunningTask<RobotControlUI>(this, &RobotControlUI::run, "RobotControlUI");
40  }
41 
42  void
44  {
45  robotProxy = getProxy<RobotControlInterfacePrx>("RobotControl");
46  controlTask->start();
47  }
48 
49  void
51  {
52  controlTask->stop();
53  }
54 
55  void
57  {
58  std::string eventstring;
59  std::cout << "Please insert the event string: " << std::flush;
60  // cin >> eventstring;
61  eventstring = "EvLoadScenario";
62 
63  if (eventstring == "q")
64  {
65  // shutdown();
66  }
67  else
68  {
69  std::cout << "Please insert the state id of the state that should process the event: "
70  << std::flush;
71  int id;
72  // cin >> id;
73  id = 11;
74  std::cout << "sending to id:" << id << std::endl;
75  EventPtr evt = new Event("EVENTTOALL", eventstring);
76  StateUtilFunctions::addToDictionary(evt, "proxyName", "RemoteStateOfferer");
77  StateUtilFunctions::addToDictionary(evt, "stateName", "MoveArm");
78  //robotProxy->issueEvent(id, evt);
79  }
80 
81  // cin >> eventstring;
82  }
83 } // namespace armarx
armarx::RobotControlUI::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: RobotControlUI.cpp:50
armarx::RunningTask
Definition: ArmarXMultipleObjectsScheduler.h:36
IceInternal::Handle< Event >
armarx::RobotControlUI::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: RobotControlUI.cpp:35
ObserverObjectFactories.h
armarx::Event
An Event is used to communicate between e.g. condition handlers and statecharts.
Definition: Event.h:50
armarx::flush
const LogSender::manipulator flush
Definition: LogSender.h:251
armarx::RobotControlUI::run
void run()
Definition: RobotControlUI.cpp:56
armarx::StateUtilFunctions::addToDictionary
bool addToDictionary(EventPtr event, const std::string key, const Variant &value)
Adds the (key,defaulfValue) pair to the event-dictionary.
Definition: StateUtilFunctions.cpp:85
armarx::RobotControlUI::stateId
int stateId
Definition: RobotControlUI.h:41
armarx::RobotControlUI::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: RobotControlUI.cpp:43
armarx::RobotControlUI::robotProxy
RobotControlInterfacePrx robotProxy
Definition: RobotControlUI.h:42
RobotControlUI.h
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:154
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
Application.h