Skip to content

Commit

Permalink
now compiles without QMat
Browse files Browse the repository at this point in the history
  • Loading branch information
Esteban Martinena Guerrero committed May 8, 2022
1 parent 4790f98 commit 3822e0b
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 36 deletions.
1 change: 0 additions & 1 deletion api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ target_include_directories(dsr_api
PUBLIC
# Headers of DSR Core
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../core/include/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../qmat/include/>
# TODO: Don't like, try to fix
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../../classes/>
# Own include
Expand Down
1 change: 1 addition & 0 deletions api/include/dsr/api/dsr_agent_info_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <dsr/api/dsr_api.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <QtCore>

namespace DSR {

Expand Down
1 change: 0 additions & 1 deletion api/include/dsr/api/dsr_rt_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <cassert>
#include <QObject>
#include <qmat/QMatAll>
#include <dsr/core/topics/IDLGraphPubSubTypes.h>
#include <dsr/core/types/user_types.h>
#include <dsr/core/types/type_checking/dsr_attr_name.h>
Expand Down
1 change: 0 additions & 1 deletion core/include/dsr/core/types/type_checking/dsr_attr_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <dsr/core/types/crdt_types.h>
#include <dsr/core/types/user_types.h>
#include "type_checker.h"
#include <qmat/QMatAll>


// Attributes
Expand Down
1 change: 0 additions & 1 deletion gui/dsr_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <dsr/gui/dsr_gui.h>
#include <cppitertools/range.hpp>
#include <qmat/QMatAll>
#include <QDesktopWidget>
#include <QGLViewer/qglviewer.h>
#include <QApplication>
Expand Down
1 change: 0 additions & 1 deletion gui/include/dsr/gui/viewers/graph_viewer/graph_edge.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <cppitertools/zip.hpp>
#include <QLabel>
#include <dsr/gui/dsr_gui.h>
#include <qmat/QMatAll>
#include <QHeaderView>
#include <cppitertools/range.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ public slots:
const double &value_d = value * 180 / M_PI;
attrib_widgets[3 + pos]->setText(QString::number(value_d));
}
std::cout<<"print values"<<rotation.value()<<translation.value()<<std::endl;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gui/include/dsr/gui/viewers/osg_3d_viewer/osg_3d_viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace DSR


//std::map<std::string, IMVMesh> meshMap;
osg::Vec3 EigenToOSGVec(const Eigen::Vector3f &vec) const ;
osg::Vec3 QVecToOSGVec(const Eigen::Vector3f &vec) const ;
osg::Matrix QMatToOSGMat4(const Mat::RTMat &nodeB);
osg::Vec4 htmlStringToOsgVec4(const std::string &color);
osg::ref_ptr<osg::Group> createGraph();
Expand Down
1 change: 0 additions & 1 deletion gui/viewers/graph_viewer/graph_edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <dsr/gui/viewers/graph_viewer/graph_edge.h>
#include <dsr/gui/viewers/graph_viewer/graph_node.h>
#include <qmath.h>
#include <QPainter>
#include <QDebug>
#include <dsr/gui/dsr_gui.h>
Expand Down
11 changes: 6 additions & 5 deletions gui/viewers/graph_viewer/graph_viewer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <dsr/gui/dsr_gui.h>
#include <cppitertools/range.hpp>
#include <qmat/QMatAll>
#include <QTableWidget>
#include <QApplication>
#include <dsr/gui/viewers/graph_viewer/graph_node.h>
Expand Down Expand Up @@ -168,10 +167,12 @@ void GraphViewer::add_or_assign_node_SLOT(uint64_t id, const std::string &type)
posx = G->get_attrib_by_name<pos_x_att>(n.value()).value_or(10);
posy = G->get_attrib_by_name<pos_y_att>(n.value()).value_or(10);
}
catch (const std::exception &e) {
auto rd = QVec::uniformVector(2, -200, 200);
posx = rd.x();
posy = rd.y();
catch (const std::exception &e)
{
//auto rd = QVec::uniformVector(2, -200, 200);
auto rd = Eigen::Vector2f::Random(); // -1..1
posx = rd.x() * 200;
posy = rd.y() * 200;
}
// Avoid to move if it's in the same position or if the node is grabbed
if ((posx != gnode->x() or posy != gnode->y()) and gnode != scene.mouseGrabberItem()) {
Expand Down
36 changes: 14 additions & 22 deletions gui/viewers/osg_3d_viewer/osg_3d_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,19 @@ void OSG3dViewer::setMainCamera(osgGA::TrackballManipulator *manipulator, Camer
switch(pov)
{
case TOP_POV:
mRot.makeRotate(-M_PI_2, EigenToOSGVec(Eigen::Vector3f(1,0,0)));
mRot.makeRotate(-M_PI_2, QVecToOSGVec(Eigen::Vector3f(1,0,0)));
break;
case BACK_POV:
mRot.makeRotate(M_PI_2, EigenToOSGVec(Eigen::Vector3f(0,0,0)));
mRot.makeRotate(M_PI_2, QVecToOSGVec(Eigen::Vector3f(0,0,0)));
break;
case FRONT_POV:
mRot.makeRotate(M_PI, EigenToOSGVec(Eigen::Vector3f(0,1,0)));
mRot.makeRotate(M_PI, QVecToOSGVec(Eigen::Vector3f(0,1,0)));
break;
case LEFT_POV:
mRot.makeRotate(M_PI_2, EigenToOSGVec(Eigen::Vector3f(0,-1,0)));
mRot.makeRotate(M_PI_2, QVecToOSGVec(Eigen::Vector3f(0,-1,0)));
break;
case RIGHT_POV:
mRot.makeRotate(M_PI_2, EigenToOSGVec(Eigen::Vector3f(0,1,0)));
mRot.makeRotate(M_PI_2, QVecToOSGVec(Eigen::Vector3f(0,1,0)));
break;
default:
qFatal("InnerModelViewer: invalid POV.");
Expand Down Expand Up @@ -323,7 +323,8 @@ void OSG3dViewer::add_or_assign_box(const Node &node, const Node& parent)
// Create object
if( auto anterior = osg_map.find(std::make_tuple(node.id(), node.id())); anterior == osg_map.end())
{
osg::Box *box = new osg::Box(EigenToOSGVec(Eigen::Vector3f(0,0,0)), width.value(), height.value(), depth.value());
osg::Box *box = new osg::Box(QVecToOSGVec(Eigen::Vector3f(0,0,0)), width.value(), height.value(), depth.value());

osg::ShapeDrawable *plane_drawable = new osg::ShapeDrawable(box);
osg::Geode *geode = new osg::Geode;
geode->addDrawable(plane_drawable);
Expand Down Expand Up @@ -431,27 +432,18 @@ void OSG3dViewer::add_or_assign_mesh(const Node &node, const Node& parent)
//////// Auxiliary methods
/////////////////////////////////////////////////////////////

osg::Vec3 OSG3dViewer::EigenToOSGVec(const Eigen::Vector3f &vec) const
osg::Vec3 OSG3dViewer::QVecToOSGVec(const Eigen::Vector3f &vec) const
{
//return osg::Vec3(vec(0), vec(1), -vec(2));
return osg::Vec3(vec(0), -vec(1), -vec(2));

}



osg::Matrix OSG3dViewer::QMatToOSGMat4(const Mat::RTMat &nodeB)
{
//QVec angles = nodeB.extractAnglesR();
//Mat::Rot3D angles = nodeB.rotation();
//QVec t = nodeB.getTr();
//auto t = nodeB.translation();
//RTMat node = RTMat(-angles(0), -angles(1), angles(2), QVec::vec3(t(0), t(1), -t(2)));
Mat::RTMat node(nodeB); /*node(Eigen::Translation3d(t(0), -t(1), -t(2))*
Eigen::AngleAxisd(angles(0), Eigen::Vector3d::UnitX()) *
Eigen::AngleAxisd(-angles(1), Eigen::Vector3d::UnitY()) *
Eigen::AngleAxisd(-angles(2), Eigen::Vector3d::UnitZ()));*/

//RTMat node =RTMat(angles(0), -angles(1), -angles(2), QVec::vec3(t(0), -t(1), -t(2)));

Mat::RTMat node(nodeB);
return osg::Matrixd( node(0,0), node(1,0), node(2,0), node(3,0),
node(0,1), node(1,1), node(2,1), node(3,1),
node(0,2), node(1,2), node(2,2), node(3,2),
Expand All @@ -472,19 +464,19 @@ osg::Vec4 OSG3dViewer::htmlStringToOsgVec4(const std::string &color)

void OSG3dViewer::draw_axis()
{
osg::Box *box = new osg::Box(EigenToOSGVec(Eigen::Vector3f(500,0,0)), 1000, 10, 10);
osg::Box *box = new osg::Box(QVecToOSGVec(Eigen::Vector3f(500,0,0)), 1000, 10, 10);
osg::ShapeDrawable *plane_drawable = new osg::ShapeDrawable(box);
osg::Geode *geode = new osg::Geode;
geode->addDrawable(plane_drawable);
plane_drawable->setColor(htmlStringToOsgVec4("#FF0000"));
root->addChild(geode);
box = new osg::Box(EigenToOSGVec(Eigen::Vector3f(0,500,0)), 10, 1000, 10);
box = new osg::Box(QVecToOSGVec(Eigen::Vector3f(0,500,0)), 10, 1000, 10);
plane_drawable = new osg::ShapeDrawable(box);
geode = new osg::Geode;
geode->addDrawable(plane_drawable);
plane_drawable->setColor(htmlStringToOsgVec4("#00FF00"));
root->addChild(geode);
box = new osg::Box(EigenToOSGVec(Eigen::Vector3f(0,0,500)), 10, 10, 1000);
box = new osg::Box(QVecToOSGVec(Eigen::Vector3f(0,0,500)), 10, 10, 1000);
plane_drawable = new osg::ShapeDrawable(box);
geode = new osg::Geode;
geode->addDrawable(plane_drawable);
Expand Down
1 change: 0 additions & 1 deletion gui/viewers/tree_viewer/tree_viewer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <dsr/gui/dsr_gui.h>
#include <cppitertools/range.hpp>
#include <qmat/QMatAll>
#include <QTreeWidget>
#include <dsr/gui/viewers/graph_viewer/graph_node.h>
#include <dsr/gui/viewers/graph_viewer/graph_edge.h>
Expand Down

0 comments on commit 3822e0b

Please sign in to comment.