Commit bc4182c9 authored by roangel's avatar roangel
Browse files

changed from milimeters to meters in message. Also, now right button to move...

changed from milimeters to meters in message. Also, now right button to move around scene instead of wheel
parent b76458a0
......@@ -37,7 +37,7 @@ void crazyFly::updateCF(const CrazyflieData* p_crazyfly_msg)
m_yaw = p_crazyfly_msg->yaw;
m_pitch = p_crazyfly_msg->pitch;
m_roll = p_crazyfly_msg->roll;
this->setPos(m_x * FROM_MILIMETERS_TO_UNITS, -m_y * FROM_MILIMETERS_TO_UNITS); // - y because of coordinates
this->setPos(m_x * FROM_METERS_TO_UNITS, -m_y * FROM_METERS_TO_UNITS); // - y because of coordinates
this->setRotation(- m_yaw * FROM_RADIANS_TO_DEGREES); //negative beacause anti-clock wise should be positive
}
......
......@@ -76,6 +76,8 @@ void MainGUIWindow::_init()
ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
ui->graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
ui->graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scene = new myGraphicsScene(ui->frame_drawing);
scene->setSceneRect(-100 * FROM_METERS_TO_UNITS, -100 * FROM_METERS_TO_UNITS, 200 * FROM_METERS_TO_UNITS, 200 * FROM_METERS_TO_UNITS);
......@@ -121,7 +123,6 @@ void MainGUIWindow::updateNewViconData(const ptrToMessage& p_msg) //connected to
if(i >= markers_vector.size()) //some new markers coming
{
ROS_INFO_STREAM("element index: " << i << " added");
QPointF p(p_msg->markers[i].x * FROM_MILIMETERS_TO_UNITS, p_msg->markers[i].y * FROM_MILIMETERS_TO_UNITS);
Marker* tmp_p_marker = new Marker(&(p_msg->markers[i]));
markers_vector.push_back(tmp_p_marker); // what happens with the new indexes? check if this is correct
......
......@@ -26,7 +26,7 @@ void Marker::updateMarker(const UnlabeledMarker* p_marker_msg)
m_x = p_marker_msg->x;
m_y = p_marker_msg->y;
m_z = p_marker_msg->z;
this->setPos(m_x * FROM_MILIMETERS_TO_UNITS, -m_y * FROM_MILIMETERS_TO_UNITS); // - y because of coordinates
this->setPos(m_x * FROM_METERS_TO_UNITS, -m_y * FROM_METERS_TO_UNITS); // - y because of coordinates
}
......
......@@ -35,7 +35,7 @@ void myGraphicsView::wheelEvent(QWheelEvent *event)
void myGraphicsView::mousePressEvent(QMouseEvent *mouseEvent)
{
if (mouseEvent->button() == Qt::MiddleButton)
if (mouseEvent->button() == Qt::RightButton)
{
translation_mode = true;
tmp_point = new QPointF(mouseEvent->localPos());
......
......@@ -20,7 +20,7 @@
#include "d_fall_pps/ViconData.h"
#include "d_fall_pps/UnlabeledMarker.h"
// #define TESTING_FAKE_DATA
#define TESTING_FAKE_DATA
// notice that unit here are in milimeters
using namespace ViconDataStreamSDK::CPP;
......@@ -76,7 +76,7 @@ int main(int argc, char* argv[]) {
}
ros::Duration(0.1).sleep();
f += 10;
f += 10/1000.0f;
i++;
// TODO: Fake CF data
CrazyflieData crazyfly;
......@@ -88,8 +88,8 @@ int main(int argc, char* argv[]) {
viconData.crazyflies.push_back(crazyfly);
crazyfly.crazyflieName = "CF2";
crazyfly.x = 1000;
crazyfly.y = 1000;
crazyfly.x = 1;
crazyfly.y = 1;
crazyfly.z = 0;
crazyfly.yaw = -3.14159/600 * f;
viconData.crazyflies.push_back(crazyfly);
......@@ -97,8 +97,8 @@ int main(int argc, char* argv[]) {
if(i > 50 && i < 100)
{
crazyfly.crazyflieName = "CF3";
crazyfly.x = 1000;
crazyfly.y = -1000;
crazyfly.x = 1;
crazyfly.y = -1;
crazyfly.z = 0;
crazyfly.yaw = -3.14159/600 * f;
viconData.crazyflies.push_back(crazyfly);
......@@ -162,9 +162,9 @@ int main(int argc, char* argv[]) {
client.GetUnlabeledMarkerGlobalTranslation(unlabeledMarkerIndex);
marker.index = unlabeledMarkerIndex;
marker.x = OutputTranslation.Translation[0];
marker.y = OutputTranslation.Translation[1];
marker.z = OutputTranslation.Translation[2];
marker.x = OutputTranslation.Translation[0]/1000.0f;
marker.y = OutputTranslation.Translation[1]/1000.0f;
marker.z = OutputTranslation.Translation[2]/1000.0f;
viconData.markers.push_back(marker);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment