icub-client
subSystem_ARE.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2014 WYSIWYD Consortium, European Commission FP7 Project ICT-612139
3 * Authors: Stéphane Lallée
4 * email: stephane.lallee@gmail.com
5 * website: https://github.com/robotology/icub-client/
6 * Permission is granted to copy, distribute, and/or modify this program
7 * under the terms of the GNU General Public License, version 2 or any
8 * later version published by the Free Software Foundation.
9 *
10 * A copy of the license can be found at
11 * icub-client/license/gpl.txt
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 * Public License for more details
17 */
18 
19 #ifndef __ICUBCLIENT_SUBSYSTEM_ARE_H__
20 #define __ICUBCLIENT_SUBSYSTEM_ARE_H__
21 
22 #include <string>
23 #include <algorithm>
24 #include <yarp/os/all.h>
25 #include <yarp/sig/all.h>
26 
29 
30 #define SUBSYSTEM_ARE "ARE"
31 
32 namespace icubclient {
41  class SubSystem_ARE : public SubSystem
42  {
43  protected:
45 
46  yarp::os::RpcClient portCmd;
47  yarp::os::RpcClient portRPC;
48  yarp::os::RpcClient portGet;
49  yarp::os::RpcClient portCalib;
51  std::string lastlyUsedHand;
58  void appendCartesianTarget(yarp::os::Bottle& b, const yarp::sig::VectorOf<double> &t);
59 
65  bool sendCmd(const yarp::os::Bottle &cmd);
66 
67  bool connect();
68 
69  public:
74  SubSystem_ARE(const std::string &masterName);
75 
79  void Close();
80 
86  bool getTableHeight(double &height);
87 
88  /********************************************************************************/
89  void selectHandCorrectTarget(yarp::os::Bottle& options, yarp::sig::VectorOf<double>& target,
90  const std::string& objName, const std::string handToUse="");
91 
92 
98  yarp::sig::VectorOf<double> applySafetyMargins(const yarp::sig::VectorOf<double>& in);
99 
107  bool home(const std::string &part = "all");
108 
120  bool take(const std::string &sName, const yarp::os::Bottle &options = yarp::os::Bottle());
121 
133  bool push(const std::string &sName, const yarp::os::Bottle &options = yarp::os::Bottle());
134 
146  bool point(const yarp::sig::VectorOf<double> &targetUnsafe, const yarp::os::Bottle &options = yarp::os::Bottle());
147 
156  bool drop(const yarp::os::Bottle &options = yarp::os::Bottle());
157 
166  bool dropOn(const yarp::sig::VectorOf<double> &targetUnsafe, const yarp::os::Bottle &options = yarp::os::Bottle());
167 
176  bool observe(const yarp::os::Bottle &options = yarp::os::Bottle());
177 
186  bool expect(const yarp::os::Bottle &options = yarp::os::Bottle());
187 
197  bool give(const yarp::os::Bottle &options = yarp::os::Bottle());
198 
204  bool waving(const bool sw);
205 
214  bool look(const yarp::sig::VectorOf<double> &target, const yarp::os::Bottle &options = yarp::os::Bottle());
215 
223  bool track(const yarp::sig::VectorOf<double> &target, const yarp::os::Bottle &options = yarp::os::Bottle());
224 
230  bool impedance(const bool sw);
231 
238  bool setExecTime(const double execTime);
239 
243  ~SubSystem_ARE();
244  };
245 }
246 
247 #endif
bool sendCmd(const yarp::os::Bottle &cmd)
Sends a command to ARE&#39;s cmdPort.
yarp::os::RpcClient portRPC
Port to /ARE/rpc.
Definition: subSystem_ARE.h:47
std::string lastlyUsedHand
The hand which was used for the last action.
Definition: subSystem_ARE.h:51
SubSystem to deal with the actionsRenderingEngine module (a.k.a.
Definition: subSystem_ARE.h:41
yarp::os::RpcClient portCalib
Port to iolReachingCalibration.
Definition: subSystem_ARE.h:49
bool push(const std::string &sName, const yarp::os::Bottle &options=yarp::os::Bottle())
Reach the specified [target] from one side and then push it laterally.
bool look(const yarp::sig::VectorOf< double > &target, const yarp::os::Bottle &options=yarp::os::Bottle())
Look at the specified [target].
SubSystem_ARE(const std::string &masterName)
Default constructor.
bool expect(const yarp::os::Bottle &options=yarp::os::Bottle())
Put one hand forward with the palm facing up and wait for an object.
bool impedance(const bool sw)
Enable/disable impedance control.
bool point(const yarp::sig::VectorOf< double > &targetUnsafe, const yarp::os::Bottle &options=yarp::os::Bottle())
Point at the specified [target] with the index finger.
yarp::os::RpcClient portGet
Port to /ARE/get:io.
Definition: subSystem_ARE.h:48
bool home(const std::string &part="all")
Put the specified part ih home position.
bool getTableHeight(double &height)
Gets the table height from ARE.
yarp::os::RpcClient portCmd
Port to /ARE/cmd:io.
Definition: subSystem_ARE.h:46
Abstract class to handle sub-systems of the icub-client.
Definition: subSystem.h:43
void Close()
Clean up resources.
bool track(const yarp::sig::VectorOf< double > &target, const yarp::os::Bottle &options=yarp::os::Bottle())
Track the specified [target].
An OPC client using the datastructures defined within the icub-client library.
Definition: opcClient.h:35
bool observe(const yarp::os::Bottle &options=yarp::os::Bottle())
Bring the hand in the visual field and move it with the purpose of visual exploration.
bool take(const std::string &sName, const yarp::os::Bottle &options=yarp::os::Bottle())
Reach the specified [target] and grasp it.
yarp::sig::VectorOf< double > applySafetyMargins(const yarp::sig::VectorOf< double > &in)
Applies safety margins, i.e.
void appendCartesianTarget(yarp::os::Bottle &b, const yarp::sig::VectorOf< double > &t)
Appends a target vector t to the Bottle b
void selectHandCorrectTarget(yarp::os::Bottle &options, yarp::sig::VectorOf< double > &target, const std::string &objName, const std::string handToUse="")
bool dropOn(const yarp::sig::VectorOf< double > &targetUnsafe, const yarp::os::Bottle &options=yarp::os::Bottle())
Drop the object on a given target.
bool drop(const yarp::os::Bottle &options=yarp::os::Bottle())
If an object is held, bring it over the table and drop it on a random position.
bool give(const yarp::os::Bottle &options=yarp::os::Bottle())
Put one hand forward with the palm facing up and open the fingers so that the object held in the hand...
bool waving(const bool sw)
Enable/disable arms waving.
bool setExecTime(const double execTime)
Change default arm movement execution time.