-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trik Studio 3D Visualization #1526
base: master
Are you sure you want to change the base?
Conversation
…Sender -> connectionToVizualizer,
@@ -222,3 +227,7 @@ SOURCES += \ | |||
|
|||
FORMS += \ | |||
$$PWD/src/engine/view/twoDModelWidget.ui \ | |||
|
|||
DISTFILES += \ | |||
$$PWD/src/engine/trajectory/frames.proto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мусор
@@ -13,6 +13,7 @@ | |||
# limitations under the License. | |||
|
|||
QT += widgets xml svg | |||
QT += network |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем отдельная строка?
{ | ||
if (connToVizualizator == nullptr) { | ||
connToVizualizator = new ConnectionToVizualizator(); | ||
connToVizualizator->setPort(8080); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Порт должен быть в опциях, хотя бы в Settings.
|
||
/// saving it to file | ||
QFile file("trajectory.json"); | ||
if( file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет обработки ошибки, хотя бы QLOG_ERROR () <<
|
||
try { | ||
sendTrajectory(data); | ||
} catch (exception e) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исключения надо ловить по ссылке. Но это дурной тон ловить std::exception
TrajectorySaver::TrajectorySaver(QObject *parent) | ||
: QObject(parent) | ||
{ | ||
connToVizualizator = new ConnectionToVizualizator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кто и когда удаляет?
QTcpSocket *socket; | ||
QTimer *keepaliveTimer; | ||
|
||
QString Ip {"10.0.5.2"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Параметры сетевого соединения должны быть в настройках
|
||
public: | ||
// ConnectionToVizualizator(QString ip, int port); | ||
ConnectionToVizualizator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Возможно, конструктору нужен параметр QObject *parent
, раз уж это Q_OBJECT
#include <QTimer> | ||
|
||
/// Connection to Unity to send frames and run/stop/restart | ||
class alignas(8) ConnectionToVizualizator : public QObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А зачем тут alignas(8)
? Такой код нельзя без комментария.
|
||
private: | ||
QTcpSocket *socket; | ||
QTimer *keepaliveTimer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В продукте принята схема именования полей с префиксом, то есть mSocket
и подобное.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RobotModel::deserialize и serialize должны выглядеть как "до изменений" (то есть после моего пулреквеста с форматом сейва). Ни на что в этом пул реквесте это на первый поверхностный вгляд повлиять не должно
После этого билды должны починиться
plugins/robots/common/twoDModel/src/engine/model/robotModel.cpp
Outdated
Show resolved
Hide resolved
plugins/robots/common/twoDModel/src/engine/model/robotModel.cpp
Outdated
Show resolved
Hide resolved
@@ -28,6 +28,7 @@ | |||
#include "twoDModel/engine/twoDModelDisplayWidget.h" | |||
|
|||
#include "twoDModel/twoDModelDeclSpec.h" | |||
#include "plugins/robots/common/twoDModel/src/engine/trajectory/connectionToVizualizator.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем этот #include
?
@@ -108,6 +113,7 @@ class TWO_D_MODEL_EXPORT TwoDModelWidget : public QWidget | |||
QDomDocument generateWorldModelWithBlobsXml() const; | |||
QDomDocument generateWorldModelXml() const; | |||
QDomDocument generateBlobsXml() const; | |||
ConnectionToVizualizator *mConnToVizualizator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отсутствует инициализация {}
, не указано, кто владеет объектом
@@ -44,6 +45,7 @@ Box2DPhysicsEngine::Box2DPhysicsEngine (const WorldModel &worldModel | |||
, mWorld(new b2World(b2Vec2(0, 0))) | |||
, mPrevPosition(b2Vec2(0, 0)) | |||
, mPrevAngle(0) | |||
, mTrajSaver(new TrajectorySaver(nullptr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Думаю, что тут надо бы не nullptr
@@ -353,7 +365,10 @@ void Box2DPhysicsEngine::nextFrame() | |||
item->setPos(scenePos - item->boundingRect().center()); | |||
item->setRotation(angleToScene(mBox2DDynamicItems[item]->getRotation())); | |||
} | |||
auto *abstractItem = dynamic_cast<graphicsUtils::AbstractItem *>(item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qobject_cast
не подойдёт?
@@ -0,0 +1,166 @@ | |||
/* Copyright 2022 Lada Egorova |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По-моему, тут где-то обычно запятая есть. Но хоть так.
@@ -140,24 +147,50 @@ | |||
<string>Network Settings</string> | |||
</property> | |||
<layout class="QGridLayout" name="gridLayout_5"> | |||
<item row="0" column="2"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не надо перетаскивать элементы в XML, это лишь увеличивает diff
cd7a4ab
to
ff6360f
Compare
dde4319
to
06af258
Compare
No description provided.