double msum(double k) { double sd=0; for(int i=1; i<=n; ++i) if(seg[i].xs>k) sd+=distp(seg[i].xs,seg[i].y,k,sus); else if(seg[i].xs<=k && k<=seg[i].xd) sd+=(double)sus-(double)seg[i].y; else sd+=distp(seg[i].xd,seg[i].y,k,sus); return sd; }
/** * Create properties */ void srs_ui_but::CButProjection::createProperties() { m_rgb_topic_property = property_manager_->createProperty<rviz::ROSTopicStringProperty>( "RGB image Topic", property_prefix_, boost::bind( &CButProjection::getRgbTopic, this ), boost::bind( &CButProjection::setRgbTopic, this, _1 ), parent_category_, this ); m_depth_topic_property = property_manager_->createProperty<rviz::ROSTopicStringProperty>( "Depth image Topic", property_prefix_, boost::bind( &CButProjection::getDepthTopic, this ), boost::bind( &CButProjection::setDepthTopic, this, _1 ), parent_category_, this ); m_distance_property = property_manager_->createProperty<rviz::FloatProperty>( "Tested distance", property_prefix_, boost::bind( &CButProjection::getTestedDistance, this ), boost::bind( &CButProjection::setTestedDistance, this, _1), parent_category_, this ); // Set distance limits rviz::FloatPropertyPtr distp( m_distance_property.lock()); distp->setMin( 0.0 ); distp->setMax( 10.0 ); setPropertyHelpText(m_rgb_topic_property, "sensor_msgs::Image topic to subscribe to."); rviz::ROSTopicStringPropertyPtr topic_prop = m_rgb_topic_property.lock(); topic_prop->setMessageType(ros::message_traits::datatype<sensor_msgs::Image>()); // Set topics setRgbTopic( m_imageRGBInputTopicName ); setDepthTopic( m_imageDepthInputTopicName ); }