58 uchar* palette_ptr = palette.data();
60 for(
int i = 0; i <= 100; i++ )
62 uchar v = 255 - (255 * i) / 100;
69 for(
int i = 101; i <= 127; i++ )
77 for(
int i = 128; i <= 254; i++ )
80 *palette_ptr++ = (255*(i-128))/(254-128);
85 *palette_ptr++ = 0x70;
86 *palette_ptr++ = 0x89;
87 *palette_ptr++ = 0x86;
96 uchar* palette_ptr = palette.data();
105 for(
int i = 1; i <= 98; i++ )
107 uchar v = (255 * i) / 100;
110 *palette_ptr++ = 255 - v;
111 *palette_ptr++ = 255;
115 *palette_ptr++ = 255;
116 *palette_ptr++ = 255;
117 *palette_ptr++ = 255;
119 *palette_ptr++ = 255;
121 *palette_ptr++ = 255;
122 *palette_ptr++ = 255;
124 for(
int i = 101; i <= 127; i++ )
127 *palette_ptr++ = 255;
129 *palette_ptr++ = 255;
132 for(
int i = 128; i <= 254; i++ )
134 *palette_ptr++ = 255;
135 *palette_ptr++ = (255*(i-128))/(254-128);
137 *palette_ptr++ = 255;
140 *palette_ptr++ = 0x70;
141 *palette_ptr++ = 0x89;
142 *palette_ptr++ = 0x86;
143 *palette_ptr++ = 160;
151 config_widget_(new QWidget()),
161 p.setColor(QPalette::Background, Qt::white);
165 QPalette p3(
ui_.status->palette());
166 p3.setColor(QPalette::Text, Qt::red);
167 ui_.status->setPalette(p3);
171 QObject::connect(
ui_.topic_grid, SIGNAL(textEdited(
const QString&)),
this, SLOT(
TopicGridEdited()));
177 QObject::connect(
ui_.color_scheme, SIGNAL(currentTextChanged(
const QString &)),
this, SLOT(
colorSchemeUpdated(
const QString &)));
195 QPixmap icon(16, 16);
196 icon.fill(Qt::transparent);
198 QPainter painter(&icon);
199 painter.setRenderHint(QPainter::Antialiasing,
true);
204 pen.setCapStyle(Qt::SquareCap);
207 painter.drawLine(2, 2, 14, 2);
208 painter.drawLine(2, 2, 2, 14);
209 painter.drawLine(14, 2, 14, 14);
210 painter.drawLine(2, 14, 14, 14);
211 painter.drawLine(8, 2, 8, 14);
212 painter.drawLine(2, 8, 14, 8);
226 if (!topic.
name.empty())
228 QString str = QString::fromStdString(topic.
name);
229 ui_.topic_grid->setText( str);
237 const std::string topic =
ui_.topic_grid->text().trimmed().toStdString();
249 if(
ui_.checkbox_update)
253 ROS_INFO(
"Subscribing to %s", topic.c_str());
259 const std::string topic =
ui_.topic_grid->text().trimmed().toStdString();
262 if(
ui_.checkbox_update)
273 const size_t width =
grid_->info.width;
274 const size_t height =
grid_->info.height;
277 for (
size_t row = 0; row < height; row++)
279 for (
size_t col = 0; col < width; col++)
331 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
333 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
334 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
336 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
337 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
339 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
352 glBindTexture(GL_TEXTURE_2D, 0);
353 glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
361 const int width =
grid_->info.width;
362 const int height =
grid_->info.height;
371 int32_t max_dimension = std::max(height, width);
383 for (
size_t row = 0; row < height; row++)
385 for (
size_t col = 0; col < width; col++)
387 size_t index_src = (col + row*width);
389 uchar color =
static_cast<uchar
>(
grid_->data[ index_src ] );
410 for (
size_t row = 0; row <
msg->height; row++)
412 for (
size_t col = 0; col <
msg->width; col++)
414 size_t index_src = (col + row *
msg->width);
416 uchar color =
static_cast<uchar
>(
msg->data[ index_src ] );
431 double resolution =
grid_->info.resolution;
436 const double RAD_TO_DEG = 180.0 / M_PI;
442 glRotatef(pitch * RAD_TO_DEG, 0, 1, 0);
443 glRotatef(roll * RAD_TO_DEG, 1, 0, 0);
444 glRotatef(yaw * RAD_TO_DEG, 0, 0, 1);
446 glTranslatef(
grid_->info.origin.position.x,
447 grid_->info.origin.position.y,
450 glScalef( resolution, resolution, 1.0);
452 float width =
static_cast<float>(
grid_->info.width);
453 float height =
static_cast<float>(
grid_->info.height);
455 glEnable(GL_TEXTURE_2D);
457 glBegin(GL_TRIANGLES);
459 glColor4f(1.0
f, 1.0
f, 1.0
f,
ui_.alpha->value() );
464 glVertex2d(width, 0);
466 glVertex2d(width, height);
471 glVertex2d(width, height);
473 glVertex2d(0, height);
477 glBindTexture(GL_TEXTURE_2D, 0);
478 glDisable(GL_TEXTURE_2D);
506 node[
"topic"] >> topic;
507 ui_.topic_grid->setText(QString::fromStdString(topic));
513 node[
"update"] >> checked;
514 ui_.checkbox_update->setChecked( checked );
520 node[
"alpha"] >> alpha;
521 ui_.alpha->setValue(alpha);
527 node[
"scheme"] >> scheme;
528 int index =
ui_.color_scheme->findText(QString::fromStdString(scheme), Qt::MatchExactly);
531 ui_.color_scheme->setCurrentIndex(index);
541 emitter << YAML::Key <<
"alpha" << YAML::Value <<
ui_.alpha->value();
542 emitter << YAML::Key <<
"topic" << YAML::Value <<
ui_.topic_grid->text().toStdString();
543 emitter << YAML::Key <<
"update" << YAML::Value <<
ui_.checkbox_update->isChecked();
544 emitter << YAML::Key <<
"scheme" << YAML::Value <<
ui_.color_scheme->currentText().toStdString();