Skip to content

Commit

Permalink
Add the rest of the bumper patch.
Browse files Browse the repository at this point in the history
I missed some files with the last bumper commit by mistake.  This commit
contains the rest of the bumper model code
  • Loading branch information
richmattes committed Feb 16, 2014
1 parent f053ff5 commit ed0e4b6
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 31 deletions.
1 change: 1 addition & 0 deletions libstage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 48 additions & 12 deletions libstage/stage.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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 --------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions libstage/typetable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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> );
Expand Down
1 change: 1 addition & 0 deletions libstageplugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set( stagepluginSrcs
p_blobfinder.cc
p_camera.cc
p_gripper.cc
p_bumper.cc
p_simulation.cc
p_fiducial.cc
p_position.cc
Expand Down
7 changes: 3 additions & 4 deletions libstageplugin/p_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,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",
Expand Down
11 changes: 6 additions & 5 deletions worlds/irobot.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
13 changes: 6 additions & 7 deletions worlds/roomba.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
)

6 changes: 3 additions & 3 deletions worlds/roomba.world
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit ed0e4b6

Please sign in to comment.