Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bodydynamics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
plugins
bodydynamics
Commits
9df5874f
Commit
9df5874f
authored
1 year ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
work on tests
parent
a3156a92
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!25
Draft: Resolve "Adapt to new sensor constructors in core"
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
test/CMakeLists.txt
+14
-2
14 additions, 2 deletions
test/CMakeLists.txt
test/gtest_schema.cpp
+126
-0
126 additions, 0 deletions
test/gtest_schema.cpp
test/yaml/processor_imu.yaml
+0
-0
0 additions, 0 deletions
test/yaml/processor_imu.yaml
test/yaml/sensor_imu.yaml
+0
-0
0 additions, 0 deletions
test/yaml/sensor_imu.yaml
with
140 additions
and
2 deletions
test/CMakeLists.txt
+
14
−
2
View file @
9df5874f
...
...
@@ -8,16 +8,22 @@ add_subdirectory(gtest)
# #
###########################################################
# capture_inertial_kinematics test
wolf_add_gtest
(
gtest_capture_inertial_kinematics gtest_capture_inertial_kinematics.cpp
)
# capture_leg_odom test
wolf_add_gtest
(
gtest_capture_leg_odom gtest_capture_leg_odom.cpp
)
wolf_add_gtest
(
gtest_feature_inertial_kinematics gtest_feature_inertial_kinematics.cpp
)
# factor_inertial_kinematics test
wolf_add_gtest
(
gtest_factor_inertial_kinematics gtest_factor_inertial_kinematics.cpp
)
# factor_force_torque test
wolf_add_gtest
(
gtest_factor_force_torque gtest_factor_force_torque.cpp
)
# feature_inertial_kinematics test
wolf_add_gtest
(
gtest_feature_inertial_kinematics gtest_feature_inertial_kinematics.cpp
)
# force_torque_delta_tools test
wolf_add_gtest
(
gtest_force_torque_delta_tools gtest_force_torque_delta_tools.cpp
)
# TODO: revive those
...
...
@@ -25,9 +31,15 @@ wolf_add_gtest(gtest_force_torque_delta_tools gtest_force_torque_delta_tools.cpp
# wolf_add_gtest(gtest_processor_inertial_kinematics gtest_processor_inertial_kinematics.cpp)
# wolf_add_gtest(gtest_processor_force_torque_preint gtest_processor_force_torque_preint.cpp)
# processor_point_feet_nomove test
wolf_add_gtest
(
gtest_processor_point_feet_nomove gtest_processor_point_feet_nomove.cpp
)
# schema test
wolf_add_gtest
(
gtest_schema gtest_schema.cpp
)
# sensor_force_torque test
wolf_add_gtest
(
gtest_sensor_force_torque gtest_sensor_force_torque.cpp
)
# sensor_inertial_kinematics test
wolf_add_gtest
(
gtest_sensor_inertial_kinematics gtest_sensor_inertial_kinematics.cpp
)
This diff is collapsed.
Click to expand it.
test/gtest_schema.cpp
0 → 100644
+
126
−
0
View file @
9df5874f
// WOLF - Copyright (C) 2020,2021,2022,2023
// Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and
// Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of WOLF: http://www.iri.upc.edu/wolf
// WOLF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include
"bodydynamics/common/bodydynamics.h"
#include
"core/utils/utils_gtest.h"
#include
"core/map/map_base.h"
#include
"core/sensor/sensor_base.h"
#include
"core/solver/solver_manager.h"
#include
"core/processor/processor_base.h"
#include
"core/tree_manager/tree_manager_base.h"
#include
"yaml-schema-cpp/yaml_schema.hpp"
using
namespace
wolf
;
using
namespace
yaml_schema_cpp
;
using
namespace
Eigen
;
std
::
string
wolf_schema_dir
=
_WOLF_SCHEMA_DIR
;
std
::
string
plugin_dir
=
_WOLF_BODYDYNAMICS_CODE_DIR
;
// just force the plugin .so library to be loaded
WOLF_LOAD_CORE
;
WOLF_LOAD_BODYDYNAMICS
;
bool
existsSchema
(
std
::
string
name_schema
)
{
// Check extension
if
(
filesystem
::
extension
(
name_schema
).
empty
())
{
name_schema
+=
SCHEMA_EXTENSION
;
}
else
if
(
filesystem
::
extension
(
name_schema
)
!=
SCHEMA_EXTENSION
)
{
WOLF_ERROR
(
"Wrong schema file extension "
,
name_schema
,
", it should be '"
,
SCHEMA_EXTENSION
,
"'"
);
return
false
;
}
// Find schema file
try
{
filesystem
::
path
path_schema
=
findFileRecursive
(
name_schema
,
{
plugin_dir
+
"/schema"
,
wolf_schema_dir
});
}
catch
(
const
std
::
exception
&
e
)
{
WOLF_ERROR
(
name_schema
,
" was NOT found."
);
return
false
;
}
WOLF_INFO
(
name_schema
,
" found!"
);
return
true
;
}
TEST
(
Schema
,
check_schema_existence
)
{
// Check that there is an schema file for each of the registered creators of all Factories from yaml nodes/files
// (all except FactoryStateBlock)
// FactoryLandmark
auto
registered_landmarks
=
FactoryLandmark
::
getRegisteredKeys
();
for
(
auto
key
:
registered_landmarks
)
{
EXPECT_TRUE
(
existsSchema
(
key
));
}
// FactoryMapNode
auto
registered_maps
=
FactoryMapNode
::
getRegisteredKeys
();
for
(
auto
key
:
registered_maps
)
{
EXPECT_TRUE
(
existsSchema
(
key
));
}
// FactoryProcessorNode
auto
registered_processors
=
FactoryProcessorNode
::
getRegisteredKeys
();
for
(
auto
key
:
registered_processors
)
{
EXPECT_TRUE
(
existsSchema
(
key
));
}
// FactorySensorNode
auto
registered_sensors
=
FactorySensorNode
::
getRegisteredKeys
();
for
(
auto
key
:
registered_sensors
)
{
EXPECT_TRUE
(
existsSchema
(
key
));
}
// FactorySolverNode
auto
registered_solvers
=
FactorySolverNode
::
getRegisteredKeys
();
for
(
auto
key
:
registered_solvers
)
{
EXPECT_TRUE
(
existsSchema
(
key
));
}
// FactoryTreeManagerNode
auto
registered_tree_managers
=
FactoryTreeManagerNode
::
getRegisteredKeys
();
for
(
auto
key
:
registered_tree_managers
)
{
EXPECT_TRUE
(
existsSchema
(
key
));
}
}
TEST
(
Schema
,
validate_all_schemas
)
{
ASSERT_TRUE
(
validateAllSchemas
({
plugin_dir
+
"/schema"
,
wolf_schema_dir
},
true
));
}
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
This diff is collapsed.
Click to expand it.
test/processor_imu.yaml
→
test/
yaml/
processor_imu.yaml
+
0
−
0
View file @
9df5874f
File moved
This diff is collapsed.
Click to expand it.
test/sensor_imu.yaml
→
test/
yaml/
sensor_imu.yaml
+
0
−
0
View file @
9df5874f
File moved
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment