8 _default_sink( default_sink )
15 std::string
const & sink_type( sink ==
"param" ?
_nh_rel.param( std::string(
"humanoid_sink/type" ),
_default_sink ) : sink );
20 std::shared_ptr<semio::HumanoidSmoothingFilter> smoothing_filter_ptr;
22 typedef std::function<void(std::string const &)> _ParamFunc;
23 typedef std::pair<std::string, _ParamFunc> _ParamOp;
25 for(
auto const & param_op : {
27 "humanoid_sink/filter/smoothing/add",
28 []( std::string
const & param_name ){} ),
30 "humanoid_sink/filter/smoothing/position",
31 [
this,&smoothing_filter_ptr]( std::string
const & param_name ){
35 "humanoid_sink/filter/smoothing/orientation",
36 [
this,&smoothing_filter_ptr]( std::string
const & param_name ){
40 "humanoid_sink/filter/smoothing/confidence",
41 [
this,&smoothing_filter_ptr]( std::string
const & param_name ){
45 "humanoid_sink/filter/smoothing/window",
46 [
this,&smoothing_filter_ptr]( std::string
const & param_name ){
47 smoothing_filter_ptr->setSmoothingWindow( this->
_nh_rel.param<
double>( param_name, 0 ) );
50 auto const & param_name( param_op.first );
52 if(
_nh_rel.hasParam( param_name ) )
54 if( !smoothing_filter_ptr ) smoothing_filter_ptr = std::make_shared<semio::HumanoidSmoothingFilter>();
56 param_op.second( param_name );
61 if( sink_type ==
"ros" )
63 if( smoothing_filter_ptr ) result = std::make_shared<semio::ros::HumanoidSinkROS>(
_nh_rel,
"humanoids/smoothed" );
64 else result = std::make_shared<semio::ros::HumanoidSinkROS>(
_nh_rel );
66 else return std::make_shared<semio::ros::HumanoidSinkROS>( ::ros::NodeHandle(
_nh_rel,
"/null" ) );
69 if( smoothing_filter_ptr )
71 auto & result_filter( result->getFilter() );
72 result_filter.addFilter( smoothing_filter_ptr );
decltype(std::make_shared< HumanoidSink >()) typedef Ptr
::ros::NodeHandle _nh_rel
NodeHandle copy for interfacing with ROS.
static double getSmoothing(double const &factor, double const &duration)
HumanoidSinkAdapter(::ros::NodeHandle const &nh_rel, std::string const &default_sink="ros")
static _FilterFuncArray const & getStandardFilterHumanoid()
std::string _default_sink
The type of sink to use by default if param mode is selected and the ROS param _humanoid_sink/type is...
HumanoidSink::Ptr getHumanoidSink(std::string const &sink="param")
Create a semio::HumanoidSink.