[TeamTalk 39]: [576] TeamTalk: 1) Bug: turn reporting reports wrong direction: fixed

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Fri Apr 13 17:15:13 EDT 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070413/8c97bc52/attachment.html
-------------- next part --------------
Modified: TeamTalk/Agents/PrimitiveComm/robot_client.cpp
===================================================================
--- TeamTalk/Agents/PrimitiveComm/robot_client.cpp	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Agents/PrimitiveComm/robot_client.cpp	2007-04-13 21:15:12 UTC (rev 576)
@@ -68,7 +68,7 @@
         warn << "couldn't reconnect to " << me->getHost() << ':' << me->getPort() << endl;
       }
  		}
-		if(me->hasCamera()) { //send image request every second
+		if(!(t%3) && me->hasCamera()) { //send image request every 3 seconds
       me->sendReqImage();
 		}
 	}

Modified: TeamTalk/Agents/TeamTalkBackend/agent.cpp
===================================================================
--- TeamTalk/Agents/TeamTalkBackend/agent.cpp	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Agents/TeamTalkBackend/agent.cpp	2007-04-13 21:15:12 UTC (rev 576)
@@ -377,24 +377,29 @@
 void Agent::SendMoveStatusToDM(const MsgCmdGoTo* move) const {
   ostringstream move_report;
   if(move->useAngle()) {
-    move_report << "Turn in place";
-    float angle = abs(fmodf(move->getAngle(), 2*(float)PI));
-    const float tol = (float)PI/8;
-    if(angle < PI-tol/2) move_report << " right";
-    else if(angle > PI+tol/2) move_report << " left";
-    move_report << ' ' << (int)(angle*180/PI) << " degrees";
+    move_report << "Turn ";
+    float angle = 
+      fmodf(fmodf(move->getAngle(), 2*(float)PI)+2*(float)PI, 2*(float)PI)-(float)PI;
+    const float tol = (float)PI/16;
+    if(angle < tol)
+      move_report << " left " << (int)round((angle+PI)*180/PI) << " degrees";
+    else if(angle > tol)
+      move_report << " right " << (int)round((PI-angle)*180/PI) << " degrees";
+    else
+      move_report << "around";
   } else if(move->isAbsolute()) {
     move_report << "Movement to " << (int)move->getX() << ' ' << (int)move->getY();
   } else { 
     move_report << "Movement";
     float angle = (float)Point<float>(move->getX(), move->getY()).angle();
-    int cardinal = (int)((fmodf(angle + (float)PI/4, (float)PI)+PI)*2/PI);
+    int cardinal = (int)(fmodf(fmodf(angle + (float)PI/4, 2*(float)PI)+2*(float)PI, 2*(float)PI)*2/PI);
     debug << angle << ' ' << angle + (float)PI/4 << ' ' << fmodf(angle + (float)PI/4, (float)PI) 
-      << ' ' << fmodf(angle + (float)PI/4, (float)PI)  
-      << ' ' << fmodf(angle + (float)PI/4, (float)PI)+PI
-      << ' ' << (fmodf(angle + (float)PI/4, (float)PI)+PI)*2/PI 
+      << ' ' << fmodf(angle + (float)PI/4, 2*(float)PI)  
+      << ' ' << fmodf(angle + (float)PI/4, 2*(float)PI)+2*PI
+      << ' ' << fmodf(fmodf(angle + (float)PI/4, 2*(float)PI)+2*(float)PI, 2*(float)PI) 
+      << ' ' << fmodf(fmodf(angle + (float)PI/4, 2*(float)PI)+2*(float)PI, 2*(float)PI)*2/PI
       << ' ' << cardinal << endl;
-    const char* dir[4] = {" backward", " to the right", " forward", " to the left"};
+    const char* dir[4] = {" forward", " to the left", " backward", " to the right"};
     move_report << ' ' << dir[cardinal];
     float distance = round((float)Point<float>(move->getX(), move->getY()).length()*10)/10;
     int major_d = (int)distance;
@@ -728,4 +733,4 @@
 const TeamTalk::RobotClient* Agent::getRobotClient() const {return robotClient_;}
 
 bool Agent::operator<(const Agent& rhs) const {return name_ < rhs.name_;}
-bool Agent::operator==(const Agent& rhs) const {return name_ == rhs.name_;}
\ No newline at end of file
+bool Agent::operator==(const Agent& rhs) const {return name_ == rhs.name_;}

Modified: TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp
===================================================================
--- TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp	2007-04-13 21:15:12 UTC (rev 576)
@@ -1,5 +1,7 @@
 #include "robot-galaxy_adapter.h"
 
+#include <win32dep.h>
+
 #include <fstream>
 
 //adds undiscoverable robots from a file
@@ -251,8 +253,9 @@
     r_client = new TeamTalk::RobotsClient("tester");
     vector<string> names = processPeerfile("peerfile.txt");
     if(!testLastConfig("peerfile.txt", 
-      "..\\..\\Resources\\DecoderConfig\\LanguageModel\\zap2LM.arpa")) 
+      "..\\..\\Resources\\DecoderConfig\\LanguageModel\\TeamTalkLM.arpa")) {
       addRobotNamesToGrammar(names);
+    }
     if(!m_client->isConnected()) {
       fatal << "mapserver not found" << endl;
     }	else if(!m_client->sendSubscribe(0)) {

Modified: TeamTalk/Agents/boeingLib/coralshared/win32dep.cc
===================================================================
--- TeamTalk/Agents/boeingLib/coralshared/win32dep.cc	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Agents/boeingLib/coralshared/win32dep.cc	2007-04-13 21:15:12 UTC (rev 576)
@@ -17,13 +17,4 @@
   return (0);
 }
 
-float round(float x) {
-  float major = floor(x);
-  float minor = x-major;
-  if(abs(minor >= 0.5))
-    if(major >=0) return major+1;
-    else return major-1;
-  else return major;
-}
-
 #endif

Modified: TeamTalk/Agents/boeingLib/coralshared/win32dep.h
===================================================================
--- TeamTalk/Agents/boeingLib/coralshared/win32dep.h	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Agents/boeingLib/coralshared/win32dep.h	2007-04-13 21:15:12 UTC (rev 576)
@@ -11,7 +11,15 @@
 #define sleep(x) Sleep(1000*(x))
 
 int gettimeofday (struct timeval *tv, void* tz);
-float round(float x);
+
+template<class C> C round(C x) {
+  C major = floor(x);
+  C minor = x-major;
+  if(abs(minor >= 0.5))
+    if(major >=0) return major+1;
+    else return major-1;
+  else return major;
+}
 
 #define _USE_MATH_DEFINES
 

Modified: TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-skeleton.pgm
===================================================================
--- TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-skeleton.pgm	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-skeleton.pgm	2007-04-13 21:15:12 UTC (rev 576)
@@ -1,7 +1,7 @@
 DOMAIN: cmu
 LOG_DIR: ..\..\logs
 
-TIMESTAMP: start_listening stop_listening set_lm setattr speak reset resetlast phoenixparse add_value choose_parse launch_query begin_session process_parse start_inactivity_timeout cancel_inactivity_timeout end_session new_session end_session increment_utterance nop goto_page notify_output_manager relay_input_source restart_decoder add_voice
+TIMESTAMP: start_listening stop_listening set_lm setattr speak reset resetlast restart_decoder add_value choose_parse launch_query begin_session process_parse start_inactivity_timeout cancel_inactivity_timeout end_session new_session end_session increment_utterance nop goto_page notify_output_manager relay_input_source restart_decoder add_voice
 
 ;; This is used as a toplevel subdir in LOG_DIR, if not specified
 ;; its default is "sls"
@@ -47,6 +47,16 @@
 INIT: :greeting "Welcome to the CMU zap2 1.0!"
 
 ;; -------------------------------------------------
+;; The phoenix server will parse utterances
+;; emitted by the sphinx server
+;; this is connected in the skeleton just to get the restart message
+;; -------------------------------------------------
+
+SERVER: phoenix at localhost:13000
+OPERATIONS: restart_decoder
+INIT: :greeting "Welcome to the %%DialogManager%%!"
+
+;; -------------------------------------------------
 ;; Backend - Server (gal_be)
 ;; -------------------------------------------------
 
@@ -154,10 +164,15 @@
 OUT:
 
 PROGRAM: restart_decoder
+
 RULE: --> sphinx.restart_decoder
 IN:
 OUT:
 
+RULE: --> phoenix.restart_decoder
+IN:
+OUT:
+
 PROGRAM: robot_config
 LOG_IN: :name :voice
 RULE: :voice --> kalliope.add_voice

Modified: TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-template.pgm
===================================================================
--- TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-template.pgm	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-template.pgm	2007-04-13 21:15:12 UTC (rev 576)
@@ -1,7 +1,7 @@
 DOMAIN: cmu
 LOG_DIR: ..\..\logs
 
-TIMESTAMP: start_listening stop_listening set_lm setattr speak reset resetlast phoenixparse add_value choose_parse launch_query begin_session process_parse start_inactivity_timeout cancel_inactivity_timeout end_session new_session end_session increment_utterance nop goto_page notify_output_manager relay_input_source restart_decoder
+TIMESTAMP: start_listening stop_listening set_lm setattr speak reset resetlast phoenixparse add_value choose_parse launch_query begin_session process_parse start_inactivity_timeout cancel_inactivity_timeout end_session new_session end_session increment_utterance nop goto_page notify_output_manager relay_input_source
 
 ;; This is used as a toplevel subdir in LOG_DIR, if not specified
 ;; its default is "sls"
@@ -52,7 +52,7 @@
 ;; -------------------------------------------------
 
 SERVER: phoenix at localhost:13000
-OPERATIONS: phoenixparse restart_decoder
+OPERATIONS: phoenixparse
 INIT: :greeting "Welcome to the %%DialogManager%%!"
 
 ;; -------------------------------------------------
@@ -224,11 +224,6 @@
 IN:
 OUT: destroy!
 
-PROGRAM: restart_decoder
-RULE: --> phoenix.restart_decoder
-IN:
-OUT:
-
 PROGRAM: robot_message
 
 ;;RULE: :goal | --> PenDecoder.speak

Modified: TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config
===================================================================
--- TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config	2007-04-13 21:15:12 UTC (rev 576)
@@ -33,7 +33,7 @@
 PROCESS: $BIN\NlgServer2.exe -maxconns 6 -nlghost localhost
 PROCESS_TITLE: NLGServer
 
-PROCESS: $BIN\phoenix2.exe -maxconns 6 -grammardir $GRAMMAR -grammarfn $GRAMMAR\zap2.net
+PROCESS: $BIN\phoenix2.exe -maxconns 6 -grammardir $GRAMMAR -grammarfn $GRAMMAR\TeamTalk.net
 PROCESS_TITLE: Phoenix
 
 PROCESS: $BIN\Audio_Server-DEBUG.exe -maxconns 6 -sps 16000 -engine_list sphinx_engines.txt

Modified: TeamTalk/Resources/Grammar/cmp.bat
===================================================================
--- TeamTalk/Resources/Grammar/cmp.bat	2007-04-06 20:09:41 UTC (rev 575)
+++ TeamTalk/Resources/Grammar/cmp.bat	2007-04-13 21:15:12 UTC (rev 576)
@@ -1,6 +1,6 @@
-'copy Generic.gra + TeamTalkTask.gra TeamTalk.gra
+REM copy Generic.gra + TeamTalkTask.gra TeamTalk.gra
 copy TeamTalkTask.gra TeamTalk.gra
-'copy Generic.forms + TeamTalkTask.forms forms
+REM copy Generic.forms + TeamTalkTask.forms forms
 copy TeamTalkTask.forms forms
 perl mk_nets2.pl TeamTalk.gra
 compile -g . -f TeamTalk > log


More information about the TeamTalk-developers mailing list