void OverlayTextDisplay::updateOvertakePositionProperties() { if (!overtake_position_properties_ && overtake_position_properties_property_->getBool()) { updateTop(); updateLeft(); updateWidth(); updateHeight(); updateTextSize(); require_update_texture_ = true; } overtake_position_properties_ = overtake_position_properties_property_->getBool(); if (overtake_position_properties_) { top_property_->show(); left_property_->show(); width_property_->show(); height_property_->show(); text_size_property_->show(); } else { top_property_->hide(); left_property_->hide(); width_property_->hide(); height_property_->hide(); text_size_property_->hide(); } }
OverlayImageDisplay::OverlayImageDisplay() : Display(), width_(128), height_(128), left_(128), top_(128), alpha_(0.8), is_msg_available_(false), require_update_(false) { // setup properties update_topic_property_ = new rviz::RosTopicProperty( "Topic", "", ros::message_traits::datatype<sensor_msgs::Image>(), "sensor_msgs::Image topic to subscribe to.", this, SLOT( updateTopic() )); keep_aspect_ratio_property_ = new rviz::BoolProperty("keep aspect ratio", false, "keep aspect ratio of original image", this, SLOT(updateKeepAspectRatio())); width_property_ = new rviz::IntProperty("width", 128, "width of the image window", this, SLOT(updateWidth())); height_property_ = new rviz::IntProperty("height", 128, "height of the image window", this, SLOT(updateHeight())); left_property_ = new rviz::IntProperty("left", 128, "left of the image window", this, SLOT(updateLeft())); top_property_ = new rviz::IntProperty("top", 128, "top of the image window", this, SLOT(updateTop())); alpha_property_ = new rviz::FloatProperty("alpha", 0.8, "alpha belnding value", this, SLOT(updateAlpha())); }
void PieChartDisplay::onInitialize() { static int count = 0; rviz::UniformStringStream ss; ss << "PieChartDisplayObject" << count++; overlay_.reset(new OverlayObject(ss.str())); onEnable(); updateSize(); updateLeft(); updateTop(); updateFGColor(); updateBGColor(); updateFGAlpha(); updateFGAlpha2(); updateBGAlpha(); updateMinValue(); updateMaxValue(); updateTextColor(); updateTextAlpha(); updateTextSize(); updateShowCaption(); updateAutoColorChange(); updateMaxColor(); overlay_->updateTextureSize(texture_size_, texture_size_ + caption_offset_); overlay_->hide(); }
void Plotter2DDisplay::onInitialize() { static int count = 0; rviz::UniformStringStream ss; ss << "Plotter2DDisplayObject" << count++; overlay_.reset(new OverlayObject(ss.str())); updateBufferSize(); onEnable(); updateShowValue(); updateWidth(); updateHeight(); updateLeft(); updateTop(); updateFGColor(); updateBGColor(); updateFGAlpha(); updateBGAlpha(); updateLineWidth(); updateUpdateInterval(); updateShowBorder(); updateAutoColorChange(); updateMaxColor(); updateShowCaption(); updateTextSize(); updateAutoScale(); updateMinValue(); updateMaxValue(); overlay_->updateTextureSize(width_property_->getInt(), height_property_->getInt() + caption_offset_); }
void binomial_queue<T>::push(const T& value) { qty++; tree_reference treeToAdd(new binomial_tree<T>(value)); addTree(treeToAdd); updateTop(); check(); }
void binomial_queue<T>::pop() { if (empty()) std::runtime_error("queue is already empty"); qty--; trees.erase(top_tree); for (auto child: top_tree->split()) addTree(child); updateTop(); check(); }
void OverlayImageDisplay::onInitialize() { ros::NodeHandle nh; it_ = boost::shared_ptr<image_transport::ImageTransport>(new image_transport::ImageTransport(nh)); updateWidth(); updateHeight(); updateKeepAspectRatio(); updateTop(); updateLeft(); updateAlpha(); updateTopic(); }
void OverlayTextDisplay::updateOvertakePositionProperties() { if (!overtake_position_properties_ && overtake_position_properties_property_->getBool()) { updateTop(); updateLeft(); updateWidth(); updateHeight(); updateTextSize(); require_update_texture_ = true; } overtake_position_properties_ = overtake_position_properties_property_->getBool(); }
// only the first time void OverlayTextDisplay::onInitialize() { onEnable(); updateTopic(); updateOvertakePositionProperties(); updateOvertakeColorProperties(); updateTop(); updateLeft(); updateWidth(); updateHeight(); updateTextSize(); updateFGColor(); updateFGAlpha(); updateBGColor(); updateBGAlpha(); updateFont(); updateLineWidth(); require_update_texture_ = true; }
OverlayTextDisplay::OverlayTextDisplay() : Display(), texture_width_(0), texture_height_(0), text_size_(14), line_width_(2), text_(""), font_(""), bg_color_(0, 0, 0, 0), fg_color_(255, 255, 255, 255.0), require_update_texture_(false) { update_topic_property_ = new rviz::RosTopicProperty( "Topic", "", ros::message_traits::datatype<jsk_rviz_plugins::OverlayText>(), "jsk_rviz_plugins::OverlayText topic to subscribe to.", this, SLOT( updateTopic() )); overtake_position_properties_property_ = new rviz::BoolProperty( "Overtake Position Properties", false, "overtake position properties specified by message such as left, top and font", this, SLOT(updateOvertakePositionProperties())); overtake_color_properties_property_ = new rviz::BoolProperty( "Overtake Color Properties", false, "overtake color properties specified by message such as left, top and font", this, SLOT(updateOvertakeColorProperties())); top_property_ = new rviz::IntProperty( "top", 0, "top position", this, SLOT(updateTop())); top_property_->setMin(0); left_property_ = new rviz::IntProperty( "left", 0, "left position", this, SLOT(updateLeft())); left_property_->setMin(0); width_property_ = new rviz::IntProperty( "width", 128, "width position", this, SLOT(updateWidth())); width_property_->setMin(0); height_property_ = new rviz::IntProperty( "height", 128, "height position", this, SLOT(updateHeight())); height_property_->setMin(0); text_size_property_ = new rviz::IntProperty( "text size", 12, "text size", this, SLOT(updateTextSize())); text_size_property_->setMin(0); line_width_property_ = new rviz::IntProperty( "line width", 2, "line width", this, SLOT(updateLineWidth())); line_width_property_->setMin(0); fg_color_property_ = new rviz::ColorProperty( "Foreground Color", QColor(25, 255, 240), "Foreground Color", this, SLOT(updateFGColor())); fg_alpha_property_ = new rviz::FloatProperty( "Foreground Alpha", 0.8, "Foreground Alpha", this, SLOT(updateFGAlpha())); fg_alpha_property_->setMin(0.0); fg_alpha_property_->setMax(1.0); bg_color_property_ = new rviz::ColorProperty( "Background Color", QColor(0, 0, 0), "Background Color", this, SLOT(updateBGColor())); bg_alpha_property_ = new rviz::FloatProperty( "Background Alpha", 0.8, "Background Alpha", this, SLOT(updateBGAlpha())); bg_alpha_property_->setMin(0.0); bg_alpha_property_->setMax(1.0); QFontDatabase database; font_families_ = database.families(); font_property_ = new rviz::EnumProperty( "font", "DejaVu Sans Mono", "font", this, SLOT(updateFont())); for (size_t i = 0; i < font_families_.size(); i++) { font_property_->addOption(font_families_[i], (int)i); } }
PieChartDisplay::PieChartDisplay() : rviz::Display() { update_topic_property_ = new rviz::RosTopicProperty( "Topic", "", ros::message_traits::datatype<std_msgs::Float32>(), "std_msgs::Float32 topic to subscribe to.", this, SLOT( updateTopic() )); size_property_ = new rviz::IntProperty("size", 128, "size of the plotter window", this, SLOT(updateSize())); left_property_ = new rviz::IntProperty("left", 128, "left of the plotter window", this, SLOT(updateLeft())); top_property_ = new rviz::IntProperty("top", 128, "top of the plotter window", this, SLOT(updateTop())); fg_color_property_ = new rviz::ColorProperty("foreground color", QColor(25, 255, 240), "color to draw line", this, SLOT(updateFGColor())); fg_alpha_property_ = new rviz::FloatProperty("foreground alpha", 0.7, "alpha belnding value for foreground", this, SLOT(updateFGAlpha())); fg_alpha2_property_ = new rviz::FloatProperty("foreground alpha 2", 0.4, "alpha belnding value for foreground for indicator", this, SLOT(updateFGAlpha2())); bg_color_property_ = new rviz::ColorProperty("background color", QColor(0, 0, 0), "background color", this, SLOT(updateBGColor())); bg_alpha_property_ = new rviz::FloatProperty("backround alpha", 0.0, "alpha belnding value for background", this, SLOT(updateBGAlpha())); text_color_property_ = new rviz::ColorProperty("text color", QColor(25, 255, 240), "text color", this, SLOT(updateTextColor())); text_alpha_property_ = new rviz::FloatProperty("text alpha", 1.0, "alpha belnding value for text", this, SLOT(updateTextAlpha())); text_size_property_ = new rviz::IntProperty("text size", 14, "text size", this, SLOT(updateTextSize())); show_caption_property_ = new rviz::BoolProperty("show caption", true, "show caption", this, SLOT(updateShowCaption())); max_value_property_ = new rviz::FloatProperty("max value", 1.0, "max value of pie chart", this, SLOT(updateMaxValue())); min_value_property_ = new rviz::FloatProperty("min value", 0.0, "min value of pie chart", this, SLOT(updateMinValue())); auto_color_change_property_ = new rviz::BoolProperty("auto color change", false, "change the color automatically", this, SLOT(updateAutoColorChange())); max_color_property_ = new rviz::ColorProperty("max color", QColor(255, 0, 0), "only used if auto color change is set to True.", this, SLOT(updateMaxColor())); }
int main(void) { init_lcd(); writecommand(0x01); updateScreen(); DDRD |= (1 << PD2);//output for green LED DDRD |= (1 << PD3);//output for red LED //button pullup resistors: PORTB |= (1 << PB3) | (1 << PB4); //rotary encoder initializations: initialize_rotary(); sei(); PORTC |= (1 << PC4) | (1 << PC5);//i2c pullup resistors //enable line PORTC |= (1 << PC3); DDRC |= (1 << PC3); //set as output //DS1631 ds1631_init(); ds1631_conv(); unsigned char temp[2]; //serial communication init_serial(); while (1) { PORTC &= ~(1 << PC3);//set enable to 0 ds1631_temp(temp); int tempCelsius = temp[0]; //convert from celsius to fahrenheit: if(temp[1] == 0){ tempF = (tempCelsius*9)/5 + 32; } else{ tempF = tempCelsius * 10 + 5; tempF = (tempF*9)/5 + 320; tempF /= 10; } if(oldTempF != tempF){//if temperature changes, update + transmit data //update temp updateTop(); char temp[5]; snprintf(temp, 5, "%d", tempF); transmitData(temp, &tempF); } oldTempF = tempF;//update old temp if((PINB & (1 << PB3)) == 0){//if high button is pressed buttonState = 1;//high } if((PINB & (1 << PB4)) == 0){//if low button is pressed buttonState = 0;//low } if(bufferValidFlag == 1){//valid data received //convert to int stored inside remoteVal int hundreds = (receivedDataBuffer[1]-0x30)*100; int tens = (receivedDataBuffer[2]-0x30)*10; int ones = receivedDataBuffer[3]-0x30; remoteVal = hundreds + tens + ones; if(receivedDataBuffer[0] == '-'){ remoteVal = 0 - remoteVal; } updateTop(); bufferValidFlag = 0;//reset } if(change == 1){ updateScreen(); change = 0;//reset } updateLED(); } return 0; /* never reached */ }
Plotter2DDisplay::Plotter2DDisplay() : rviz::Display(), min_value_(0.0), max_value_(0.0) { update_topic_property_ = new rviz::RosTopicProperty( "Topic", "", ros::message_traits::datatype<std_msgs::Float32>(), "std_msgs::Float32 topic to subscribe to.", this, SLOT(updateTopic())); show_value_property_ = new rviz::BoolProperty( "Show Value", true, "Show value on plotter", this, SLOT(updateShowValue())); buffer_length_property_ = new rviz::IntProperty( "Buffer length", 100, ros::message_traits::datatype<std_msgs::Float32>(), this, SLOT(updateBufferSize())); width_property_ = new rviz::IntProperty("width", 128, "width of the plotter window", this, SLOT(updateWidth())); width_property_->setMin(1); width_property_->setMax(2000); height_property_ = new rviz::IntProperty("height", 128, "height of the plotter window", this, SLOT(updateHeight())); height_property_->setMin(1); height_property_->setMax(2000); left_property_ = new rviz::IntProperty("left", 128, "left of the plotter window", this, SLOT(updateLeft())); left_property_->setMin(0); top_property_ = new rviz::IntProperty("top", 128, "top of the plotter window", this, SLOT(updateTop())); top_property_->setMin(0); auto_scale_property_ = new rviz::BoolProperty( "auto scale", true, "enable auto scale", this, SLOT(updateAutoScale())); max_value_property_ = new rviz::FloatProperty( "max value", 1.0, "max value, used only if auto scale is disabled", this, SLOT(updateMaxValue())); min_value_property_ = new rviz::FloatProperty( "min value", -1.0, "min value, used only if auto scale is disabled", this, SLOT(updateMinValue())); fg_color_property_ = new rviz::ColorProperty( "foreground color", QColor(25, 255, 240), "color to draw line", this, SLOT(updateFGColor())); fg_alpha_property_ = new rviz::FloatProperty( "foreground alpha", 0.7, "alpha belnding value for foreground", this, SLOT(updateFGAlpha())); fg_alpha_property_->setMin(0); fg_alpha_property_->setMax(1.0); bg_color_property_ = new rviz::ColorProperty( "background color", QColor(0, 0, 0), "background color", this, SLOT(updateBGColor())); bg_alpha_property_ = new rviz::FloatProperty( "backround alpha", 0.0, "alpha belnding value for background", this, SLOT(updateBGAlpha())); bg_alpha_property_->setMin(0); bg_alpha_property_->setMax(1.0); line_width_property_ = new rviz::IntProperty("linewidth", 1, "linewidth of the plot", this, SLOT(updateLineWidth())); line_width_property_->setMin(1); line_width_property_->setMax(1000); show_border_property_ = new rviz::BoolProperty( "border", true, "show border or not", this, SLOT(updateShowBorder())); text_size_property_ = new rviz::IntProperty("text size", 12, "text size of the caption", this, SLOT(updateTextSize())); text_size_property_->setMin(1); text_size_property_->setMax(1000); show_caption_property_ = new rviz::BoolProperty( "caption", true, "show caption or not", this, SLOT(updateShowCaption())); update_interval_property_ = new rviz::FloatProperty( "update interval", 0.04, "update interval of the plotter", this, SLOT(updateUpdateInterval())); update_interval_property_->setMin(0.0); update_interval_property_->setMax(100); auto_color_change_property_ = new rviz::BoolProperty("auto color change", false, "change the color automatically", this, SLOT(updateAutoColorChange())); max_color_property_ = new rviz::ColorProperty( "max color", QColor(255, 0, 0), "only used if auto color change is set to True.", this, SLOT(updateMaxColor())); }