22 #include <gazebo/msgs/msgs.hh> 36 windPixmap(150, 150), windPainter(&(this->windPixmap)),
38 contactPixmap(150, 150), contactPainter(&(this->contactPixmap)),
40 contactTime(
ros::Time::now())
42 #if GAZEBO_MAJOR_VERSION >= 8 54 "QFrame { background-color : rgba(100, 100, 100, 255); color : white; }");
57 QHBoxLayout *mainLayout =
new QHBoxLayout;
58 mainLayout->setContentsMargins(0, 0, 0, 0);
61 QFrame *mainFrame =
new QFrame();
63 QHBoxLayout *InfoLayout =
new QHBoxLayout();
64 InfoLayout->setContentsMargins(0, 0, 0, 0);
68 QLabel *taskInfo =
new QLabel;
70 InfoLayout->addWidget(taskInfo);
71 connect(
this, SIGNAL(SetTaskInfo(QString)),
72 taskInfo, SLOT(setText(QString)), Qt::QueuedConnection);
76 QLabel *windDirection =
new QLabel;
78 InfoLayout->addWidget(windDirection);
79 connect(
this, SIGNAL(SetWindDirection(QPixmap)),
80 windDirection, SLOT(setPixmap(QPixmap)), Qt::QueuedConnection);
84 QLabel *contact =
new QLabel;
86 InfoLayout->addWidget(contact);
87 connect(
this, SIGNAL(SetContact(QPixmap)),
88 contact, SLOT(setPixmap(QPixmap)), Qt::QueuedConnection);
91 mainFrame->setLayout(InfoLayout);
93 mainLayout->addWidget(mainFrame);
96 this->setLayout(mainLayout);
98 this->resize(600, 170);
102 this->taskSub = this->
node->subscribe(
"/vrx/task/info", 1,
105 this->windSpeedSub = this->
node->subscribe(
"/vrx/debug/wind/speed", 1,
108 this->windDirectionSub = this->
node->subscribe(
"/vrx/debug/wind/direction", 1,
111 this->linkStateSub = this->
node->subscribe(
"/gazebo/link_states", 1,
114 this->contactSub = this->
node->subscribe(
"/vrx/debug/contact", 1,
129 this->contactPixmap.fill(Qt::red);
131 this->
pen.setColor(Qt::black);
132 this->
pen.setWidth(10);
135 this->
contactPainter.drawText(QPoint(10, 15), QString(
"CONTACT WITH:"));
138 QString::fromStdString(_msg->collision2));
149 for (
auto& i : _msg->name)
151 if (i ==
"wamv::base_link")
157 _msg->pose[c].orientation.y,
158 _msg->pose[c].orientation.z,
159 _msg->pose[c].orientation.w);
168 this->contactPixmap.fill(Qt::gray);
177 this->windPixmap.fill(Qt::gray);
180 this->
pen.setColor(Qt::black);
181 this->
pen.setWidth(10);
186 this->
windPainter.drawText(QRect(71, -2, 20, 20), 0, tr(
"N"),
nullptr);
189 const double pi = 3.14159265;
191 double x = scale*
cos((pi/-180)*(_msg->data)) + 75;
192 double y = scale*
sin((pi/-180)*(_msg->data)) + 75;
193 this->
pen.setWidth(10);
194 this->
pen.setColor(Qt::red);
198 this->
pen.setWidth(6);
199 this->
pen.setColor(Qt::blue);
218 std::ostringstream taskInfoStream;
219 taskInfoStream.str(
"");
220 taskInfoStream <<
"Task Info:\n";
221 taskInfoStream <<
"Task Name: " << _msg->name <<
"\n";
222 taskInfoStream <<
"Task Phase: " << _msg->state <<
"\n";
223 taskInfoStream <<
"Ready Time: " <<
224 this->
FormatTime(_msg->ready_time.toSec()) <<
"\n";
225 taskInfoStream <<
"Running Time: " <<
226 this->
FormatTime(_msg->running_time.toSec()) <<
"\n";
227 taskInfoStream <<
"Elapsed Time: " <<
228 this->
FormatTime(_msg->elapsed_time.toSec()) <<
"\n";
229 taskInfoStream <<
"Remaining Time: " <<
230 this->
FormatTime(_msg->remaining_time.toSec()) <<
"\n";
231 taskInfoStream <<
"Timed out: ";
233 taskInfoStream <<
"true" <<
"\n";
235 taskInfoStream <<
"false" <<
"\n";
236 taskInfoStream <<
"Score: " << _msg->score <<
"\n";
237 this->
SetTaskInfo(QString::fromStdString(taskInfoStream.str()));
243 std::ostringstream stream;
244 unsigned int day, hour,
min;
257 stream << std::setw(2) << std::setfill(
'0') << day <<
" ";
258 stream << std::setw(2) << std::setfill(
'0') << hour <<
":";
259 stream << std::setw(2) << std::setfill(
'0') << min <<
":";
260 stream << std::setw(2) << std::setfill(
'0') << sec <<
".";
ROSCPP_DECL bool isInitialized()
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
TFSIMD_FORCE_INLINE const tfScalar & y() const
void getRPY(tfScalar &roll, tfScalar &pitch, tfScalar &yaw, unsigned int solution_number=1) const
TFSIMD_FORCE_INLINE const tfScalar & x() const
double min(double a, double b)
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)