Commit 1bf9b726 authored by jcarpent's avatar jcarpent
Browse files

[Unittest] Add Lua parser Unittest

parent 78512b43
inertia = {
{1.1, 0.1, 0.2},
{0.1, 1.2, 0.4},
{0.2, 0.4, 1.3}
}
pelvis = { mass = 9.3, com = { 1.1, 1.2, 1.3}, inertia = inertia }
thigh = { mass = 4.2, com = { 1.1, 1.2, 1.3}, inertia = inertia }
shank = { mass = 4.1, com = { 1.1, 1.2, 1.3}, inertia = inertia }
foot = { mass = 1.1, com = { 1.1, 1.2, 1.3}, inertia = inertia }
bodies = {
pelvis = pelvis,
thigh_right = thigh,
shank_right = shank,
thigh_left = thigh,
shank_left = shank
}
joints = {
freeflyer = {
'jointFreeFlyer'
},
spherical_zyx = {
'jointSphericalZYX'
},
rotational_y = {
'jointRY'
},
fixed = {
'jointFixed'
},
}
model = {
frames = {
{
name = "pelvis",
--parent = "ROOT",
body = bodies.pelvis,
--joint = joints.freeflyer,
},
{
name = "thigh_right",
parent = "pelvis",
body = bodies.thigh_right,
joint = joints.spherical_zyx,
joint_name = "hip_right",
},
{
name = "shank_right",
parent = "thigh_right",
body = bodies.thigh_right,
joint = joints.rotational_y
},
{
name = "foot_right",
parent = "shank_right",
body = bodies.thigh_right,
joint = joints.fixed
},
{
name = "thigh_left",
parent = "pelvis",
body = bodies.thigh_left,
joint = joints.spherical_zyx,
joint_name = "hip_left",
},
{
name = "shank_left",
parent = "thigh_left",
body = bodies.thigh_left,
joint = joints.rotational_y
},
{
name = "foot_left",
parent = "shank_left",
body = bodies.thigh_left,
joint = joints.fixed
},
}
}
return model
......@@ -213,7 +213,7 @@ namespace se3
joint_type = "jointFreeFlyer";
else
{
std::cerr << "The first segment is defined without any definition of joint type relatily to the environment." << std::endl;
std::cerr << "The first segment is defined without any definition of joint type relatily to the world." << std::endl;
abort ();
}
}
......
......@@ -45,6 +45,12 @@ IF(URDFDOM_FOUND)
ADD_TEST_CFLAGS(value '-DPINOCCHIO_SOURCE_DIR=\\\"${${PROJECT_NAME}_SOURCE_DIR}\\\"')
ENDIF(URDFDOM_FOUND)
IF(LUA5_1_FOUND)
ADD_UNIT_TEST(lua "eigen3;lua5.1")
TARGET_LINK_LIBRARIES(lua ${PROJECT_NAME})
ADD_TEST_CFLAGS(lua '-DPINOCCHIO_SOURCE_DIR=\\\"${${PROJECT_NAME}_SOURCE_DIR}\\\"')
ENDIF(LUA5_1_FOUND)
# Work in progress
#ADD_UNIT_TEST(constraint eigen3)
#ADD_UNIT_TEST(variant eigen3)
......
#include <iostream>
#include "pinocchio/multibody/model.hpp"
#include "pinocchio/multibody/parser/lua.hpp"
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE UrdfTest
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE ( ParsingLuaFile )
BOOST_AUTO_TEST_CASE ( buildModel )
{
std::string filename = PINOCCHIO_SOURCE_DIR"/models/simple_model.lua";
#ifndef NDEBUG
std::cout << "Parse filename \"" << filename << "\"" << std::endl;
#endif
se3::Model model = se3::lua::buildModel(filename, true, true);
}
BOOST_AUTO_TEST_SUITE_END()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment