openrave-yarp-plugins
YarpOpenraveMeshFromRealDepth.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __YARP_OPENRAVE_MESH_FROM_REAL_DEPTH_HPP__
4 #define __YARP_OPENRAVE_MESH_FROM_REAL_DEPTH_HPP__
5 
6 #include <yarp/os/PeriodicThread.h>
7 #include <yarp/os/Property.h>
8 
9 #include <yarp/dev/DeviceDriver.h>
10 #include <yarp/dev/IRGBDSensor.h>
11 #include <yarp/dev/PolyDriver.h>
12 
13 #include <yarp/sig/IntrinsicParams.h>
14 #include <yarp/sig/PointCloudUtils.h>
15 #include <yarp/sig/Vector.h>
16 
17 #include <openrave/openrave.h>
18 
19 #include "YarpOpenraveBase.hpp"
20 
21 #define DEFAULT_PERIOD 0.1 // [s]
22 #define DEFAULT_LOCAL_PREFIX "/YarpOpenraveDepthToMesh/client"
23 
24 namespace roboticslab
25 {
26 
39  public yarp::os::PeriodicThread,
40  public yarp::dev::DeviceDriver
41 {
42 public:
43  YarpOpenraveMeshFromRealDepth() : yarp::os::PeriodicThread(DEFAULT_PERIOD)
44  {}
45 
47  { close(); }
48 
49  // ------- DeviceDriver declarations. Implementation in DeviceDriverImpl.cpp -------
50  bool open(yarp::os::Searchable & config) override;
51  bool close() override;
52 
53 protected:
54  // ------- PeriodicThread declarations. Implementation in PeriodicThreadImpl.cpp -------
55  void run() override;
56 
57 private:
58  yarp::dev::PolyDriver sensorDevice;
59  yarp::dev::IRGBDSensor * iRGBDSensor {nullptr};
60  yarp::sig::IntrinsicParams depthIntrinsicParams;
61  yarp::sig::VectorOf<yarp::os::Property> meshOptions;
62 
63  OpenRAVE::KinBodyPtr previousMesh {nullptr};
64  OpenRAVE::RobotBase::AttachedSensorPtr depthSensor;
65 
66  yarp::sig::utils::PCL_ROI roi;
67  int stepX {1};
68  int stepY {1};
69 };
70 
71 } // namespace roboticslab
72 
73 #endif // __YARP_OPENRAVE_MESH_FROM_REAL_DEPTH_HPP__
Implements shared configuration functions.
Definition: YarpOpenraveBase.hpp:32
Converts depth frames into a 3D mesh.
Definition: YarpOpenraveMeshFromRealDepth.hpp:41
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:5