Permalink
Browse files

Add the rest of the bumper patch.

I missed some files with the last bumper commit by mistake.  This commit
contains the rest of the bumper model code
  • Loading branch information...
1 parent bc7dbdd commit 1473a1f14d1ca357ce785a64fe854fa3e702d944 @jpgr87 committed Feb 11, 2013
View
1 libstage/CMakeLists.txt
@@ -16,6 +16,7 @@ set( stageSrcs
model_actuator.cc
model_blinkenlight.cc
model_blobfinder.cc
+ model_bumper.cc
model_callbacks.cc
model_camera.cc
model_draw.cc
View
60 libstage/stage.hh
@@ -2641,20 +2641,56 @@ namespace Stg
};
- // \todo BUMPER MODEL --------------------------------------------------------
- // typedef struct
- // {
- // Pose pose;
- // meters_t length;
- // } bumper_config_t;
-
- // typedef struct
- // {
- // Model* hit;
- // point_t hit_point;
- // } bumper_sample_t;
+ // BUMPER MODEL --------------------------------------------------------
+ /// %ModelBumper class
+ class ModelBumper : public Model
+ {
+ public:
+ class BumperConfig
+ {
+ public:
+ Pose pose;
+ meters_t length;
+ };
+
+ class BumperSample
+ {
+ public:
+ Model* hit;
+ point_t hit_point;
+ };
+
+
+ public:
+ ModelBumper( World* world,
+ Model* parent,
+ const std::string& type );
+ virtual ~ModelBumper();
+ virtual void Load();
+
+ uint32_t bumper_count;
+ BumperConfig* bumpers;
+ BumperSample* samples;
+
+ protected:
+ virtual void Startup();
+ virtual void Shutdown();
+ virtual void Update();
+ virtual void Print (char *prefix);
+
+ class BumperVis : public Visualizer
+ {
+ public:
+ BumperVis();
+ virtual ~BumperVis();
+ virtual void Visualize( Model* mod, Camera* cam);
+ } bumpervis;
+
+ private:
+ static Option showBumperData;
+ };
// FIDUCIAL MODEL --------------------------------------------------------
View
1 libstage/typetable.cc
@@ -23,6 +23,7 @@ void Stg::RegisterModels()
Register( "actuator", Creator<ModelActuator> );
Register( "blinkenlight", Creator<ModelBlinkenlight> );
Register( "blobfinder", Creator<ModelBlobfinder> );
+ Register( "bumper", Creator<ModelBumper> );
Register( "camera", Creator<ModelCamera> );
Register( "fiducial", Creator<ModelFiducial> );
Register( "gripper", Creator<ModelGripper> );
View
1 libstageplugin/CMakeLists.txt
@@ -8,6 +8,7 @@ set( stagepluginSrcs
p_driver.cc
p_actarray.cc
p_blobfinder.cc
+ p_bumper.cc
p_gripper.cc
p_simulation.cc
p_fiducial.cc
View
7 libstageplugin/p_driver.cc
@@ -402,10 +402,9 @@ StgDriver::StgDriver(ConfigFile* cf, int section)
// ifsrc = new InterfacePtz( player_addr, this, cf, section );
// break;
-// case PLAYER_BUMPER_CODE:
-// ifsrc = new InterfaceBumper( player_addr, this, cf, section );
-// break;
-
+ case PLAYER_BUMPER_CODE:
+ ifsrc = new InterfaceBumper( player_addr, this, cf, section );
+ break;
default:
PRINT_ERR1( "error: stage driver doesn't support interface type %d\n",
View
11 worlds/irobot.inc
@@ -25,11 +25,12 @@ define roomba position
)
# this bumper array VERY crudely approximates the Roomba's bumpers
-# bumper( bcount 2
-# blength 0.33
-# bpose[0] [0.12 0.12 45]
-# bpose[1] [0.12 -0.12 -45]
-# )
+ bumper( size [.01 .01 .01 0]
+ bcount 2
+ blength .33
+ bpose[0] [0.12 0.12 .02 45]
+ bpose[1] [0.12 -0.12 .02 -45]
+ )
color "gray50"
)
View
13 worlds/roomba.cfg
@@ -1,8 +1,7 @@
-
# Desc: Player sample configuration file for controlling Stage devices
-# Author: Richard Vaughan
-# Date: 1 December 2004
-
+# Based on simple.cfg
+# Author: Rich Mattes
+# Date: 12 December 2012
# load the Stage plugin simulation driver
driver
@@ -15,12 +14,12 @@ driver
worldfile "roomba.world"
)
-# Create a Stage driver and attach position2d and laser interfaces
-# to the model "r0"
+# Create a Stage driver that connects the roomba's sensors
+# to Player interfaces
driver
(
name "stage"
provides [ "position2d:0" "bumper:0" ]
- model "r0"
+ model "roomba0"
)
View
6 worlds/roomba.world
@@ -1,6 +1,6 @@
-# simple.world - basic world file example
-# Authors: Richard Vaughan
-# $Id$
+# Desc: Sample Stage world file with a simulated Roomba, based on simple.world
+# Author: Rich Mattes
+# Date: 12 December 2012
include "irobot.inc"
include "map.inc"

0 comments on commit 1473a1f

Please sign in to comment.