-
Notifications
You must be signed in to change notification settings - Fork 26
Trik Studio 3D Visualization #1526
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
Open
ladaegorova18
wants to merge
32
commits into
trikset:master
Choose a base branch
from
ladaegorova18:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
78e8957
added trajectory saving
ladaegorova18 861d908
Added net connection, trajectory serialization to json and pause/run …
21156a0
Removed .proto file
3d6e534
added net connection run/pause/restart from Unity, renamed trajectory…
710e851
added some comments, fixed tabulations
ac8c00e
Added sending run/pause/restart signals from TRIK Studio to Unity
53a413d
added checkBox sendData and comboBox UnityIp to additionalPreferences
cc7c592
fixed vera errors, added license
7a87218
Merged upstream/master
21400ba
lupdate
65e7037
added QT += network
64df440
renamed some variables to mVariables
5ef1af1
removed some empty strings
8688514
lupdate
c738a8f
added passing parameters by link
441910c
lupdate
8b6149b
added forward declarations
40b7ffd
changed lines length
169906c
lupdate
d0b13f5
renamed ConnectionToVizualizator -> ConnectionToVisualizer
5131260
added QScopedPointers, separated saving position and rotation
b3c21e3
added comments
0d5d1f1
changed lines length
c2c4e10
renamed ConnectionToVizualizator -> ConnectionToVisualizer
5989474
added QScopedPointers, separated saving position and rotation
45e25cf
added comments
6437234
rebased upstream/master
57566f2
Merge branch 'master' into master
ladaegorova18 56f96e2
lupdate
33286dd
removed sizeof(8)
3d94758
removed qcsopedpointers
f8d9ce5
added endState in the end of trajectory
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
| #include "twoDModel/engine/twoDModelDisplayWidget.h" | ||
|
|
||
| #include "twoDModel/twoDModelDeclSpec.h" | ||
| #include "plugins/robots/common/twoDModel/src/engine/trajectory/connectionToVizualizator.h" | ||
|
|
||
| class QComboBox; | ||
| class QPushButton; | ||
|
|
@@ -108,6 +109,7 @@ class TWO_D_MODEL_EXPORT TwoDModelWidget : public QWidget | |
| QDomDocument generateWorldModelWithBlobsXml() const; | ||
| QDomDocument generateWorldModelXml() const; | ||
| QDomDocument generateBlobsXml() const; | ||
| ConnectionToVizualizator *mConnToVizualizator; | ||
|
||
|
|
||
| public slots: | ||
| void zoomIn() override; | ||
|
|
@@ -129,6 +131,9 @@ public slots: | |
| /// Emitted when user has stopped intepretation from the 2D model window. | ||
| void stopButtonPressed(); | ||
|
|
||
| /// Emitted when user has stopped intepretation from the remote vizualizator | ||
| void restartRequested(); | ||
|
|
||
| protected: | ||
| void changeEvent(QEvent *e) override; | ||
| void showEvent(QShowEvent *e) override; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
|
|
@@ -32,6 +32,7 @@ | |
| #include "parts/box2DItem.h" | ||
|
|
||
| using namespace twoDModel::model::physics; | ||
|
|
||
| using namespace parts; | ||
| using namespace mathUtils; | ||
|
|
||
|
|
@@ -44,6 +45,7 @@ Box2DPhysicsEngine::Box2DPhysicsEngine (const WorldModel &worldModel | |
| , mWorld(new b2World(b2Vec2(0, 0))) | ||
| , mPrevPosition(b2Vec2(0, 0)) | ||
| , mPrevAngle(0) | ||
| , trajSaver(new TrajectorySaver(nullptr)) | ||
| { | ||
| connect(&worldModel, &model::WorldModel::wallAdded, | ||
| this, [this](const QSharedPointer<QGraphicsItem> &i) {itemAdded(i.data());}); | ||
|
|
@@ -53,6 +55,10 @@ Box2DPhysicsEngine::Box2DPhysicsEngine (const WorldModel &worldModel | |
| this, [this](const QSharedPointer<QGraphicsItem> &i) {itemAdded(i.data());}); | ||
| connect(&worldModel, &model::WorldModel::itemRemoved, | ||
| this, [this](const QSharedPointer<QGraphicsItem> &i) {itemRemoved(i.data());}); | ||
|
|
||
| connect(this, &Box2DPhysicsEngine::trajectoryPosOrAngleChanged, trajSaver, &TrajectorySaver::saveItemPosOrAngle); | ||
| connect(this, &Box2DPhysicsEngine::trajectoryItemDragged, trajSaver, &TrajectorySaver::onItemDragged); | ||
| connect(this, &Box2DPhysicsEngine::sendNextFrame, trajSaver, &TrajectorySaver::sendFrame); | ||
| } | ||
|
|
||
| Box2DPhysicsEngine::~Box2DPhysicsEngine(){ | ||
|
|
@@ -145,6 +151,16 @@ void Box2DPhysicsEngine::addRobot(model::RobotModel * const robot) | |
| }); | ||
|
|
||
| connect(robot, &model::RobotModel::deserialized, this, &Box2DPhysicsEngine::onMouseReleased); | ||
|
|
||
|
|
||
| connect(robot, &RobotModel::trajectorySoundStateChanged, trajSaver, &TrajectorySaver::saveBeepState); | ||
| connect(robot, &RobotModel::trajectoryMarkerColorChanged, trajSaver, &TrajectorySaver::saveMarkerState); | ||
| connect(robot, &RobotModel::trajectoryPosOrAngleChanged, trajSaver, &TrajectorySaver::saveItemPosOrAngle); | ||
| connect(robot, &RobotModel::trajectoryOnitemDragged, trajSaver, &TrajectorySaver::onItemDragged); | ||
|
|
||
| connect(robot, &RobotModel::trajectorySave, trajSaver, &TrajectorySaver::saveToFile); | ||
| // connect(robot, &RobotModel::OnStartPlaying, trajSaver, &TrajectorySaver::OnStartInterpretation); | ||
| connect(robot, &RobotModel::onStopPlaying, trajSaver, &TrajectorySaver::onStopInterpretation); | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -353,7 +369,10 @@ void Box2DPhysicsEngine::nextFrame() | |
| item->setPos(scenePos - item->boundingRect().center()); | ||
| item->setRotation(angleToScene(mBox2DDynamicItems[item]->getRotation())); | ||
| } | ||
| auto *abstractItem = dynamic_cast<graphicsUtils::AbstractItem *>(item); | ||
|
||
| emit trajectoryPosOrAngleChanged(abstractItem->id(), abstractItem->pos(), abstractItem->rotation()); | ||
| } | ||
| emit sendNextFrame(); | ||
| } | ||
|
|
||
| void Box2DPhysicsEngine::clearForcesAndStop() | ||
|
|
@@ -364,6 +383,7 @@ void Box2DPhysicsEngine::clearForcesAndStop() | |
| body->SetLinearVelocity({0, 0}); | ||
| body->SetAngularVelocity(0); | ||
| } | ||
| //emit trajectorySave(); | ||
| } | ||
|
|
||
| bool Box2DPhysicsEngine::isRobotStuck() const | ||
|
|
@@ -428,6 +448,7 @@ void Box2DPhysicsEngine::onItemDragged(graphicsUtils::AbstractItem *item) | |
| bItem->setRotation(0); | ||
| bItem->moveToPosition(positionToBox2D(localScenePos + localCenter)); | ||
| bItem->setRotation(angleToBox2D(localRotation)); | ||
| emit trajectoryItemDragged(item->id(), item->pos(), item->rotation()); | ||
| } | ||
| } else { | ||
| b2Vec2 pos = positionToBox2D(collidingPolygon.boundingRect().center()); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?