GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/signal/signal-cast.cpp Lines: 0 1 0.0 %
Date: 2021-08-13 12:32:43 Branches: 0 4 0.0 %

Line Branch Exec Source
1
/*
2
 * Copyright 2010,
3
 * François Bleibel,
4
 * Olivier Stasse,
5
 *
6
 * CNRS/AIST
7
 *
8
 */
9
10
#include <Eigen/Core>
11
#include <dynamic-graph/eigen-io.h>
12
#include <dynamic-graph/signal-caster.h>
13
#include <iomanip>
14
#include <sot/core/matrix-geometry.hh>
15
#include <sot/core/pool.hh>
16
17
#include <dynamic-graph/signal-cast-helper.h>
18
#include <dynamic-graph/signal-caster.h>
19
#include <sot/core/feature-abstract.hh>
20
#include <sot/core/flags.hh>
21
#include <sot/core/multi-bound.hh>
22
#include <sot/core/trajectory.hh>
23
24
#ifdef WIN32
25
#include <Windows.h>
26
#endif
27
28
/* Implements a set of caster/displayer for the main types of sot-core. */
29
30
namespace dynamicgraph {
31
using namespace std;
32
using namespace dynamicgraph::sot;
33
namespace dgsot = dynamicgraph::sot;
34
35
/* --- CASTER IMPLEMENTATION ------------------------------------------------ */
36
/* --- CASTER IMPLEMENTATION ------------------------------------------------ */
37
/* --- CASTER IMPLEMENTATION ------------------------------------------------ */
38
39
// DG_SIGNAL_CAST_DEFINITION(sot::Flags);
40
// DG_ADD_CASTER(sot::Flags, flags);
41
42
/* --- TIMEVAL -------------------------------------------------------------- */
43
/* --- TIMEVAL -------------------------------------------------------------- */
44
/* --- TIMEVAL -------------------------------------------------------------- */
45
/*
46
DG_SIGNAL_CAST_DEFINITION_HPP(struct timeval);
47
48
struct timeval SignalCast<struct timeval>::cast(std::istringstream &iss) {
49
  int u, s;
50
  iss >> s >> u;
51
  struct timeval t;
52
  t.tv_sec = s;
53
  t.tv_usec = u;
54
  return t;
55
} void SignalCast<struct timeval>::disp(const struct timeval &t,
56
                                        std::ostream &os) {
57
  os << t.tv_sec << "s " << t.tv_usec << "ms";
58
}
59
60
DG_ADD_CASTER(struct timeval, tv);
61
*/
62
63
/* --- Trajectory --------------------------------------------------------------
64
 */
65
/* --- Trajectory --------------------------------------------------------------
66
 */
67
/* --- Trajectory --------------------------------------------------------------
68
 */
69
/*
70
DG_SIGNAL_CAST_DEFINITION_HPP(dgsot::Trajectory);
71
72
dgsot::Trajectory SignalCast<dgsot::Trajectory>::cast(std::istringstream &iss) {
73
  dgsot::Trajectory aTraj;
74
75
  // Read joint names.
76
  std::vector<std::string>::size_type nb_joints;
77
  iss >> nb_joints;
78
  aTraj.joint_names_.resize(nb_joints);
79
  for (std::vector<std::string>::size_type idJoints = 0; idJoints < nb_joints;
80
       idJoints++)
81
    iss >> aTraj.joint_names_[idJoints];
82
83
  // Read nb of points
84
  std::vector<JointTrajectoryPoint>::size_type nb_points;
85
  iss >> nb_points;
86
87
  // Read points
88
  for (std::vector<JointTrajectoryPoint>::size_type idPoint = 0;
89
       idPoint < nb_points; idPoint++) {
90
    // Read positions.
91
    for (std::vector<double>::size_type idPos = 0; idPos < nb_joints; idPos++)
92
      iss >> aTraj.points_[idPoint].positions_[idPos];
93
    // TODO: read velocities and accelerations.
94
  }
95
  return aTraj;
96
}
97
void SignalCast<dgsot::Trajectory>::disp(const dgsot::Trajectory &aTraj,
98
                                         std::ostream &os) {
99
  // Display joint names.
100
  os << "{ Number of joints: " << aTraj.joint_names_.size() << std::endl;
101
  for (std::vector<std::string>::size_type idJoints = 0;
102
       idJoints < aTraj.joint_names_.size(); idJoints++) {
103
    os << idJoints << " - " << aTraj.joint_names_[idJoints] << std::endl;
104
  }
105
  // Display points
106
  os << "Number of points: " << aTraj.points_.size() << std::endl;
107
  for (std::vector<JointTrajectoryPoint>::size_type idPoint = 0;
108
       idPoint < aTraj.points_.size(); idPoint++) {
109
    if (aTraj.points_[idPoint].positions_.size() != 0) {
110
      os << " Point " << idPoint << " - Pos: [";
111
      // Read positions.
112
      for (std::vector<double>::size_type idPos = 0;
113
           idPos < aTraj.points_[idPoint].positions_.size(); idPos++) {
114
        os << "(" << idPos << " : " << aTraj.points_[idPoint].positions_[idPos]
115
           << ") ";
116
      }
117
      os << "] ";
118
    }
119
    if (aTraj.points_[idPoint].velocities_.size() != 0) {
120
      os << " Velocities " << idPoint << " - Pos: [";
121
      // Read positions.
122
      for (std::vector<double>::size_type idPos = 0;
123
           idPos < aTraj.points_[idPoint].velocities_.size(); idPos++) {
124
        os << "(" << idPos << " : " << aTraj.points_[idPoint].velocities_[idPos]
125
           << ") ";
126
      }
127
      os << "] ";
128
    }
129
    if (aTraj.points_[idPoint].accelerations_.size() != 0) {
130
      os << " Velocities " << idPoint << " - Pos: [";
131
      // Read positions.
132
      for (std::vector<double>::size_type idPos = 0;
133
           idPos < aTraj.points_[idPoint].accelerations_.size(); idPos++) {
134
        os << "(" << idPos << " : "
135
           << aTraj.points_[idPoint].accelerations_[idPos] << ") ";
136
      }
137
      os << "] ";
138
    }
139
140
    // TODO: read velocities and accelerations.
141
  }
142
  os << "}" << std::endl;
143
}
144
145
DG_ADD_CASTER(Trajectory, Traject);
146
*/
147
148
/* --- MULTI BOUND ---------------------------------------------------------- */
149
/* --- MULTI BOUND ---------------------------------------------------------- */
150
/* --- MULTI BOUND ---------------------------------------------------------- */
151
152
/*
153
DG_SIGNAL_CAST_DEFINITION_TRACE(sot::VectorMultiBound);
154
155
void SignalCast<VectorMultiBound>::trace(const VectorMultiBound &t,
156
                                         std::ostream &os) {
157
  for (VectorMultiBound::const_iterator iter = t.begin(); t.end() != iter;
158
       ++iter) {
159
    switch (iter->mode) {
160
    case MultiBound::MODE_SINGLE:
161
      os << iter->getSingleBound() << "\t";
162
      break;
163
    case MultiBound::MODE_DOUBLE:
164
      if (iter->getDoubleBoundSetup(MultiBound::BOUND_INF))
165
        os << iter->getDoubleBound(MultiBound::BOUND_INF) << "\t";
166
      else
167
        os << "-inf\t";
168
      if (iter->getDoubleBoundSetup(MultiBound::BOUND_SUP))
169
        os << iter->getDoubleBound(MultiBound::BOUND_SUP) << "\t";
170
      else
171
        os << "+inf\t";
172
      break;
173
    }
174
  }
175
}
176
DG_ADD_CASTER(sot::VectorMultiBound, sotVMB);
177
*/
178
179
} // namespace dynamicgraph