d4c
d4c.h
1 /*
2  * Copyright (C) 2013 iCub Facility - Istituto Italiano di Tecnologia
3  * Authors: Ilaria Gori, Ugo Pattacini
4  * email: ilaria.gori@iit.it, ugo.pattacini@iit.it
5  * Permission is granted to copy, distribute, and/or modify this program
6  * under the terms of the GNU General Public License, version 2 or any
7  * later version published by the Free Software Foundation.
8  *
9  * A copy of the license can be found at
10  * http://www.robotcub.org/icub/license/gpl.txt
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15  * Public License for more details
16 */
17 
32 #ifndef __D4C_H__
33 #define __D4C_H__
34 
35 #include <deque>
36 
37 #include <yarp/os/all.h>
38 #include <yarp/sig/all.h>
39 
40 #define D4C_DEFAULT_MAXITERATIONS 1000
41 #define D4C_DEFAULT_TS_DISABLED 0.0
42 
43 namespace iCub
44 {
45 
46 namespace d4c
47 {
48 
54 class D4C
55 {
56 public:
102  virtual bool open(const yarp::os::Property &options) = 0;
103 
107  virtual void close() = 0;
108 
173  virtual bool addItem(const yarp::os::Property &options, int &item) = 0;
174 
180  virtual bool eraseItem(const int item) = 0;
181 
186  virtual bool clearItems() = 0;
187 
193  virtual bool getItems(yarp::os::Bottle &items) = 0;
194 
202  virtual bool setProperty(const int item, const yarp::os::Property &options) = 0;
203 
211  virtual bool getProperty(const int item, yarp::os::Property &options) = 0;
212 
217  virtual bool enableField() = 0;
218 
223  virtual bool disableField() = 0;
224 
230  virtual bool getFieldStatus(bool &status) = 0;
231 
238  virtual bool enableControl() = 0;
239 
244  virtual bool disableControl() = 0;
245 
252  virtual bool getControlStatus(bool &status) = 0;
253 
260  virtual bool enableSimulation() = 0;
261 
266  virtual bool disableSimulation() = 0;
267 
273  virtual bool getSimulationStatus(bool &status) = 0;
274 
280  virtual bool setPeriod(const int period) = 0;
281 
287  virtual bool getPeriod(int &period) = 0;
288 
295  virtual bool setPointStateToTool() = 0;
296 
305  virtual bool attachToolFrame(const yarp::sig::Vector &x, const yarp::sig::Vector &o) = 0;
306 
316  virtual bool getToolFrame(yarp::sig::Vector &x, yarp::sig::Vector &o) = 0;
317 
324  virtual bool removeToolFrame() = 0;
325 
338  virtual bool getTool(yarp::sig::Vector &x, yarp::sig::Vector &o) = 0;
339 
352  virtual bool setPointState(const yarp::sig::Vector &x, const yarp::sig::Vector &o,
353  const yarp::sig::Vector &xdot, const yarp::sig::Vector &odot) = 0;
354 
364  virtual bool setPointOrientation(const yarp::sig::Vector &o, const yarp::sig::Vector &odot) = 0;
365 
378  virtual bool getPointState(yarp::sig::Vector &x, yarp::sig::Vector &o,
379  yarp::sig::Vector &xdot, yarp::sig::Vector &odot) = 0;
380 
386  virtual bool getField(yarp::sig::Vector &field) = 0;
387 
399  virtual bool getSimulation(yarp::sig::Vector &xhat, yarp::sig::Vector &ohat,
400  yarp::sig::Vector &qhat) = 0;
401 
409  virtual bool getActiveIF(std::string &activeIF) = 0;
410 
417  virtual bool setActiveIF(const std::string &activeIF) = 0;
418 
432  virtual bool getTrajectory(std::deque<yarp::sig::Vector> &trajPos,
433  std::deque<yarp::sig::Vector> &trajOrien,
434  const unsigned int maxIterations=D4C_DEFAULT_MAXITERATIONS,
435  const double Ts=D4C_DEFAULT_TS_DISABLED) = 0;
436 
446  virtual bool executeTrajectory(const std::deque<yarp::sig::Vector> &trajPos,
447  const std::deque<yarp::sig::Vector> &trajOrien,
448  const double trajTime) = 0;
449 
453  virtual ~D4C() { }
454 };
455 
456 }
457 
458 }
459 
460 #endif
461 
462 
virtual bool enableSimulation()=0
Enable the simulation of the robot part.
virtual bool getField(yarp::sig::Vector &field)=0
Retrieve the current field as generated by the d4c framework.
virtual bool disableField()=0
Disable the generation of the d4c field.
virtual bool getControlStatus(bool &status)=0
Retrieve the current status of the robot part control.
virtual bool disableControl()=0
Disable the control of the robot part.
virtual bool addItem(const yarp::os::Property &options, int &item)=0
Request for the creation of a new d4c entity which can be either a target or an obstacle.
virtual bool open(const yarp::os::Property &options)=0
Configure the client or the server part of d4c framework.
virtual ~D4C()
Destructor.
Definition: d4c.h:453
virtual bool clearItems()=0
Purge all the items contained in the table.
virtual bool executeTrajectory(const std::deque< yarp::sig::Vector > &trajPos, const std::deque< yarp::sig::Vector > &trajOrien, const double trajTime)=0
Execute the simulated trajectory provided by the user.
virtual bool removeToolFrame()=0
Remove the tool currently attached to the end-effector.
virtual bool getActiveIF(std::string &activeIF)=0
Retrieve the interface currently active that controls the limb.
virtual bool getItems(yarp::os::Bottle &items)=0
Retrieve the list of all available items.
virtual bool getPeriod(int &period)=0
Retrieve the current thread period for d4c field generation.
virtual bool attachToolFrame(const yarp::sig::Vector &x, const yarp::sig::Vector &o)=0
Attach a tool frame to the end-effector.
virtual bool getSimulationStatus(bool &status)=0
Retrieve the current status of the robot part simulation.
virtual bool getPointState(yarp::sig::Vector &x, yarp::sig::Vector &o, yarp::sig::Vector &xdot, yarp::sig::Vector &odot)=0
Retrieve the current trajectory state generated by the d4c framework.
virtual bool getProperty(const int item, yarp::os::Property &options)=0
Retrieve the properties of an existing item.
virtual bool getFieldStatus(bool &status)=0
Retrieve the current status of the d4c field.
virtual void close()=0
Stop the client/server and dispose it.
virtual bool setActiveIF(const std::string &activeIF)=0
Set the active interface for limb control.
virtual bool getToolFrame(yarp::sig::Vector &x, yarp::sig::Vector &o)=0
Retrieve the frame of the tool currently attached to the end-effector.
virtual bool setPointState(const yarp::sig::Vector &x, const yarp::sig::Vector &o, const yarp::sig::Vector &xdot, const yarp::sig::Vector &odot)=0
Allow chainging the trajectory state generated by the d4c framework.
virtual bool enableField()=0
Enable the generation of the d4c field.
virtual bool setPointOrientation(const yarp::sig::Vector &o, const yarp::sig::Vector &odot)=0
Allow changing the orientation state of the trajectory generated by the d4c framework.
virtual bool setPeriod(const int period)=0
Allow changing the thread period for d4c field generation.
virtual bool setProperty(const int item, const yarp::os::Property &options)=0
Allow changing the properties of an existing item.
Definition: d4c.h:43
virtual bool enableControl()=0
Enable the control of the robot part.
virtual bool disableSimulation()=0
Disable the simulation of the robot part.
virtual bool getTool(yarp::sig::Vector &x, yarp::sig::Vector &o)=0
Retrieve the coordinates of the tool currently attached to the end-effector.
virtual bool setPointStateToTool()=0
Allow setting the trajectory state equal to the currently attached tool state (or end-effector state ...
The Definition of the D4C Interface.
Definition: d4c.h:54
virtual bool getTrajectory(std::deque< yarp::sig::Vector > &trajPos, std::deque< yarp::sig::Vector > &trajOrien, const unsigned int maxIterations=D4C_DEFAULT_MAXITERATIONS, const double Ts=D4C_DEFAULT_TS_DISABLED)=0
Retrieve the complete simulated trajectory as evolved from the current state point.
virtual bool eraseItem(const int item)=0
Remove one item from the items table.
virtual bool getSimulation(yarp::sig::Vector &xhat, yarp::sig::Vector &ohat, yarp::sig::Vector &qhat)=0
Sample step by step the trajectory the end-effector will follow as constrained by the d4c field...