12 _default_source( default_source )
19 std::string
const & source_type( source ==
"param" ?
_nh_rel.param( std::string(
"humanoid_source/type" ),
_default_source ) : source );
24 std::shared_ptr<semio::HumanoidSmoothingFilter> smoothing_filter_ptr;
26 typedef std::function<void(std::string const &)> _ParamFunc;
27 typedef std::pair<std::string, _ParamFunc> _ParamOp;
29 for(
auto const & param_op : {
31 "humanoid_source/filter/smoothing/add",
32 []( std::string
const & param_name ){} ),
34 "humanoid_source/filter/smoothing/position",
35 [
this,&smoothing_filter_ptr]( std::string
const & param_name ){
39 "humanoid_source/filter/smoothing/orientation",
40 [
this,&smoothing_filter_ptr]( std::string
const & param_name ){
44 "humanoid_source/filter/smoothing/confidence",
45 [
this,&smoothing_filter_ptr]( std::string
const & param_name ){
49 "humanoid_source/filter/smoothing/window",
50 [
this,&smoothing_filter_ptr]( std::string
const & param_name ){
51 smoothing_filter_ptr->setSmoothingWindow( this->
_nh_rel.param<
double>( param_name, 0 ) );
54 auto const & param_name( param_op.first );
56 if(
_nh_rel.hasParam( param_name ) )
58 if( !smoothing_filter_ptr ) smoothing_filter_ptr = std::make_shared<semio::HumanoidSmoothingFilter>();
60 param_op.second( param_name );
65 if( source_type ==
"nite" ) result = std::make_shared<semio::HumanoidSourceNiTE>();
66 else if( source_type ==
"openface" ) result = std::make_shared<semio::HumanoidSourceOpenFace>();
67 else if( source_type ==
"fullbody" )
69 auto local_result( std::make_shared<semio::HumanoidSourceFullBody>() );
70 local_result->show_cropped_image_ =
_nh_rel.param<
bool>( std::string(
"humanoid_source/fullbody/show_cropped_image" ), false );
71 result = local_result;
73 else if( source_type ==
"ros" )
75 result = std::make_shared<semio::ros::HumanoidSourceROS>(
_nh_rel );
77 else if( source_type ==
"virtual" ) result = std::make_shared<HumanoidSourceVirtual>();
78 else return std::make_shared<semio::ros::HumanoidSourceROS>( ::ros::NodeHandle(
_nh_rel,
"/null" ) );
81 if( smoothing_filter_ptr )
83 auto & result_filter( result->getFilter() );
84 result_filter.addFilter( smoothing_filter_ptr );
static double getSmoothing(double const &factor, double const &duration)
HumanoidSourceAdapter(::ros::NodeHandle const &nh_rel, std::string const &default_source="fullbody")
::ros::NodeHandle _nh_rel
NodeHandle copy for interfacing with ROS.
std::string _default_source
The type of source to use by default if param mode is selected and the ROS param _humanoid_source/typ...
decltype(std::make_shared< HumanoidSource >()) typedef Ptr
HumanoidSource::Ptr getHumanoidSource(std::string const &source="param")
Create a semio::HumanoidSource.
static _FilterFuncArray const & getStandardFilterHumanoid()