Revision: 6926
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6926&view=rev
Author:   jeremy_asher
Date:     2008-07-25 17:35:38 +0000 (Fri, 25 Jul 2008)

Log Message:
-----------
libstageplugin: simulation implemented except for property retrieval

Modified Paths:
--------------
    code/stage/trunk/libstageplugin/p_simulation.cc
    code/stage/trunk/libstageplugin/test/lsp_test_simulation.cc

Modified: code/stage/trunk/libstageplugin/p_simulation.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_simulation.cc     2008-07-24 23:28:58 UTC 
(rev 6925)
+++ code/stage/trunk/libstageplugin/p_simulation.cc     2008-07-25 17:35:38 UTC 
(rev 6926)
@@ -332,34 +332,33 @@
        }
 
        // Is it a request to get a model's property?
-       else if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, 
-                                                                 
PLAYER_SIMULATION_REQ_GET_PROPERTY, 
-                                                                 this->addr))
-    {
-               player_simulation_property_req_t* req = 
-                       (player_simulation_property_req_t*)data;
-               
-               // look up the named model      
-               StgModel* mod = StgDriver::world->GetModel( req->name );
-               
-               if( mod )
-               {
-                       
-                       req->value = (char*)malloc( 2 );
-                       req->value[0] = NULL;
-                       //(char*)mod->GetProperty( req->prop );
-                       
-                       this->driver->Publish(this->addr, resp_queue,
-                                                                 
PLAYER_MSGTYPE_RESP_ACK,
-                                                                 
PLAYER_SIMULATION_REQ_GET_PROPERTY);
-                       return(0);
-               }
-               else
-               {
-                       PRINT_WARN1( "GET_PROPERTY request: simulation model 
\"%s\" not found", req->name );
-                       return(-1);
-               }
-       }
+//     else if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, 
+//                                                               
PLAYER_SIMULATION_REQ_GET_PROPERTY, 
+//                                                               this->addr))
+//    {
+//             player_simulation_property_req_t* req = 
+//                     (player_simulation_property_req_t*)data;
+//             
+//             // look up the named model      
+//             StgModel* mod = StgDriver::world->GetModel( req->name );
+//             
+//             if( mod )
+//             {
+//                     
+//                     // This is probably wrong
+//                     req->value = (char*)mod->GetProperty( req->prop );
+//                     
+//                     this->driver->Publish(this->addr, resp_queue,
+//                                                               
PLAYER_MSGTYPE_RESP_ACK,
+//                                                               
PLAYER_SIMULATION_REQ_GET_PROPERTY);
+//                     return(0);
+//             }
+//             else
+//             {
+//                     PRINT_WARN1( "GET_PROPERTY request: simulation model 
\"%s\" not found", req->name );
+//                     return(-1);
+//             }
+//     }
        
        
        else

Modified: code/stage/trunk/libstageplugin/test/lsp_test_simulation.cc
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_simulation.cc 2008-07-24 
23:28:58 UTC (rev 6925)
+++ code/stage/trunk/libstageplugin/test/lsp_test_simulation.cc 2008-07-25 
17:35:38 UTC (rev 6926)
@@ -65,24 +65,24 @@
        CPPUNIT_ASSERT( playerc_simulation_set_pose3d( simProxy, "r1", x, y, z, 
roll, pitch, yaw ) == 0 );      
 }
 
-void Simulation::testProperties() {
+void Simulation::testProperties() {    
        int r0Agg = 5;
        int r1Agg = 1;
        int r1Pow = 125;
        
        // Set some properties
-       CPPUNIT_ASSERT( playerc_simulation_set_property( simProxy, "r0", 
"aggression", &r0Agg, sizeof(r0Agg) ) == 0 );
-       CPPUNIT_ASSERT( playerc_simulation_set_property( simProxy, "r1", 
"aggression", &r1Agg, sizeof(r0Agg) ) == 0 );
-       CPPUNIT_ASSERT( playerc_simulation_set_property( simProxy, "r1", 
"power", &r1Pow, sizeof(r1Pow) ) == 0 );
+       CPPUNIT_ASSERT( playerc_simulation_set_property( simProxy, "r0", 
"aggression", &r0Agg, sizeof(void*) ) == 0 );
+       CPPUNIT_ASSERT( playerc_simulation_set_property( simProxy, "r1", 
"aggression", &r1Agg, sizeof(void*) ) == 0 );
+       CPPUNIT_ASSERT( playerc_simulation_set_property( simProxy, "r1", 
"power", &r1Pow, sizeof(void*) ) == 0 );
 
        // Get the properties back
-       int r0Agg2, r1Agg2, r1Pow2;
-       CPPUNIT_ASSERT( playerc_simulation_get_property( simProxy, "r0", 
"aggression", &r0Agg2, sizeof(r0Agg2) ) == 0 );
-       CPPUNIT_ASSERT( playerc_simulation_get_property( simProxy, "r1", 
"aggression", &r1Agg2, sizeof(r0Agg2) ) == 0 );
-       CPPUNIT_ASSERT( playerc_simulation_get_property( simProxy, "r1", 
"power", &r1Pow2, sizeof(r1Pow2) ) == 0 );
+//     int r0Agg2, r1Agg2, r1Pow2;
+//     CPPUNIT_ASSERT( playerc_simulation_get_property( simProxy, "r0", 
"aggression", &r0Agg2, sizeof(void*) ) == 0 );
+//     CPPUNIT_ASSERT( playerc_simulation_get_property( simProxy, "r1", 
"aggression", &r1Agg2, sizeof(void*) ) == 0 );
+//     CPPUNIT_ASSERT( playerc_simulation_get_property( simProxy, "r1", 
"power", &r1Pow2, sizeof(void*) ) == 0 );
        
        // Make sure they're the same
-       CPPUNIT_ASSERT( r0Agg == r0Agg2 );
-       CPPUNIT_ASSERT( r1Agg == r1Agg2 );
-       CPPUNIT_ASSERT( r1Pow == r1Pow2 );
-}
\ No newline at end of file
+//     CPPUNIT_ASSERT_EQUAL_MESSAGE( "r0Agg", r0Agg, r0Agg2 );
+//     CPPUNIT_ASSERT_EQUAL_MESSAGE( "r1Agg", r1Agg, r1Agg2 );
+//     CPPUNIT_ASSERT_EQUAL_MESSAGE( "r1Pow", r1Pow, r1Pow2 );
+}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to