model_position.cc
Go to the documentation of this file.
1 //
3 // File: model_position.cc
4 // Author: Richard Vaughan
5 // Date: 10 June 2004
6 //
7 // SVN info:
8 // $Author: rtv $
9 // $Revision$
10 //
12 
13 
14 #include <sys/time.h>
15 
16 #include "stage.hh"
17 #include "worldfile.hh"
18 using namespace Stg;
19 
88 static const double WATTS_KGMS = 10.0; // current per kg per meter per second
89 static const double WATTS = 1.0; // base cost of position device
90 
91 // simple odometry error model parameters. the error is selected at
92 // random in the interval -MAX/2 to +MAX/2 at startup
93 static const double INTEGRATION_ERROR_MAX_X = 0.03;
94 static const double INTEGRATION_ERROR_MAX_Y = 0.03;
95 static const double INTEGRATION_ERROR_MAX_Z = 0.00; // note zero!
96 static const double INTEGRATION_ERROR_MAX_A = 0.05;
97 
99  Model* parent,
100  const std::string& type ) :
101  Model( world, parent, type ),
102  // private
103  velocity(),
104  goal(0,0,0,0),
105  control_mode( CONTROL_VELOCITY ),
106  drive_mode( DRIVE_DIFFERENTIAL ),
107  localization_mode( LOCALIZATION_GPS ),
108  integration_error( drand48() * INTEGRATION_ERROR_MAX_X - INTEGRATION_ERROR_MAX_X/2.0,
112  wheelbase( 1.0 ),
113  acceleration_bounds(),
114  velocity_bounds(),
115  //public
116  waypoints(),
117  wpvis(),
118  posevis()
119 {
120  PRINT_DEBUG2( "Constructing ModelPosition %d (%s)\n",
121  id, typestr );
122 
123  // assert that Update() is reentrant for this derived model
124  thread_safe = false;
125 
126  // install sensible velocity and acceleration bounds
127  for( int i=0; i<3; i++ )
128  {
129  velocity_bounds[i].min = -1.0;
130  velocity_bounds[i].max = 1.0;
131 
132  acceleration_bounds[i].min = -1.0;
133  acceleration_bounds[i].max = 1.0;
134  }
135 
136  velocity_bounds[3].min = -M_PI/2.0;
137  velocity_bounds[3].max = M_PI/2.0;
138 
139  acceleration_bounds[3].min = -M_PI/2.0;
140  acceleration_bounds[3].max = M_PI/2.0;
141 
142 
143  this->SetBlobReturn( true );
144 
145  AddVisualizer( &wpvis, true );
146  AddVisualizer( &posevis, false );
147 }
148 
149 
151 {
152  // nothing to do
153 }
154 
156 {
157  velocity = val;
159 }
160 
161 
163 {
164  Model::Load();
165 
166  if( wf->PropertyExists( wf_entity, "velocity" ))
167  SetVelocity( GetVelocity().Load( wf, wf_entity, "velocity" ));
168 
169  // load steering mode
170  if( wf->PropertyExists( wf_entity, "drive" ) )
171  {
172  const std::string& mode_str =
173  wf->ReadString( wf_entity, "drive", "diff" );
174 
175  if( mode_str == "diff" )
177  else if( mode_str == "omni" )
179  else if( mode_str == "car" )
181  else
182  PRINT_ERR1( "invalid position drive mode specified: \"%s\" - should be one of: \"diff\", \"omni\" or \"car\". Using \"diff\" as default.", mode_str.c_str() );
183 
184  }
185 
186  // choose a wheelbase
187  this->wheelbase = wf->ReadLength( wf_entity, "wheelbase", this->wheelbase );
188 
189  // load odometry if specified
190  if( wf->PropertyExists( wf_entity, "odom" ) )
191  {
192  PRINT_WARN1( "the odom property is specified for model \"%s\","
193  " but this property is no longer available."
194  " Use localization_origin instead. See the position"
195  " entry in the manual or src/model_position.c for details.",
196  this->Token() );
197  }
198 
199  // set the starting pose as my initial odom position. This could be
200  // overwritten below if the localization_origin property is
201  // specified
202  est_origin = this->GetGlobalPose();
203  est_origin.Load( wf, wf_entity, "localization_origin" );
204 
205  // compute our localization pose based on the origin and true pose
206  const Pose gpose = this->GetGlobalPose();
207 
208  est_pose.a = normalize( gpose.a - est_origin.a );
209  const double cosa = cos(est_origin.a);
210  const double sina = sin(est_origin.a);
211  const double dx = gpose.x - est_origin.x;
212  const double dy = gpose.y - est_origin.y;
213  est_pose.x = dx * cosa + dy * sina;
214  est_pose.y = dy * cosa - dx * sina;
215 
216  // zero position error: assume we know exactly where we are on startup
217  est_pose_error.Zero();// memset( &est_pose_error, 0, sizeof(est_pose_error));
218 
219 
220  // odometry model parameters
221  integration_error.Load( wf, wf_entity, "odom_error" );
222 
223  // choose a localization model
224  if( wf->PropertyExists( wf_entity, "localization" ) )
225  {
226  const std::string& loc_str =
227  wf->ReadString( wf_entity, "localization", "gps" );
228 
229  if( loc_str == "gps" )
231  else if( loc_str == "odom" )
233  else
234  PRINT_ERR2( "unrecognized localization mode \"%s\" for model \"%s\"."
235  " Valid choices are \"gps\" and \"odom\".",
236  loc_str.c_str(), this->Token() );
237  }
238 
239  // if the property does not exist, these have no effect on the argument list
240 
241  wf->ReadTuple( wf_entity, "acceleration_bounds", 0, 8, "llllllaa",
242  &acceleration_bounds[0].min,
243  &acceleration_bounds[0].max,
244  &acceleration_bounds[1].min,
245  &acceleration_bounds[1].max,
246  &acceleration_bounds[2].min,
247  &acceleration_bounds[2].max,
248  &acceleration_bounds[3].min,
249  &acceleration_bounds[3].max );
250 
251  wf->ReadTuple( wf_entity, "velocity_bounds", 0, 8, "llllllaa",
252  &velocity_bounds[0].min,
253  &velocity_bounds[0].max,
254  &velocity_bounds[1].min,
255  &velocity_bounds[1].max,
256  &velocity_bounds[2].min,
257  &velocity_bounds[2].max,
258  &velocity_bounds[3].min,
259  &velocity_bounds[3].max );
260 }
261 
263 {
264  PRINT_DEBUG1( "[%lu] position update", this->world->sim_time );
265 
266  // stop by default
267  Velocity vel(0,0,0,0);
268 
269  if( this->subs ) // no driving if noone is subscribed
270  {
271  switch( control_mode )
272  {
274  {
275  // respect the accel bounds;
276  goal.x = std::min( goal.x, acceleration_bounds[0].max );
277  goal.x = std::max( goal.x, acceleration_bounds[0].min );
278 
279  goal.y = std::min( goal.y, acceleration_bounds[1].max );
280  goal.y = std::max( goal.y, acceleration_bounds[1].min );
281 
282  goal.z = std::min( goal.z, acceleration_bounds[2].max );
283  goal.z = std::max( goal.z, acceleration_bounds[2].min );
284 
285  goal.a = std::min( goal.a, acceleration_bounds[3].max );
286  goal.a = std::max( goal.a, acceleration_bounds[3].min );
287 
288  vel = this->velocity; // we're modifying the current velocity
289 
290  // convert usec to sec
291  const double interval( (double)world->sim_interval / 1e6 );
292 
293  PRINT_DEBUG( "acceleration control mode" );
294  PRINT_DEBUG4( "model %s command(%.2f %.2f %.2f)",
295  this->Token(),
296  this->goal.x,
297  this->goal.y,
298  //this->goal.z,
299  this->goal.a );
300 
301  switch( drive_mode )
302  {
303  case DRIVE_DIFFERENTIAL:
304  // differential-steering model, like a Pioneer
305  vel.x += goal.x * interval;
306  vel.y = 0;
307  vel.a += goal.a * interval;
308  break;
309 
310  case DRIVE_OMNI:
311  // direct steering model, like an omnidirectional robot
312  vel.x += goal.x * interval;
313  vel.y += goal.y * interval;
314  vel.a += goal.a * interval;
315  break;
316 
317  case DRIVE_CAR:
318  PRINT_ERR( "car drive not supported in accelerartion control [to do]" );
319  // // car like steering model based on speed and turning angle
320  // vel.x = goal.x * cos(goal.a);
321  // vel.y = 0;
322  // vel.a = goal.x * sin(goal.a)/wheelbase;
323  break;
324 
325  default:
326  PRINT_ERR1( "unknown steering mode %d", drive_mode );
327  }
328 
329  // printf( "interval %.3f vel: %.2f %.2f %.2f\taccel: %.2f %.2f %.2f\n",
330  // interval,
331  // vel.x, vel.y, vel.a,
332  // goal.x, goal.y, goal.a );
333 
334  } break;
335 
336 
337  case CONTROL_VELOCITY :
338  {
339  PRINT_DEBUG( "velocity control mode" );
340  PRINT_DEBUG4( "model %s command(%.2f %.2f %.2f)",
341  this->Token(),
342  this->goal.x,
343  this->goal.y,
344  this->goal.a );
345 
346  switch( drive_mode )
347  {
348  case DRIVE_DIFFERENTIAL:
349  // differential-steering model, like a Pioneer
350  vel.x = goal.x;
351  vel.y = 0;
352  vel.a = goal.a;
353  break;
354 
355  case DRIVE_OMNI:
356  // direct steering model, like an omnidirectional robot
357  vel.x = goal.x;
358  vel.y = goal.y;
359  vel.a = goal.a;
360  break;
361 
362  case DRIVE_CAR:
363  // car like steering model based on speed and turning angle
364  vel.x = goal.x * cos(goal.a);
365  vel.y = 0;
366  vel.a = goal.x * sin(goal.a)/wheelbase;
367  break;
368 
369  default:
370  PRINT_ERR1( "unknown steering mode %d", drive_mode );
371  }
372  } break;
373 
374  case CONTROL_POSITION:
375  {
376  PRINT_DEBUG( "position control mode" );
377 
378  double x_error = goal.x - est_pose.x;
379  double y_error = goal.y - est_pose.y;
380  double a_error = normalize( goal.a - est_pose.a );
381 
382  PRINT_DEBUG3( "errors: %.2f %.2f %.2f\n", x_error, y_error, a_error );
383 
384  // speed limits for controllers
385  // TODO - have these configurable
386  double max_speed_x = 0.4;
387  double max_speed_y = 0.4;
388  double max_speed_a = 1.0;
389 
390  switch( drive_mode )
391  {
392  case DRIVE_OMNI:
393  {
394  // this is easy - we just reduce the errors in each axis
395  // independently with a proportional controller, speed
396  // limited
397  vel.x = std::min( x_error, max_speed_x );
398  vel.y = std::min( y_error, max_speed_y );
399  vel.a = std::min( a_error, max_speed_a );
400  }
401  break;
402 
403  case DRIVE_DIFFERENTIAL:
404  {
405  // axes can not be controlled independently. We have to
406  // turn towards the desired x,y position, drive there,
407  // then turn to face the desired angle. this is a
408  // simple controller that works ok. Could easily be
409  // improved if anyone needs it better. Who really does
410  // position control anyhoo?
411 
412  // start out with no velocity
413  Velocity calc;
414  double close_enough = 0.02; // fudge factor
415 
416  // if we're at the right spot
417  if( fabs(x_error) < close_enough && fabs(y_error) < close_enough )
418  {
419  PRINT_DEBUG( "TURNING ON THE SPOT" );
420  // turn on the spot to minimize the error
421  calc.a = std::min( a_error, max_speed_a );
422  calc.a = std::max( a_error, -max_speed_a );
423  }
424  else
425  {
426  PRINT_DEBUG( "TURNING TO FACE THE GOAL POINT" );
427  // turn to face the goal point
428  double goal_angle = atan2( y_error, x_error );
429  double goal_distance = hypot( y_error, x_error );
430 
431  a_error = normalize( goal_angle - est_pose.a );
432  calc.a = std::min( a_error, max_speed_a );
433  calc.a = std::max( a_error, -max_speed_a );
434 
435  PRINT_DEBUG2( "steer errors: %.2f %.2f \n", a_error, goal_distance );
436 
437  // if we're pointing about the right direction, move
438  // forward
439  if( fabs(a_error) < M_PI/16 )
440  {
441  PRINT_DEBUG( "DRIVING TOWARDS THE GOAL" );
442  calc.x = std::min( goal_distance, max_speed_x );
443  }
444  }
445 
446  // now set the underlying velocities using the normal
447  // diff-steer model
448  vel.x = calc.x;
449  vel.y = 0;
450  vel.a = calc.a;
451  }
452  break;
453 
454  default:
455  PRINT_ERR1( "unknown steering mode %d", (int)drive_mode );
456  }
457  }
458  break;
459 
460  default:
461  PRINT_ERR1( "unrecognized position command mode %d", control_mode );
462  }
463 
464  // simple model of power consumption
465  watts = WATTS +
466  fabs(vel.x) * WATTS_KGMS * mass +
467  fabs(vel.y) * WATTS_KGMS * mass +
468  fabs(vel.a) * WATTS_KGMS * mass;
469 
470  //PRINT_DEBUG4( "model %s velocity (%.2f %.2f %.2f)",
471  // this->token,
472  // this->velocity.x,
473  // this->velocity.y,
474  // this->velocity.a );
475 
476  // respect velocity bounds
477  vel.x = velocity_bounds[0].Constrain( vel.x );
478  vel.y = velocity_bounds[1].Constrain( vel.y );
479  vel.z = velocity_bounds[2].Constrain( vel.z );
480  vel.a = velocity_bounds[3].Constrain( vel.a );
481 
482  // printf( "final vel: %.2f %.2f %.2f\n",
483  // vel.x, vel.y, vel.a );
484 
485  this->SetVelocity( vel );
486  }
487 
488  switch( localization_mode )
489  {
490  case LOCALIZATION_GPS:
491  {
492  // compute our localization pose based on the origin and true pose
493  Pose gpose = this->GetGlobalPose();
494 
495  est_pose.a = normalize( gpose.a - est_origin.a );
496  double cosa = cos(est_origin.a);
497  double sina = sin(est_origin.a);
498  double dx = gpose.x - est_origin.x;
499  double dy = gpose.y - est_origin.y;
500  est_pose.x = dx * cosa + dy * sina;
501  est_pose.y = dy * cosa - dx * sina;
502 
503  }
504  break;
505 
506  case LOCALIZATION_ODOM:
507  {
508  // integrate our velocities to get an 'odometry' position estimate.
509  double dt = world->sim_interval / 1e6; // update interval convert to seconds
510 
511  est_pose.a = normalize( est_pose.a + (vel.a * dt) * (1.0 +integration_error.a) );
512 
513  double cosa = cos(est_pose.a);
514  double sina = sin(est_pose.a);
515  double dx = (vel.x * dt) * (1.0 + integration_error.x );
516  double dy = (vel.y * dt) * (1.0 + integration_error.y );
517 
518  est_pose.x += dx * cosa + dy * sina;
519  est_pose.y -= dy * cosa - dx * sina;
520  }
521  break;
522 
523  default:
524  PRINT_ERR2( "unknown localization mode %d for model %s\n",
526  break;
527  }
528 
529  PRINT_DEBUG3( " READING POSITION: [ %.4f %.4f %.4f ]\n",
530  est_pose.x, est_pose.y, est_pose.a );
531 
532  Model::Update();
533 }
534 
536 {
537  if( velocity.IsZero() )
538  return;
539 
540  if( disabled )
541  return;
542 
543  // convert usec to sec
544  const double interval( (double)world->sim_interval / 1e6 );
545 
546  // find the change of pose due to our velocity vector
547  const Pose p( velocity.x * interval,
548  velocity.y * interval,
549  velocity.z * interval,
550  normalize( velocity.a * interval ));
551 
552  // the pose we're trying to achieve (unless something stops us)
553  const Pose newpose( pose + p );
554 
555  // stash the original pose so we can put things back if we hit
556  const Pose startpose( pose );
557 
558  pose = newpose; // do the move provisionally - we might undo it below
559 
560  const unsigned int layer( world->UpdateCount()%2 );
561 
562  UnMapWithChildren( layer ); // remove from all blocks
563  MapWithChildren( layer ); // render into new blocks
564 
565  if( TestCollision() ) // crunch!
566  {
567  // put things back the way they were
568  // this is expensive, but it happens _very_ rarely for most people
569  pose = startpose;
570  UnMapWithChildren( layer );
571  MapWithChildren( layer );
572 
573  SetStall(true);
574  }
575  else
576  {
577  // world->dirty = true; // need redraw
578  SetStall(false);
579  }
580 }
581 
582 
584 {
585  world->active_velocity.insert( this );
586 
587  Model::Startup();
588 
589  PRINT_DEBUG( "position startup" );
590 }
591 
593 {
594  PRINT_DEBUG( "position shutdown" );
595 
596  // safety features!
597  goal.Zero();
598  velocity.Zero();
599 
600  world->active_velocity.erase( this );
601 
602  Model::Shutdown();
603 }
604 
606 {
607  SetSpeed( 0,0,0 );
608 }
609 
610 void ModelPosition::SetSpeed( double x, double y, double a )
611 {
613  goal.x = x;
614  goal.y = y;
615  goal.z = 0;
616  goal.a = a;
617 }
618 
619 void ModelPosition::SetXSpeed( double x )
620 {
622  goal.x = x;
623 }
624 
625 void ModelPosition::SetYSpeed( double y )
626 {
628  goal.y = y;
629 }
630 
631 void ModelPosition::SetZSpeed( double z )
632 {
634  goal.z = z;
635 }
636 
638 {
640  goal.a = a;
641 }
642 
644 {
646  goal.x = vel.x;
647  goal.y = vel.y;
648  goal.z = vel.z;
649  goal.a = vel.a;
650 }
651 
652 void ModelPosition::GoTo( double x, double y, double a )
653 {
655  goal.x = x;
656  goal.y = y;
657  goal.z = 0;
658  goal.a = a;
659 }
660 
662 {
664  goal = pose;
665 }
666 
667 void ModelPosition::SetAcceleration( double x, double y, double a )
668 {
670  goal.x = x;
671  goal.y = y;
672  goal.z = 0;
673  goal.a = a;
674 }
675 
680 {
681  est_pose = odom;
682 
683  // figure out where the implied origin is in global coords
684  const Pose gp = GetGlobalPose();
685  const double da = normalize( -odom.a + gp.a );
686  const double dx = -odom.x * cos(da) + odom.y * sin(da);
687  const double dy = -odom.y * cos(da) - odom.x * sin(da);
688 
689  // origin of our estimated pose
690  est_origin.x = gp.x + dx;
691  est_origin.y = gp.y + dy;
692  est_origin.a = da;
693 }
694 
696  : Visualizer( "Position coordinates", "show_position_coords" )
697 {}
698 
700 {
701  (void)cam; // avoid warning about unused var
702 
703  ModelPosition* pos = dynamic_cast<ModelPosition*>(mod);
704 
705  // vizualize my estimated pose
706  glPushMatrix();
707 
708  // back into global coords
710 
711  Gl::pose_shift( pos->est_origin );
712  pos->PushColor( 1,0,0,1 ); // origin in red
713  Gl::draw_origin( 0.5 );
714 
715  glEnable (GL_LINE_STIPPLE);
716  glLineStipple (3, 0xAAAA);
717 
718  pos->PushColor( 1,0,0,0.5 );
719  glBegin( GL_LINE_STRIP );
720  glVertex2f( 0,0 );
721  glVertex2f( pos->est_pose.x, 0 );
722  glVertex2f( pos->est_pose.x, pos->est_pose.y );
723  glEnd();
724 
725  glDisable(GL_LINE_STIPPLE);
726 
727  char label[64];
728  snprintf( label, 64, "x:%.3f", pos->est_pose.x );
729  Gl::draw_string( pos->est_pose.x / 2.0, -0.5, 0, label );
730 
731  snprintf( label, 64, "y:%.3f", pos->est_pose.y );
732  Gl::draw_string( pos->est_pose.x + 0.5 , pos->est_pose.y / 2.0, 0, (const char*)label );
733 
734  pos->PopColor();
735 
736  Gl::pose_shift( pos->est_pose );
737  pos->PushColor( 0,1,0,1 ); // pose in green
738  Gl::draw_origin( 0.5 );
739  pos->PopColor();
740 
741  Gl::pose_shift( pos->geom.pose );
742  pos->PushColor( 0,0,1,1 ); // offset in blue
743  Gl::draw_origin( 0.5 );
744  pos->PopColor();
745 
746  Color c = pos->color;
747  c.a = 0.5;
748  pos->PushColor( c );
749 
750  glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
751  pos->blockgroup.DrawFootPrint( pos->geom );
752  pos->PopColor();
753 
754  glPopMatrix();
755 }
756 
757 
759  : Visualizer( "Position waypoints", "show_position_waypoints" )
760 {}
761 
763 {
764  (void)cam; // avoid warning about unused var
765 
766  ModelPosition* pos = dynamic_cast<ModelPosition*>(mod);
767  const std::vector<Waypoint>& waypoints = pos->waypoints;
768 
769  if( waypoints.empty() )
770  return;
771 
772  glPointSize( 5 );
773  glPushMatrix();
774  pos->PushColor( pos->color );
775 
777  Gl::pose_shift( pos->est_origin );
778 
779  glTranslatef( 0,0,0.02 );
780 
781  // draw waypoints
782  glLineWidth( 3 );
783  FOR_EACH( it, waypoints )
784  it->Draw();
785  glLineWidth( 1 );
786 
787  // draw lines connecting the waypoints
788  const size_t num(waypoints.size());
789  if( num > 1 )
790  {
791  pos->PushColor( 1,0,0,0.3 );
792  glBegin( GL_LINES );
793 
794  for( size_t i(1); i<num ; i++ )
795  {
796  Pose p = waypoints[i].pose;
797  Pose o = waypoints[i-1].pose;
798 
799  glVertex2f( p.x, p.y );
800  glVertex2f( o.x, o.y );
801  }
802 
803  glEnd();
804 
805  pos->PopColor();
806  }
807 
808  pos->PopColor();
809  glPopMatrix();
810 }
811 
813  : pose(pose), color(color)
814 {
815 }
816 
818  : pose(x,y,z,a), color(color)
819 {
820 }
821 
822 
824  : pose(), color()
825 {
826 };
827 
828 
830 {
831  GLdouble d[4];
832 
833  d[0] = color.r;
834  d[1] = color.g;
835  d[2] = color.b;
836  d[3] = color.a;
837 
838  glColor4dv( d );
839 
840  glBegin(GL_POINTS);
841  glVertex3f( pose.x, pose.y, pose.z );
842  glEnd();
843 
844  meters_t quiver_length = 0.15;
845 
846  double dx = cos(pose.a) * quiver_length;
847  double dy = sin(pose.a) * quiver_length;
848 
849  glBegin(GL_LINES);
850  glVertex3f( pose.x, pose.y, pose.z );
851  glVertex3f( pose.x+dx, pose.y+dy, pose.z );
852  glEnd();
853 }
void SetTurnSpeed(double a)
virtual void PushColor(Color col)
Definition: stage.hh:2189
ControlMode control_mode
Definition: stage.hh:2955
Model class
Definition: stage.hh:1742
void GoTo(double x, double y, double a)
int subs
the number of subscriptions to this model
Definition: stage.hh:1959
virtual void Visualize(Model *mod, Camera *cam)
virtual void Load()
void UnMapWithChildren(unsigned int layer)
Definition: model.cc:632
int CallCallbacks(callback_type_t type)
double a
Definition: stage.hh:200
double max
largest value in range, initially zero
Definition: stage.hh:435
World class
Definition: stage.hh:814
The Stage library uses its own namespace.
Definition: canvas.hh:8
virtual void Shutdown()
Model * TestCollision()
Definition: model.cc:800
Velocity velocity
Definition: stage.hh:2953
const std::string ReadString(int entity, const char *name, const std::string &value)
Definition: worldfile.cc:1376
void SetSpeed(double x, double y, double a)
static const double INTEGRATION_ERROR_MAX_X
ModelPosition(World *world, Model *parent, const std::string &type)
void SetStall(bool stall)
Definition: model.cc:1271
usec_t sim_interval
Definition: stage.hh:1087
Geom geom
Definition: stage.hh:1883
watts_t watts
power consumed by this model
Definition: stage.hh:2005
int ReadTuple(const int entity, const char *name, const unsigned int first, const unsigned int num, const char *format,...)
Definition: worldfile.cc:1506
double min
smallest value in range, initially zero
Definition: stage.hh:433
static const double WATTS
void draw_origin(double len)
Definition: gl.cc:134
#define PRINT_DEBUG2(m, a, b)
Definition: stage.hh:668
static const double INTEGRATION_ERROR_MAX_Y
Pose & Load(Worldfile *wf, int section, const char *keyword)
Definition: model.cc:180
Bounds velocity_bounds[4]
Definition: stage.hh:2966
void SetZSpeed(double z)
uint64_t UpdateCount()
Definition: stage.hh:919
void SetYSpeed(double y)
virtual void PopColor()
Definition: stage.hh:2191
kg_t mass
Definition: stage.hh:1909
Stg::ModelPosition::PoseVis posevis
bool thread_safe
Definition: stage.hh:1964
void DrawFootPrint(const Geom &geom)
Definition: blockgroup.cc:130
static const double INTEGRATION_ERROR_MAX_Z
meters_t z
location in 3 axes
Definition: stage.hh:251
meters_t y
Definition: stage.hh:251
Worldfile * wf
Definition: stage.hh:2015
ModelPosition class
Definition: stage.hh:2927
void SetVelocity(const Velocity &val)
bool disabled
Definition: stage.hh:1869
double wheelbase
Definition: stage.hh:2959
void pose_inverse_shift(const Pose &pose)
Definition: gl.cc:18
double normalize(double a)
Definition: stage.hh:154
int wf_entity
Definition: stage.hh:2016
#define PRINT_DEBUG3(m, a, b, c)
Definition: stage.hh:669
usec_t sim_time
the current sim time in this world in microseconds
Definition: stage.hh:907
Pose est_pose
position estimate in local coordinates
Definition: stage.hh:3044
void SetXSpeed(double x)
double r
Definition: stage.hh:200
Pose GetGlobalPose() const
Definition: model.cc:1379
bool PropertyExists(int section, const char *token)
Definition: worldfile.cc:1324
Stg::ModelPosition::WaypointVis wpvis
Pose pose
position
Definition: stage.hh:394
#define PRINT_ERR(m)
Definition: stage.hh:625
double ReadLength(int entity, const char *name, double value)
Definition: worldfile.hh:107
Pose goal
the current velocity or pose to reach, depending on the value of control_mode
Definition: stage.hh:2954
void Zero()
Definition: stage.hh:299
double meters_t
Definition: stage.hh:174
usec_t interval
time between updates in usec
Definition: stage.hh:1902
void pose_shift(const Pose &pose)
Definition: gl.cc:13
void SetBlobReturn(bool val)
Definition: model.cc:1303
std::vector< Waypoint > waypoints
Definition: stage.hh:3001
void AddVisualizer(Visualizer *custom_visual, bool on_by_default)
Definition: model_draw.cc:322
virtual void Startup()
Definition: model.cc:707
double b
Definition: stage.hh:200
virtual void Visualize(Model *mod, Camera *cam)
Pose est_pose_error
estimated error in position estimate
Definition: stage.hh:3045
LocalizationMode localization_mode
global or local mode
Definition: stage.hh:2957
Velocity & Load(Worldfile *wf, int section, const char *keyword)
Definition: stage.hh:372
void draw_string(float x, float y, float z, const char *string)
Definition: gl.cc:65
virtual void Update()
Definition: model.cc:735
double g
Definition: stage.hh:200
Bounds acceleration_bounds[4]
Definition: stage.hh:2963
virtual void Startup()
virtual void Load()
Definition: model.cc:1422
Velocity GetVelocity() const
Definition: stage.hh:2984
BlockGroup blockgroup
Definition: stage.hh:1773
#define PRINT_DEBUG1(m, a)
Definition: stage.hh:667
Pose pose
Definition: stage.hh:1916
World * world
Definition: stage.hh:2017
bool IsZero() const
Definition: stage.hh:295
#define PRINT_DEBUG4(m, a, b, c, d)
Definition: stage.hh:670
#define PRINT_ERR2(m, a, b)
Definition: stage.hh:627
#define PRINT_ERR1(m, a)
Definition: stage.hh:626
Velocity integration_error
errors to apply in simple odometry model
Definition: stage.hh:2958
double Constrain(double value)
Definition: model.cc:164
void MapWithChildren(unsigned int layer)
Definition: model.cc:617
virtual void Shutdown()
Definition: model.cc:723
std::set< ModelPosition * > active_velocity
Definition: stage.hh:1081
#define FOR_EACH(I, C)
Definition: stage.hh:616
Pose est_origin
global origin of the local coordinate system
Definition: stage.hh:3046
radians_t a
rotation about the z axis.
Definition: stage.hh:252
#define PRINT_DEBUG(m)
Definition: stage.hh:666
static const double INTEGRATION_ERROR_MAX_A
Color color
Definition: stage.hh:1859
static const double WATTS_KGMS
DriveMode drive_mode
Definition: stage.hh:2956
virtual void Move()
#define PRINT_WARN1(m, a)
Definition: stage.hh:634
void SetOdom(Pose odom)
void SetAcceleration(double x, double y, double a)
double radians_t
Definition: stage.hh:177
virtual void Update()
meters_t x
Definition: stage.hh:251
const char * Token() const
Definition: stage.hh:715


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Mon Jun 10 2019 15:06:09