diff -Nru rcsnao2d-0.0.1/ConnectionManager.cpp rcsnao2d-0.0.2/ConnectionManager.cpp --- rcsnao2d-0.0.1/ConnectionManager.cpp 2010-11-30 19:11:51.000000000 +0000 +++ rcsnao2d-0.0.2/ConnectionManager.cpp 2011-04-07 11:41:30.000000000 +0000 @@ -40,22 +40,26 @@ void ConnectionManager::Connect(rcss::net::Addr addr) { - if ( socket.connect(addr) ) +// if(!socket.isOpen()) socket.open(); + + bool yy = socket.connect(addr); + if ( yy ) conn = true; } -void ConnectionManager::Reconnect() +void ConnectionManager::Reconnect(rcss::net::Addr addr) { - rcss::net::Addr peer = socket.getPeer(); +// rcss::net::Addr peer = socket.getPeer(); Disconnect(); socket.open(); - Connect(peer); + Connect(addr); } void ConnectionManager::Disconnect() { conn = false; socket.close(); + } void ConnectionManager::Send(string msg) diff -Nru rcsnao2d-0.0.1/ConnectionManager.h rcsnao2d-0.0.2/ConnectionManager.h --- rcsnao2d-0.0.1/ConnectionManager.h 2010-11-30 19:11:51.000000000 +0000 +++ rcsnao2d-0.0.2/ConnectionManager.h 2011-04-07 11:26:30.000000000 +0000 @@ -43,7 +43,7 @@ virtual ~ConnectionManager(); void Connect(rcss::net::Addr addr); - void Reconnect(); + void Reconnect(rcss::net::Addr addr); void Disconnect(); void Send(std::string msg); std::string Receive(); diff -Nru rcsnao2d-0.0.1/debian/changelog rcsnao2d-0.0.2/debian/changelog --- rcsnao2d-0.0.1/debian/changelog 2010-12-03 10:23:55.000000000 +0000 +++ rcsnao2d-0.0.2/debian/changelog 2011-04-19 07:05:42.000000000 +0000 @@ -1,5 +1,5 @@ -rcsnao2d (0.0.1-1lucid) lucid; urgency=high +rcsnao2d (0.0.2-5lucid1) lucid; urgency=low - * Initial release + * x64 problem2 - -- Hossein Ansari Fri, 03 Dec 2010 13:05:13 +0330 + -- Hossein Ansari Tue, 19 Apr 2011 09:45:09 +0430 diff -Nru rcsnao2d-0.0.1/debian/control rcsnao2d-0.0.2/debian/control --- rcsnao2d-0.0.1/debian/control 2010-12-03 10:03:58.000000000 +0000 +++ rcsnao2d-0.0.2/debian/control 2011-04-07 14:37:09.000000000 +0000 @@ -2,14 +2,12 @@ Section: devel Priority: extra Maintainer: Hossein Ansari -Build-Depends: debhelper (>= 7.0.50~), simspark-dev , libqt4-dev +Build-Depends: debhelper (>= 7.0.50~), libqt4-dev, qt4-qmake ,simspark-dev Standards-Version: 3.8.4 -Homepage: http://huri.ir/rcsnao2d/ +Homepage: http://huri.ir/rcsnao2d Package: rcsnao2d Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Description: A 2d monitor for robocup 3D soccer simulation server. - rcsNao2D is program created to focus on - team strategies and easiness of controlling game. - debian package:http://robocup.allafiha.com +Description: a 2D monitor for robocup 3D soccer simulation + a 2D monitor for robocup 3D soccer simulation diff -Nru rcsnao2d-0.0.1/debian/copyright rcsnao2d-0.0.2/debian/copyright --- rcsnao2d-0.0.1/debian/copyright 2010-12-03 09:50:10.000000000 +0000 +++ rcsnao2d-0.0.2/debian/copyright 2011-04-07 11:58:36.000000000 +0000 @@ -1,26 +1,28 @@ This work was packaged for Debian by: - Hossein Ansari on Fri, 03 Dec 2010 13:05:13 +0330 + Hossein Ansari on Thu, 07 Apr 2011 16:28:33 +0430 It was downloaded from: - http://huri.ir/rcsnao2d + Upstream Author(s): - Mohammad Razeghi + + Copyright: - Mohammad Razeghi + + License: - GPL v3 + The Debian packaging is: - Copyright (C) 2010 Hossein Ansari + Copyright (C) 2011 Hossein Ansari # Please chose a license for your packaging work. If the program you package # uses a mainstream license, using the same license is the safest choice. diff -Nru rcsnao2d-0.0.1/debian/patches/debian-changes-0.0.1-3maverick rcsnao2d-0.0.2/debian/patches/debian-changes-0.0.1-3maverick --- rcsnao2d-0.0.1/debian/patches/debian-changes-0.0.1-3maverick 2010-12-03 10:23:32.000000000 +0000 +++ rcsnao2d-0.0.2/debian/patches/debian-changes-0.0.1-3maverick 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -Description: Upstream changes introduced in version 0.0.1-3maverick - This patch has been created by dpkg-source during the package build. - Here's the last changelog entry, hopefully it gives details on why - those changes were made: - . - rcsnao2d (0.0.1-3maverick) maverick; urgency=high - . - * Initial release - . - The person named in the Author field signed this changelog entry. -Author: Hossein Ansari - ---- -The information above should follow the Patch Tagging Guidelines, please -checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here -are templates for supplementary fields that you might want to add: - -Origin: , -Bug: -Bug-Debian: http://bugs.debian.org/ -Bug-Ubuntu: https://launchpad.net/bugs/ -Forwarded: -Reviewed-By: -Last-Update: - ---- rcsnao2d-0.0.1.orig/README -+++ rcsnao2d-0.0.1/README -@@ -1,6 +1,6 @@ - rcsNao2D README - --Please See NEWS . -+Please See NEWS. - - rcsNao2D is program created to focus on - team strategies and easiness of controlling game. diff -Nru rcsnao2d-0.0.1/debian/patches/debian-changes-0.0.2-1 rcsnao2d-0.0.2/debian/patches/debian-changes-0.0.2-1 --- rcsnao2d-0.0.1/debian/patches/debian-changes-0.0.2-1 1970-01-01 00:00:00.000000000 +0000 +++ rcsnao2d-0.0.2/debian/patches/debian-changes-0.0.2-1 2011-04-07 12:01:08.000000000 +0000 @@ -0,0 +1,67 @@ +Description: Upstream changes introduced in version 0.0.2-1 + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + rcsnao2d (0.0.2-1) unstable; urgency=low + . + * Initial release (Closes: #nnnn) + . + The person named in the Author field signed this changelog entry. +Author: Hossein Ansari + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- rcsnao2d-0.0.2.orig/monitor.cpp ++++ rcsnao2d-0.0.2/monitor.cpp +@@ -430,16 +430,39 @@ void Monitor::drawOtherLines(QPainter &p + QPointF sideDownLeft = scale(QPointF(-fieldLength/2.0,fieldWidth/2.0)); + QPointF sideDownRight = scale(QPointF(fieldLength/2.0,fieldWidth/2.0)); + ++ QPointF penaltyDownLeft = scale(QPointF(-fieldLength/2.0,penaltyWidth/2.0)); ++ QPointF penaltyDownRight = scale(QPointF(-fieldLength/2.0+penaltyLength,penaltyWidth/2.0)); ++ ++ QPointF penaltyUpLeft = scale(QPointF(-fieldLength/2.0,-penaltyWidth/2.0)); ++ QPointF penaltyUpRight = scale(QPointF(-fieldLength/2.0+penaltyLength,-penaltyWidth/2.0)); ++ ++ QPointF rPenaltyDownLeft = scale(-QPointF(-fieldLength/2.0,penaltyWidth/2.0)); ++ QPointF rPenaltyDownRight = scale(-QPointF(-fieldLength/2.0+penaltyLength,penaltyWidth/2.0)); ++ ++ QPointF rPenaltyUpLeft = scale(-QPointF(-fieldLength/2.0,-penaltyWidth/2.0)); ++ QPointF rPenaltyUpRight = scale(-QPointF(-fieldLength/2.0+penaltyLength,-penaltyWidth/2.0)); ++ ++ ++ + + paint.setPen(Qt::white); + + /// Left Side Of Fielde Drawing + paint.drawLine(centerUp,centerDown); ++ + paint.drawLine( sideUpLeft ,sideUpRight ); + paint.drawLine( sideDownLeft , sideDownRight); + paint.drawLine( sideUpLeft ,sideDownLeft ); + paint.drawLine( sideUpRight , sideDownRight); + ++ paint.drawLine(penaltyDownLeft,penaltyDownRight); ++ paint.drawLine(penaltyUpLeft,penaltyUpRight); ++ paint.drawLine(penaltyUpRight,penaltyDownRight); ++ ++ paint.drawLine(rPenaltyDownLeft,rPenaltyDownRight); ++ paint.drawLine(rPenaltyUpLeft,rPenaltyUpRight); ++ paint.drawLine(rPenaltyUpRight,rPenaltyDownRight); ++ + + /// + paint.drawEllipse(scale(QPointF(0,0)) , scaleX*centerRadius , scaleX*centerRadius ); diff -Nru rcsnao2d-0.0.1/debian/patches/debian-changes-0.0.2-4maverick rcsnao2d-0.0.2/debian/patches/debian-changes-0.0.2-4maverick --- rcsnao2d-0.0.1/debian/patches/debian-changes-0.0.2-4maverick 1970-01-01 00:00:00.000000000 +0000 +++ rcsnao2d-0.0.2/debian/patches/debian-changes-0.0.2-4maverick 2011-04-08 07:33:16.000000000 +0000 @@ -0,0 +1,63 @@ +Description: Upstream changes introduced in version 0.0.2-4maverick + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + rcsnao2d (0.0.2-4maverick) maverick; urgency=low + . + * Initial release + . + The person named in the Author field signed this changelog entry. +Author: Hossein Ansari + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- rcsnao2d-0.0.2.orig/monitor.cpp ++++ rcsnao2d-0.0.2/monitor.cpp +@@ -260,10 +260,11 @@ void Monitor::drawBall ( QPainter &paint + } + void Monitor::dropBall() + { ++ QPoint localCurser= ui->centralWidget->mapFromGlobal(QCursor::pos()); ++ + if ( sock.connected() ) + { +- QPointF drop_pos = invertScale(QCursor::pos()-QPointF(0,30));//-QPointF(borderSize,borderSize));// - geometry().topLeft() - center ; +-// drop_pos.set; ++ QPointF drop_pos = invertScale(localCurser); + stringstream ss ; + ss << "(ball (pos " << drop_pos.x() << " " << drop_pos.y() << " 0.045)(vel 0 0 0))" ; + sock.Send(ss.str()); +@@ -347,7 +348,7 @@ void Monitor::parseThing( string msg ) + str.push_back(' '); + } + +- int pos = str.find("team_left"); ++ unsigned int pos = str.find("team_left"); + string temp; + string he ; + stringstream ss ; +@@ -515,9 +516,11 @@ void Monitor::drawObjects ( QPainter &pa + + void Monitor::dropPlayer( int player ) + { ++ + if ( sock.connected() ) + { +- QPointF drop_pos = invertScale(QCursor::pos()-QPointF(0,30)); ++ QPoint localCurser= ui->centralWidget->mapFromGlobal(QCursor::pos()); ++ QPointF drop_pos = invertScale(localCurser); + stringstream ss; + if ( toggle == TEAM_Left ) + ss << "(agent (team Left)(unum " << player << ")(pos " << drop_pos.x() << " " << drop_pos.y() << " 0.45))" ; diff -Nru rcsnao2d-0.0.1/debian/patches/debian-changes-0.0.2-5maverick3 rcsnao2d-0.0.2/debian/patches/debian-changes-0.0.2-5maverick3 --- rcsnao2d-0.0.1/debian/patches/debian-changes-0.0.2-5maverick3 1970-01-01 00:00:00.000000000 +0000 +++ rcsnao2d-0.0.2/debian/patches/debian-changes-0.0.2-5maverick3 2011-04-19 07:03:58.000000000 +0000 @@ -0,0 +1,64 @@ +Description: Upstream changes introduced in version 0.0.2-5maverick3 + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + rcsnao2d (0.0.2-5maverick3) maverick; urgency=low + . + * x64 problem2 + . + The person named in the Author field signed this changelog entry. +Author: Hossein Ansari + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- rcsnao2d-0.0.2.orig/monitor.cpp ++++ rcsnao2d-0.0.2/monitor.cpp +@@ -65,7 +65,6 @@ Monitor::Monitor(QWidget *parent) : + + QPointF Monitor::scale(QPointF realPos){ + QPointF ret(center.x()+realPos.x()*scaleX,center.y()+realPos.y()*scaleY); +- + return ret; + } + +@@ -161,7 +160,6 @@ void Monitor::paintEvent(QPaintEvent */* + } + drawField(paint); + drawGoal(paint); +-// drawField(paint); + drawOtherLines(paint); + drawObjects ( paint , temp ) ; + paint.end(); +@@ -348,7 +346,7 @@ void Monitor::parseThing( string msg ) + str.push_back(' '); + } + +- unsigned int pos = str.find("team_left"); ++ size_t pos = str.find("team_left"); + string temp; + string he ; + stringstream ss ; +@@ -471,10 +469,8 @@ void Monitor::drawOtherLines(QPainter &p + paint.drawEllipse(scale(QPointF(0,0)) , scaleX*(centerRadius+0.01) ,scaleX*(centerRadius+0.01) ); + + paint.setBrush(Qt::white); +- paint.drawEllipse(scale(QPointF(0,0)) , 1 , 1 ); ++ paint.drawEllipse(scale(QPointF(0,0)) , 1 , 1 ); + +-// paint.drawEllipse(center , 0.05*z1 , 0.05*z1 ); +-// paint.drawLine( center + QPointF ( 0 , 6*z2 ) , center + QPointF ( 0 , -6*z2 ) ); + paint.drawLine(centerUp,centerDown); + + } diff -Nru rcsnao2d-0.0.1/debian/patches/series rcsnao2d-0.0.2/debian/patches/series --- rcsnao2d-0.0.1/debian/patches/series 2010-12-03 10:23:32.000000000 +0000 +++ rcsnao2d-0.0.2/debian/patches/series 2011-04-19 06:55:11.000000000 +0000 @@ -1 +1,3 @@ -debian-changes-0.0.1-3maverick +debian-changes-0.0.2-1 +debian-changes-0.0.2-4maverick +debian-changes-0.0.2-5maverick3 diff -Nru rcsnao2d-0.0.1/debian/README.Debian rcsnao2d-0.0.2/debian/README.Debian --- rcsnao2d-0.0.1/debian/README.Debian 2010-12-03 09:35:15.000000000 +0000 +++ rcsnao2d-0.0.2/debian/README.Debian 2011-04-07 11:58:36.000000000 +0000 @@ -3,4 +3,4 @@ - -- Hossein Ansari Fri, 03 Dec 2010 13:05:13 +0330 + -- Hossein Ansari Thu, 07 Apr 2011 16:28:33 +0430 diff -Nru rcsnao2d-0.0.1/debian/rules rcsnao2d-0.0.2/debian/rules --- rcsnao2d-0.0.1/debian/rules 2010-12-03 09:35:15.000000000 +0000 +++ rcsnao2d-0.0.2/debian/rules 2011-04-19 05:23:39.000000000 +0000 @@ -8,6 +8,19 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),64) + CXXFLAGS = -O2 -m64 + CFLAGS = -O2 -m64 + export CXXFLAGS CFLAGS + +else + CXXFLAGS = -O2 -m32 + CFLAGS = -O2 -m32 + export CXXFLAGS CFLAGS + +endif + %: dh $@ diff -Nru rcsnao2d-0.0.1/monitor.cpp rcsnao2d-0.0.2/monitor.cpp --- rcsnao2d-0.0.1/monitor.cpp 2010-12-03 07:47:29.000000000 +0000 +++ rcsnao2d-0.0.2/monitor.cpp 2011-04-07 11:29:09.000000000 +0000 @@ -9,6 +9,7 @@ #include #include #include +#include using namespace rcss::net; using namespace std; Monitor::Monitor(QWidget *parent) : @@ -18,7 +19,11 @@ ui->setupUi(this); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this , SLOT(update()) ); - timer->start(30); + +// connect(this,SIGNAL(repaint(),this,resize()); +// resize() + + timer->start(20); mode [0] = "beforeKickOff"; mode [1] = "KickOff_Left"; mode [2] = "KickOff_Right"; @@ -37,15 +42,52 @@ mode [15] ="free_kick_right"; m_con = false; toggle = TEAM_Left ; + + playerNo = 9; + fieldLength = 21.0; + fieldWidth = 14.0; + goalWidth = 2.1; + goalDepth = 0.3; + penaltyWidth = 3.9; + penaltyLength = 1.8; + monitorWidth = 400; + monitorLength = 600; + borderSize = 160; + borderField=1; + centerRadius=1; + center = QPointF((borderSize+monitorLength)/2.0,(borderSize+monitorWidth)/2.0); + scaleX = monitorLength / fieldLength; + scaleY = -monitorWidth / fieldWidth; + + + +} + +QPointF Monitor::scale(QPointF realPos){ + QPointF ret(center.x()+realPos.x()*scaleX,center.y()+realPos.y()*scaleY); + + return ret; +} + +QPointF Monitor::invertScale(QPointF scaledPos){ + QPointF ret((-center.x()+scaledPos.x())/scaleX,(-center.y()+scaledPos.y())/scaleY); + + return ret; +} + +void Monitor::resize() +{ + qDebug() << "salam"; } + void Monitor::updateAll() { - m_con = sock.connected(); - if ( m_con && ui->Connect->text()!= "Disconnect" ){ + + if ( sock.connected() ){ ui->Connect->setIcon(QIcon(":/pics/icons/disconnect.png")); ui->Connect->setText("Disconnect"); } - if ( !m_con && ui->Connect->text()!= "Connect" ){ + else{ ui->Connect->setIcon(QIcon(":/pics/icons/connect.png")); ui->Connect->setText("Connect"); } @@ -84,7 +126,7 @@ this->close(); } - for ( int i = 0 ; i < 6 ; i++ ) + for ( int i = 0 ; i < playerNo ; i++ ) { if ( event->text().toInt() == i+1 ) { @@ -104,7 +146,7 @@ vector temp; static int t = 1 ; t *= -1 ; - if ( m_con ) + if ( sock.connected() ) { str = sock.Receive(); temp = parse.parse(str); @@ -119,7 +161,7 @@ } drawField(paint); drawGoal(paint); - drawField(paint); +// drawField(paint); drawOtherLines(paint); drawObjects ( paint , temp ) ; paint.end(); @@ -132,18 +174,22 @@ void Monitor::on_Connect_clicked() { + try { - if ( !m_con ) + if ( !sock.connected() ) { string strHost = ui->Host->text().toStdString(); int port = ui->Port->text().toInt(); - sock.Connect(Addr(port,strHost)); + sock.Reconnect(Addr(port,strHost)); + usleep(100000); + m_con=true; } else { sock.Disconnect(); + usleep(100000); } } @@ -155,30 +201,26 @@ void Monitor::drawLeft (QPainter &paint , QPointF pos , double ang , int num ) { - QPointF center (335,250); - double z1 = 650.0 / 18.0 ; - double z2 = 400.0 / 12.0 ; - QPointF conv(pos.x()*z1,pos.y()*z2); + + QPointF conv=scale(pos); paint.setPen(Qt::darkYellow); paint.setBrush(Qt::darkRed); - paint.drawEllipse(center+conv , 8 , 8); + paint.drawEllipse(conv , 8 , 8); paint.setPen(Qt::white); - paint.drawLine(center+conv , center+conv + QPointF( 6*sin(gDegToRad(ang+180)) , 6*cos(gDegToRad(ang+180))) ); - paint.drawText( (center+conv).x()-4 , (center+conv).y()-2 , QString('0'+num) ); + paint.drawLine(conv , conv + QPointF( 6*sin(gDegToRad(ang+180)) , 6*cos(gDegToRad(ang+180))) ); + paint.drawText( (conv).x()-4 , (conv).y()-2 , QString('0'+num) ); } void Monitor::drawRight (QPainter &paint , QPointF pos , double ang , int num) { - QPointF center (335,250); - double z1 = 650.0 / 18.0 ; - double z2 = 400.0 / 12.0 ; - QPointF conv(pos.x()*z1,pos.y()*z2); + + QPointF conv=scale(pos); paint.setPen(Qt::darkRed); paint.setBrush(Qt::darkYellow); - paint.drawEllipse(center+conv , 8 , 8); + paint.drawEllipse(conv , 8 , 8); paint.setPen(Qt::white); - paint.drawLine(center+conv , center+conv + QPointF( 6*sin(gDegToRad(ang+180)) , 6*cos(gDegToRad(ang+180))) ); - paint.drawText( (center+conv).x()-4 , (center+conv).y()-2 , QString('0'+num) ); + paint.drawLine(conv , conv + QPointF( 6*sin(gDegToRad(ang+180)) , 6*cos(gDegToRad(ang+180))) ); + paint.drawText( (conv).x()-4 , (conv).y()-2 , QString('0'+num) ); } //// @@ -186,54 +228,42 @@ void Monitor::drawLeftF (QPainter &paint , QPointF pos , double ang, int num ) { - QPointF center (335,250); - double z1 = 650.0 / 18.0 ; - double z2 = 400.0 / 12.0 ; - QPointF conv(pos.x()*z1,pos.y()*z2); + QPointF conv=scale(pos); paint.setPen(Qt::darkYellow); paint.setBrush(QColor(QRgb(0xF78888))); - paint.drawEllipse(center+conv , 8 , 8); + paint.drawEllipse(conv , 8 , 8); paint.setPen(Qt::white); - paint.drawLine(center+conv , center+conv + QPointF( 6*sin(gDegToRad(ang+180)) , 6*cos(gDegToRad(ang+180))) ); - paint.drawText( (center+conv).x()-4 , (center+conv).y()-2 , QString('0'+num) ); + paint.drawLine(conv , conv + QPointF( 6*sin(gDegToRad(ang+180)) , 6*cos(gDegToRad(ang+180))) ); + paint.drawText( (conv).x()-4 , (conv).y()-2 , QString('0'+num) ); } void Monitor::drawRightF (QPainter &paint , QPointF pos , double ang , int num) { - QPointF center (335,250); - double z1 = 650.0 / 18.0 ; - double z2 = 400.0 / 12.0 ; - QPointF conv(pos.x()*z1,pos.y()*z2); + QPointF conv=scale(pos); paint.setPen(Qt::darkRed); paint.setBrush(QColor(QRgb(0xDCCF5F))); - paint.drawEllipse(center+conv , 8 , 8); + paint.drawEllipse(conv , 8 , 8); paint.setPen(Qt::white); - paint.drawLine(center+conv , center+conv + QPointF( 6*sin(gDegToRad(ang+180)) , 6*cos(gDegToRad(ang+180))) ); - paint.drawText( (center+conv).x()-4 , (center+conv).y()-2 , QString('0'+num) ); + paint.drawLine(conv , conv + QPointF( 6*sin(gDegToRad(ang+180)) , 6*cos(gDegToRad(ang+180))) ); + paint.drawText( (conv).x()-4 , (conv).y()-2 , QString('0'+num) ); } /// void Monitor::drawBall ( QPainter &paint , QPointF pos) { - QPointF center (335,250); - double z1 = 650.0 / 18.0 ; - double z2 = 400.0 / 12.0 ; - QPointF conv(pos.x()*z1,pos.y()*z2); + QPointF conv=scale(pos); paint.setPen(Qt::white); paint.setBrush(Qt::blue); - paint.drawEllipse(center+conv , 4.0 , 4.0); + paint.drawEllipse(conv , 4.0 , 4.0); } void Monitor::dropBall() { - if ( m_con ) + if ( sock.connected() ) { - QPointF center (335,250); - double z1 = 18.0/650.0 ; - double z2 = 12.0/400.0 ; - QPointF drop_pos = QCursor::pos() - geometry().topLeft() - center ; - drop_pos = QPointF ( drop_pos.x() * z1 , -drop_pos.y() * z2 ) ; + QPointF drop_pos = invertScale(QCursor::pos()-QPointF(0,30));//-QPointF(borderSize,borderSize));// - geometry().topLeft() - center ; +// drop_pos.set; stringstream ss ; ss << "(ball (pos " << drop_pos.x() << " " << drop_pos.y() << " 0.045)(vel 0 0 0))" ; sock.Send(ss.str()); @@ -247,26 +277,25 @@ void Monitor::drawGoal(QPainter &paint) { - QPointF center (335,250); - double z1 = 650.0 / 18.0 ; - double z2 = 400.0 / 12.0 ; - - QPointF LA2 ( -9.2 * z1 , 1.05 * z2 ); - QPointF RA2 ( 9.2 * z1 , 1.05 * z2 ); - QPointF LT1 ( -9 * z1 ,-1.05 * z2 ); - QPointF RT1 ( 9 * z1 ,-1.05 * z2 ); - QRectF goalL(center + LA2 ,center + LT1 ) ; - QRectF goalR(center + RA2 ,center + RT1 ) ; + QPointF LA2 =scale(QPointF(fieldLength/2+goalDepth,goalWidth/2)); + QPointF RA2 =scale(QPointF(fieldLength/2,-goalWidth/2));; + QPointF LT1 =scale(QPointF(-fieldLength/2-goalDepth,goalWidth/2));; + QPointF RT1 =scale(QPointF(-fieldLength/2,-goalWidth/2));; + +// qDebug() << LA2 << LT1 ; + QRectF goalL(LA2 ,RA2 ) ; + QRectF goalR(LT1 ,RT1 ) ; paint.setPen(Qt::white); paint.setBrush(Qt::yellow); paint.drawRect(goalL); paint.drawRect(goalR); + paint.setBrush(Qt::transparent); } void Monitor::kickOffLeft() { - if ( m_con ) + if ( sock.connected() ) { stringstream ss ; ss << "(kickOff Left)" ; @@ -280,7 +309,7 @@ void Monitor::kickOffRight() { - if ( m_con ) + if ( sock.connected() ) { stringstream ss ; ss << "(kickOff Right)" ; @@ -294,7 +323,7 @@ void Monitor::playOn() { - if ( m_con ) + if ( sock.connected() ) { stringstream ss ; ss << "(playMode PlayOn)" ; @@ -318,7 +347,7 @@ str.push_back(' '); } - unsigned int pos = str.find("team_left"); + int pos = str.find("team_left"); string temp; string he ; stringstream ss ; @@ -376,61 +405,61 @@ void Monitor::drawOtherLines(QPainter &paint) { - QPointF center (335,250); - double z1 = 650.0 / 18.0 ; - double z2 = 400.0 / 12.0 ; - // - // J2--------------------- J1 - // | | - // | | - // | | - //A2 |-------------------| A1 - // | | - // -------- - - QPointF J2 ( - 7.2 * z1 , 3.1 * z2 ); - QPointF J1 ( - 7.2 * z1 ,-3.1 * z2); - - QPointF A2 ( - 9 * z1 , 3.1 * z2 ); - QPointF A1 ( - 9 * z1 ,-3.1 * z2 ); - - - /// Right - QPointF LJ2 ( 7.2 * z1 , 3.1 * z2 ); - QPointF LJ1 ( 7.2 * z1 ,-3.1 * z2); + /* + + + sideUpLef centerUp sideUpRight + --------------------------------------------- + | | | + | | | + | | | + | | | + | | | + | | | + | | | + --------------------------------------------- + sideDownLef centerDown sideDownRight + + */ + QPointF centerUp = scale(QPointF(0,-fieldWidth/2.0)); + QPointF centerDown = scale(QPointF(0,fieldWidth/2.0)); + + QPointF sideUpLeft = scale(QPointF(-fieldLength/2.0,-fieldWidth/2.0)); + QPointF sideUpRight = scale(QPointF(fieldLength/2.0,-fieldWidth/2.0)); + + QPointF sideDownLeft = scale(QPointF(-fieldLength/2.0,fieldWidth/2.0)); + QPointF sideDownRight = scale(QPointF(fieldLength/2.0,fieldWidth/2.0)); - QPointF LA2 ( 9 * z1 , 3.1 * z2 ); - QPointF LA1 ( 9 * z1 ,-3.1 * z2 ); paint.setPen(Qt::white); /// Left Side Of Fielde Drawing - paint.drawLine( center+ J2 ,center + J1 ); - paint.drawLine( center + J2 , center + A2 ); - paint.drawLine( center + A1 , center + J1 ); - + paint.drawLine(centerUp,centerDown); + paint.drawLine( sideUpLeft ,sideUpRight ); + paint.drawLine( sideDownLeft , sideDownRight); + paint.drawLine( sideUpLeft ,sideDownLeft ); + paint.drawLine( sideUpRight , sideDownRight); - /// Right Side Of Fielde Drawing - paint.drawLine( center+ LJ2 ,center + LJ1 ); - paint.drawLine( center + LJ2 , center + LA2 ); - paint.drawLine( center + LA1 , center + LJ1 ); /// - paint.drawEllipse(center , 1.5*z1 , 1.5*z2 ); + paint.drawEllipse(scale(QPointF(0,0)) , scaleX*centerRadius , scaleX*centerRadius ); paint.setBrush(Qt::transparent); - paint.drawEllipse(center , 1.505*z1 , 1.505*z2 ); + paint.drawEllipse(scale(QPointF(0,0)) , scaleX*(centerRadius+0.01) ,scaleX*(centerRadius+0.01) ); paint.setBrush(Qt::white); - paint.drawEllipse(center , 0.05*z1 , 0.05*z1 ); - paint.drawLine( center + QPointF ( 0 , 6*z2 ) , center + QPointF ( 0 , -6*z2 ) ); + paint.drawEllipse(scale(QPointF(0,0)) , 1 , 1 ); + +// paint.drawEllipse(center , 0.05*z1 , 0.05*z1 ); +// paint.drawLine( center + QPointF ( 0 , 6*z2 ) , center + QPointF ( 0 , -6*z2 ) ); + paint.drawLine(centerUp,centerDown); } void Monitor::drawField(QPainter &paint) { - QPointF gushb ( 10 , 50); - QPointF gushp ( 660 , 450); + QPointF gushb =scale(QPointF(-fieldLength/2-borderField,-fieldWidth/2-borderField)); + QPointF gushp =scale(QPointF(fieldLength/2+borderField,fieldWidth/2+borderField)); QRectF field ( gushb , gushp ) ; paint.setPen(0x0021FF); paint.setBrush( QBrush(QColor(QRgb(0x3E974F))) ); @@ -439,11 +468,11 @@ void Monitor::drawObjects ( QPainter &paint, vector temp ) { - if ( m_con ) + if ( sock.connected() ) { for (unsigned int i = 0 ; i < temp.size() ; i++) { - QPointF pp(temp[i].pos.x(),-1*temp[i].pos.y()) ; + QPointF pp(temp[i].pos.x(),temp[i].pos.y()) ; if ( temp[i].team == 1 ) { if ( temp[i].pos.z() > 0.20 ) drawLeft( paint , pp , temp[i].rot.z() , temp[i].num ); @@ -457,19 +486,15 @@ drawRightF(paint , pp , temp[i].rot.z() , temp[i].num ); } } - drawBall(paint ,QPointF(parse.getBallPos().x(),-1*parse.getBallPos().y())); + drawBall(paint ,QPointF(parse.getBallPos().x(),parse.getBallPos().y())); } } void Monitor::dropPlayer( int player ) { - if ( m_con ) + if ( sock.connected() ) { - QPointF center (335,250); - double z1 = 18.0/650.0 ; - double z2 = 12.0/400.0 ; - QPointF drop_pos = QCursor::pos() - geometry().topLeft() - center ; - drop_pos = QPointF ( drop_pos.x() * z1 , -drop_pos.y() * z2 ) ; + QPointF drop_pos = invertScale(QCursor::pos()-QPointF(0,30)); stringstream ss; if ( toggle == TEAM_Left ) ss << "(agent (team Left)(unum " << player << ")(pos " << drop_pos.x() << " " << drop_pos.y() << " 0.45))" ; @@ -488,13 +513,13 @@ QMessageBox::about(this,qApp->tr("Help!") , qApp->tr( "rcsnao2d current keys are :\n\n" - " q : quit program" - " p: change playmode to playon \n" - " l: change playmode to KickOffLeft \n" - " r: changle playmode to kickOffRight \n" - " b: drop ball in mouse position \n" - " m: toggle current selected team \n" - " number 1...6 : drop player in current selected team \n" + " q : quit program\n" + " p: change playmode to playon \n" + " l: change playmode to KickOffLeft \n" + " r: changle playmode to kickOffRight \n" + " b: drop ball in mouse position \n" + " m: toggle current selected team \n" + " number 1...10 : move player in current selected team to mouse position\n" ) ); } diff -Nru rcsnao2d-0.0.1/monitor.h rcsnao2d-0.0.2/monitor.h --- rcsnao2d-0.0.1/monitor.h 2010-12-03 07:33:40.000000000 +0000 +++ rcsnao2d-0.0.2/monitor.h 2011-04-07 10:38:00.000000000 +0000 @@ -43,6 +43,25 @@ void dropPlayer(int player); private: + + int playerNo; + double fieldLength; + double fieldWidth; + double borderField; + double goalWidth; + double penaltyWidth; + double penaltyLength; + double monitorWidth; + double monitorLength; + double borderSize; + double goalDepth; + double centerRadius; + QPointF center; + double scaleX,scaleY; + QPointF scale(QPointF); + QPointF invertScale(QPointF); + + Ui::Monitor *ui; parser parse ; string t1 , t2 , mode [16] , cmode ; @@ -54,6 +73,7 @@ public slots: void on_Connect_clicked(); void on_help_clicked(); + void resize(); }; diff -Nru rcsnao2d-0.0.1/monitor.ui rcsnao2d-0.0.2/monitor.ui --- rcsnao2d-0.0.1/monitor.ui 2010-12-03 08:46:07.000000000 +0000 +++ rcsnao2d-0.0.2/monitor.ui 2011-04-07 10:01:41.000000000 +0000 @@ -6,8 +6,8 @@ 0 0 - 670 - 493 + 760 + 551 @@ -24,9 +24,9 @@ - 10 - 470 - 221 + 0 + 530 + 261 17 @@ -42,8 +42,8 @@ - 300 - 470 + 290 + 530 91 20 @@ -55,8 +55,8 @@ - 560 - 460 + 590 + 520 101 31 @@ -136,7 +136,7 @@ 580 10 - 71 + 87 34 diff -Nru rcsnao2d-0.0.1/NEWS rcsnao2d-0.0.2/NEWS --- rcsnao2d-0.0.1/NEWS 2010-12-01 15:13:43.000000000 +0000 +++ rcsnao2d-0.0.2/NEWS 2011-04-07 08:30:45.000000000 +0000 @@ -1,3 +1,6 @@ +[0.0.2] +fixed a bug in linux 64 + [0.0.1] This is first version of rcsNao2D . @@ -8,4 +11,4 @@ 3.you can change playmode to "playon" with "p" key . 4.you can change playmode to "KickOffLeft" by "l" . 5.you can change playmode to "KickOffRight" by "r" . -6.quiting program is possible by pressing "q" . \ No newline at end of file +6.quiting program is possible by pressing "q" . diff -Nru rcsnao2d-0.0.1/rcsNao2D.pro.user rcsnao2d-0.0.2/rcsNao2D.pro.user --- rcsnao2d-0.0.1/rcsNao2D.pro.user 1970-01-01 00:00:00.000000000 +0000 +++ rcsnao2d-0.0.2/rcsNao2D.pro.user 2011-04-07 11:43:14.000000000 +0000 @@ -0,0 +1,113 @@ + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + System + + + + ProjectExplorer.Project.Target.0 + + Desktop + Qt4ProjectManager.Target.DesktopTarget + 0 + 0 + + + qmake + QtProjectManager.QMakeBuildStep + + + + Make + Qt4ProjectManager.MakeStep + false + + + + 2 + + Make + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + /home/hp/robocup/server/rcsnao2d/rcsnao2d/temp/rcsNao2D-build-desktop + 6 + 0 + true + + + + qmake + QtProjectManager.QMakeBuildStep + + + + Make + Qt4ProjectManager.MakeStep + false + + + + 2 + + Make + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + /home/hp/robocup/server/rcsnao2d/rcsnao2d/temp/rcsNao2D-build-desktop + 6 + 0 + true + + 2 + + rcsNao2D + Qt4ProjectManager.Qt4RunConfiguration + 2 + + rcsNao2D.pro + false + false + + false + false + + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 4 + +