Tetrapod Project
utils.cpp
Go to the documentation of this file.
2 
3 double wrap(double num, double range, double offset)
4 {
5  return offset + std::fmod(num - offset, range);
6 }
7 
8 drake::symbolic::Expression drake_or(drake::symbolic::Variable &b1, drake::symbolic::Variable &b2)
9 {
10  return b1 + b2 - b1*b2;
11 }
12 
13 drake::symbolic::Expression drake_and(drake::symbolic::Variable &b1, drake::symbolic::Variable &b2)
14 {
15  return b1*b2;
16 }
17 
18 drake::symbolic::Expression drake_nor(drake::symbolic::Variable &b1, drake::symbolic::Variable &b2)
19 {
20  return 1 + b1*b2 - b1 - b2;
21 }
22 
23 drake::symbolic::Expression drake_nand(drake::symbolic::Variable &b1, drake::symbolic::Variable &b2)
24 {
25  return 1 - b1*b2;
26 }
27 
28 Eigen::MatrixXd get_sin_coeffs()
29 {
30  Eigen::Matrix<double, 5, 2> res;
31  res << 0, 1,
32  1, 0,
33  M_PI, -1,
34  -1, 0,
35  -2*M_PI, 1;
36 
37  return res;
38 }
39 
40 Eigen::MatrixXd get_cos_coeffs()
41 {
42  Eigen::Matrix<double, 5, 2> res;
43 
44  res << 1, 0,
45  M_PI/2, -1,
46  -1, 0,
47  2 - 2*M_PI, 1,
48  1, 0;
49 
50  return res;
51 }
Eigen::MatrixXd get_cos_coeffs()
Definition: utils.cpp:40
double wrap(double num, double range, double offset)
Definition: utils.cpp:3
Eigen::MatrixXd get_sin_coeffs()
Definition: utils.cpp:28
drake::symbolic::Expression drake_and(drake::symbolic::Variable &b1, drake::symbolic::Variable &b2)
Definition: utils.cpp:13
drake::symbolic::Expression drake_nor(drake::symbolic::Variable &b1, drake::symbolic::Variable &b2)
Definition: utils.cpp:18
drake::symbolic::Expression drake_nand(drake::symbolic::Variable &b1, drake::symbolic::Variable &b2)
Definition: utils.cpp:23
drake::symbolic::Expression drake_or(drake::symbolic::Variable &b1, drake::symbolic::Variable &b2)
Definition: utils.cpp:8