-
Notifications
You must be signed in to change notification settings - Fork 6
Added extended testing, separated tests and benchmarks #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
…timized data structs
Hi ! This project doesn't usually accept pull requests on the main branch. |
.cache | ||
.DS_Store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be set in your local .gitignore on your computer.
option(BUILD_WITH_EXTENDED_TESTING "Build library with extended testing" OFF) | ||
option(BUILD_WITH_BENCHMARK "Build library with timing benchmarks" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
option(BUILD_WITH_EXTENDED_TESTING "Build library with extended testing" OFF) | |
option(BUILD_WITH_BENCHMARK "Build library with timing benchmarks" OFF) | |
option(BUILD_EXTENDED_TESTING "Build library with extended testing" OFF) | |
option(BUILD_BENCHMARK "Build library with timing benchmarks" OFF) |
# set(LIB_EXTENDED_TEST_DIR ${PROJECT_SOURCE_DIR}/problems) | ||
# set(LIB_EXTENDED_TEST_HEADERS | ||
# ${LIB_EXTENDED_TEST_DIR}/test-problems.hpp) | ||
# set(LIB_EXTENDED_TEST_SOURCES | ||
# ${LIB_EXTENDED_TEST_DIR}/test-problems.cpp) | ||
# set(LIB_BENCH_DIR ${PROJECT_SOURCE_DIR}/bench) | ||
# set(LIB_BENCH_SOURCES | ||
# ${LIB_BENCH_DIR}/timings.cpp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not used, should be removed.
# if(BUILD_WITH_BENCHMARK) | ||
# list(APPEND LIB_SOURCES ${LIB_BENCH_SOURCES}) | ||
# endif() | ||
|
||
# if(BUILD_WITH_EXTENDED_TESTING) | ||
# list(APPEND LIB_HEADERS ${LIB_EXTENDED_TEST_HEADERS}) | ||
# list(APPEND LIB_SOURCES ${LIB_EXTENDED_TEST_SOURCES}) | ||
# endif() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@@ -4,6 +4,7 @@ | |||
|
|||
#pragma once | |||
|
|||
#include "fwd.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "fwd.hpp" | |
#include "loik/fwd.hpp" |
|
||
// converged | ||
problem_struct.converged = problem_sol.get<bool>("converged"); | ||
|
||
// primal_infeasible | ||
problem_struct.primal_infeasible = problem_sol.get<bool>("primal_infeasible"); | ||
|
||
// dual_infeasible | ||
problem_struct.dual_infeasible = problem_sol.get<bool>("dual_infeasible"); | ||
|
||
// primal_residual | ||
problem_struct.primal_residual = problem_sol.get<double>("primal_residual"); | ||
|
||
// dual_residual | ||
problem_struct.dual_residual = problem_sol.get<double>("dual_residual"); | ||
|
||
// mu | ||
problem_struct.mu = problem_sol.get<double>("mu"); | ||
|
||
// n_iter | ||
problem_struct.n_iter = problem_sol.get<int>("n_iter"); | ||
|
||
// n_tail_solve_iter | ||
problem_struct.n_tail_solve_iter = problem_sol.get<int>("n_tail_solve_iter"); | ||
|
||
// n_active_ineq_constraint | ||
|
||
// vis | ||
const ptree& vis_pt = problem_sol.get_child("vis"); | ||
utils::PtreeToContainerOfObj<Motion, pin_aligned_vec>(vis_pt, problem_struct.vis); | ||
|
||
// yis | ||
const ptree& yis_pt = problem_sol.get_child("yis"); | ||
utils::PtreeToContainerOfObj<Vec6, pin_aligned_vec>(yis_pt, problem_struct.yis); | ||
|
||
// w | ||
const ptree& w_pt = problem_sol.get_child("w"); | ||
utils::PtreeToDataObj<DVec>(w_pt, problem_struct.w); | ||
|
||
|
||
// z | ||
const ptree& z_pt = problem_sol.get_child("z"); | ||
utils::PtreeToDataObj<DVec>(z_pt, problem_struct.z); | ||
|
||
|
||
/// push problem to problem_sequence | ||
problem_sequence.push_back(problem_struct); | ||
|
||
} //endfor | ||
|
||
} // SequenceDiffIKProblems::LoadProblemsFromJson | ||
|
||
|
||
/// explicit instantiation and specializations | ||
namespace utils { | ||
using Index = typename loik::DiffIKProblem<double>::Index; | ||
using DVec = typename loik::DiffIKProblem<double>::DVec; | ||
using Vec6 = typename loik::DiffIKProblem<double>::Vec6; | ||
using Motion = typename loik::DiffIKProblem<double>::Motion; | ||
using Mat6x6 = typename loik::DiffIKProblem<double>::Mat6x6; | ||
|
||
template<typename T> | ||
using pin_aligned_vec = typename pinocchio::container::aligned_vector<T>; | ||
|
||
// explicit instantiation | ||
template void PtreeToVec<DVec>(const ptree&, const DVec&); | ||
template void PtreeToVec<Vec6>(const ptree&, const Vec6&); | ||
template void PtreeToMat<Mat6x6>(const ptree&, const Mat6x6&); | ||
|
||
|
||
// `PtreeToDataObj` specializations | ||
template <> | ||
void PtreeToDataObj<DVec>(const ptree& pt, const DVec& vec) { PtreeToVec<DVec>(pt, vec); } // PtreeToDataObj<DVec> | ||
template <> | ||
void PtreeToDataObj<Vec6>(const ptree& pt, const Vec6& vec) { PtreeToVec<Vec6>(pt, vec); } // PtreeToDataObj<Vec6> | ||
template <> | ||
void PtreeToDataObj<Mat6x6>(const ptree& pt, const Mat6x6& mat) { PtreeToMat<Mat6x6>(pt, mat); } // PtreeToDataObj<Mat6x6> | ||
template <> | ||
void PtreeToDataObj<Motion>(const ptree& pt, const Motion& motion) | ||
{ | ||
Motion& motion_out = const_cast<Motion&>(motion); | ||
Motion::Vector6 motion_v6 = Motion::Vector6::Zero(); | ||
PtreeToVec(pt, motion_v6); | ||
motion_out = motion_v6; | ||
} // PtreeToDataObj<Motion> | ||
|
||
// explicit instantiation | ||
template void PtreeToDataObj<Index>(const ptree&, const Index&); | ||
template void PtreeToContainerOfObj<Index, std::vector>(const ptree&, const std::vector<Index>&); | ||
template void PtreeToContainerOfObj<DVec, pin_aligned_vec>(const ptree&, const pin_aligned_vec<DVec>&); | ||
template void PtreeToContainerOfObj<Vec6, pin_aligned_vec>(const ptree&, const pin_aligned_vec<Vec6>&); | ||
template void PtreeToContainerOfObj<Mat6x6, pin_aligned_vec>(const ptree&, const pin_aligned_vec<Mat6x6>&); | ||
template void PtreeToContainerOfObj<Motion, pin_aligned_vec>(const ptree&, const pin_aligned_vec<Motion>&); | ||
|
||
} // namespace utils | ||
|
||
template struct DiffIKProblem<double>; | ||
template struct SequenceDiffIKProblems<double>; | ||
|
||
} // namespace loik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is ill-formated
// std::string("/panda_description/urdf/panda.urdf"); | ||
// urdf_filename = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made some comments.
@bwingo47 Could you handle them?
Problem data JSON files are copied over from IkBench. Now has separate bench compile options