1
+ /*
2
+ * Copyright 2019
3
+ *
4
+ * LAAS-CNRS
5
+ *
6
+ * François Bailly
7
+ * This file is part of sot-core.
8
+ * See license file.
9
+ */
10
+
11
+ /* -------------------------------------------------------------------------- */
12
+ /* --- INCLUDES ------------------------------------------------------------- */
13
+ /* -------------------------------------------------------------------------- */
14
+ #include < iostream>
15
+ #include < sot/core/robot-utils.hh>
16
+ #include < sot/core/debug.hh>
17
+ #include < dynamic-graph/factory.h>
18
+
19
+ using namespace std ;
20
+ using namespace dynamicgraph ;
21
+ using namespace dynamicgraph ::sot;
22
+
23
+ std::string localName (" robot_test" );
24
+ RobotUtil * robot_util;
25
+ int main ( void )
26
+ {
27
+ robot_util = createRobotUtil (localName);
28
+ /* Test set and get joint_limits_for_id */
29
+ const double upper_lim (1 );
30
+ const double lower_lim (2 );
31
+ robot_util->set_joint_limits_for_id (1 .,lower_lim,upper_lim);
32
+ if (robot_util->get_joint_limits_from_id (1 ).upper == upper_lim && robot_util->get_joint_limits_from_id (1 ).lower == lower_lim)
33
+ {
34
+ std::cout << " joint_limits_for_id works !" << std::endl; }
35
+ else
36
+ {
37
+ std::cout << " ERROR: joint_limits_for_id does not work !" << std::endl;
38
+ }
39
+
40
+ /* Test set and get name_to_id */
41
+ const std::string joint_name (" test_joint" );
42
+ const double joint_id (10 );
43
+ robot_util->set_name_to_id (joint_name,joint_id);
44
+ if (robot_util->get_id_from_name (joint_name) == joint_id && robot_util->get_name_from_id (joint_id) == joint_name)
45
+ {
46
+ std::cout << " name_to_id works !" << std::endl;
47
+ }
48
+ else
49
+ {
50
+ std::cout << " ERROR: name_to_id does not work !" << std::endl;
51
+ }
52
+
53
+ /* Test set urdf_to_sot */
54
+
55
+ dg::Vector urdf_to_sot (3 );
56
+ urdf_to_sot << 1 ,3 ,2 ;
57
+ robot_util->set_urdf_to_sot (urdf_to_sot);
58
+ if (urdf_to_sot == robot_util->m_dgv_urdf_to_sot )
59
+ {
60
+ std::cout << " urdf_to_sot works !" << std::endl;
61
+ }
62
+ else
63
+ {
64
+ std::cout << " ERROR: urdf_to_sot does not work !" << std::endl;
65
+ }
66
+ return 0 ;
67
+ }
0 commit comments