Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Implement Get/Set GlobalVelocity, needed by stageros. #23

Merged
merged 1 commit into from

2 participants

@gerkey

... implement them (taking the impelementation from Stage 3.2.2). Also, squash an unused var warning

Brian Gerkey Move SetGlobalVelocity() and GetGlobalVelocity() into ModelPosition, …
…and implement them (taking the impelementation from Stage 3.2.2). Also, squash an unused var warning
a879cca
@rtv rtv merged commit cffb7bf into from
@rtv
Owner
rtv commented

Are you working on finishing up the rolling of modern Stage into ROS for another release?

@gerkey

Yep, aiming for 4.x to be released with ROS Fuerte. Deadline for that is feature freeze on March 15th.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 15, 2012
  1. Move SetGlobalVelocity() and GetGlobalVelocity() into ModelPosition, …

    Brian Gerkey authored
    …and implement them (taking the impelementation from Stage 3.2.2). Also, squash an unused var warning
This page is out of date. Refresh to see the latest.
View
2  libstage/blockgroup.cc
@@ -169,7 +169,7 @@ static void combineCallback(GLdouble coords[3],
// render each block as a polygon extruded into Z
void BlockGroup::BuildDisplayList()
{
- static bool init = false;
+ //static bool init = false;
static GLUtesselator *tobj = NULL;
if( ! mod.world->IsGUI() )
View
32 libstage/model_position.cc
@@ -158,6 +158,38 @@ void ModelPosition::SetVelocity( const Velocity& val )
CallCallbacks( CB_VELOCITY );
}
+// get the model's velocity in the global frame
+Velocity ModelPosition::GetGlobalVelocity() const
+{
+ Pose gpose = GetGlobalPose();
+
+ double cosa = cos( gpose.a );
+ double sina = sin( gpose.a );
+
+ Velocity gv;
+ gv.x = velocity.x * cosa - velocity.y * sina;
+ gv.y = velocity.x * sina + velocity.y * cosa;
+ gv.a = velocity.a;
+
+ return gv;
+}
+
+// set the model's velocity in the global frame
+void ModelPosition::SetGlobalVelocity( const Velocity& gv
+ )
+{
+ Pose gpose = GetGlobalPose();
+
+ double cosa = cos( gpose.a );
+ double sina = sin( gpose.a );
+
+ Velocity lv;
+ lv.x = gv.x * cosa + gv.y * sina;
+ lv.y = -gv.x * sina + gv.y * cosa;
+ lv.a = gv.a;
+
+ this->SetVelocity( lv );
+}
void ModelPosition::Load( void )
{
View
10 libstage/stage.hh
@@ -2304,12 +2304,6 @@ namespace Stg
/** get the pose of a model in the global CS */
Pose GetGlobalPose() const;
- /** get the velocity of a model in the global CS */
- Velocity GetGlobalVelocity() const;
-
- /* set the velocity of a model in the global coordinate system */
- void SetGlobalVelocity( const Velocity& gvel );
-
/** subscribe to a model's data */
void Subscribe();
@@ -2976,6 +2970,10 @@ namespace Stg
frame. */
Velocity GetVelocity() const { return velocity; }
void SetVelocity( const Velocity& val );
+ /** get the velocity of a model in the global CS */
+ Velocity GetGlobalVelocity() const;
+ /* set the velocity of a model in the global coordinate system */
+ void SetGlobalVelocity( const Velocity& gvel );
/** Specify a point in space. Arrays of Waypoints can be attached to
Models and visualized. */
Something went wrong with that request. Please try again.