Revision: 8516
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8516&view=rev
Author:   rtv
Date:     2010-01-19 22:57:20 +0000 (Tue, 19 Jan 2010)

Log Message:
-----------
added support for non-zero start position for model_actuator, adapted from 
patch #2927857 from RAZOR

Modified Paths:
--------------
    code/stage/trunk/libstage/model_actuator.cc
    code/stage/trunk/libstage/stage.hh

Modified: code/stage/trunk/libstage/model_actuator.cc
===================================================================
--- code/stage/trunk/libstage/model_actuator.cc 2010-01-19 22:40:54 UTC (rev 
8515)
+++ code/stage/trunk/libstage/model_actuator.cc 2010-01-19 22:57:20 UTC (rev 
8516)
@@ -68,6 +68,7 @@
   max_speed(1), 
   min_position(0), 
   max_position(1),
+  start_position(0),
   control_mode( CONTROL_VELOCITY ),
   actuator_type( TYPE_LINEAR ),
   axis(0,0,0)
@@ -146,6 +147,35 @@
                min_position = wf->ReadFloat( wf_entity, "min_position", 0 );
        }
 
+       if( wf->PropertyExists( wf_entity, "start_position" ) )
+       {
+               start_position = wf->ReadFloat ( wf_entity, "start_position", 0 
);
+               
+               Pose desired_pose = InitialPose;
+               
+               switch (actuator_type)
+                 {
+                 case TYPE_LINEAR:
+                        {                               
+                               double cosa = cos(desired_pose.a);
+                               double sina = sin(desired_pose.a);
+                               
+                               desired_pose.x += (axis.x * cosa - axis.y * 
sina) * start_position;
+                               desired_pose.y += (axis.x * sina + axis.y * 
cosa) * start_position;
+                               desired_pose.z += axis.z * start_position;
+                               SetPose( desired_pose );
+                        } break;
+
+                 case TYPE_ROTATIONAL:
+                        {
+                               desired_pose.a += start_position;
+                               SetPose( desired_pose);
+                        }break;
+                       default:
+                         PRINT_ERR1( "unrecognized actuator type %d", 
actuator_type );
+                 }
+       }
+
 }
 
 void ModelActuator::Update( void  )

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2010-01-19 22:40:54 UTC (rev 8515)
+++ code/stage/trunk/libstage/stage.hh  2010-01-19 22:57:20 UTC (rev 8516)
@@ -2929,6 +2929,7 @@
         double max_speed;
         double min_position;
         double max_position;
+        double start_position;
         ControlMode control_mode;
         ActuatorType actuator_type;
         stg_point3_t axis;


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

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to