Skip to content

Commit

Permalink
working on fixing player plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Vaughan authored and Richard Vaughan committed Nov 23, 2010
1 parent 15132c8 commit 1d44d2b
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 219 deletions.
2 changes: 1 addition & 1 deletion avonstage/avonstage.cc
Expand Up @@ -179,7 +179,7 @@ int RangerData( Stg::Model* mod, av_msg_t* data )
t.pose[5] = s.pose.a;

const std::vector<Stg::meters_t>& ranges = s.ranges;
const std::vector<float>& intensities = s.intensities;
const std::vector<double>& intensities = s.intensities;

assert( ranges.size() == intensities.size() );

Expand Down
81 changes: 40 additions & 41 deletions libstage/model.cc
Expand Up @@ -339,55 +339,54 @@ void Model::GuiState::Load( Worldfile* wf, int wf_entity )
// constructor
Model::Model( World* world,
Model* parent,
const std::string& type ) :
const std::string& type ) :
Ancestor(),
alwayson(false),
blockgroup(),
blocks_dl(0),
boundary(false),
callbacks(__CB_TYPE_COUNT), // one slot in the vector for each type
callbacks(__CB_TYPE_COUNT), // one slot in the vector for each type
color( 1,0,0 ), // red
data_fresh(false),
disabled(false),
cv_list(),
flag_list(),
geom(),
has_default_block( true ),
id( Model::count++ ),
interval((usec_t)1e5), // 100msec
interval_energy((usec_t)1e5), // 100msec
interval_pose((usec_t)1e5), // 100msec
last_update(0),
log_state(false),
map_resolution(0.1),
mass(0),
parent(parent),
pose(),
power_pack( NULL ),
pps_charging(),
rastervis(),
rebuild_displaylist(true),
say_string(),
stack_children( true ),
stall(false),
subs(0),
thread_safe( false ),
trail(trail_length),
trail_index(0),
type(type),
event_queue_num( 0 ),
used(false),
velocity(),
velocity_enable( false ),
watts(0.0),
watts_give(0.0),
watts_take(0.0),
wf(NULL),
wf_entity(0),
world(world),
world_gui( dynamic_cast<WorldGui*>( world ) )
{
//assert( modelsbyid );
cv_list(),
flag_list(),
geom(),
has_default_block( true ),
id( Model::count++ ),
interval((usec_t)1e5), // 100msec
interval_energy((usec_t)1e5), // 100msec
interval_pose((usec_t)1e5), // 100msec
last_update(0),
log_state(false),
map_resolution(0.1),
mass(0),
parent(parent),
pose(),
power_pack( NULL ),
pps_charging(),
rastervis(),
rebuild_displaylist(true),
say_string(),
stack_children( true ),
stall(false),
subs(0),
thread_safe( false ),
trail(trail_length),
trail_index(0),
type(type),
event_queue_num( 0 ),
used(false),
velocity(),
velocity_enable( false ),
watts(0.0),
watts_give(0.0),
watts_take(0.0),
wf(NULL),
wf_entity(0),
world(world),
world_gui( dynamic_cast<WorldGui*>( world ) )
{
assert( world );

PRINT_DEBUG3( "Constructing model world: %s parent: %s type: %s \n",
Expand Down
52 changes: 26 additions & 26 deletions libstage/stage.hh
Expand Up @@ -2793,7 +2793,7 @@ namespace Stg
static Option showTransducers;

Vis( World* world );
virtual ~Vis( void ){}
virtual ~Vis( void ){}
virtual void Visualize( Model* mod, Camera* cam );
} vis;

Expand All @@ -2808,7 +2808,7 @@ namespace Stg
Color col;

std::vector<meters_t> ranges;
std::vector<float_t> intensities;
std::vector<double> intensities;

Sensor() : pose( 0,0,0,0 ),
size( 0.02, 0.02, 0.02 ), // teeny transducer
Expand All @@ -2824,32 +2824,32 @@ namespace Stg
void Load( Worldfile* wf, int entity );
};

/** returns a const reference to a vector of range and reflectance samples */
const std::vector<Sensor>& GetSensors() const
{ return sensors; }

/** returns a vector of range samples from the indicated sensor
(defaults to zero) */
const std::vector<meters_t>& GetRanges( unsigned int sensor=0) const
{
if( sensor < sensors.size() )
return sensors[sensor].ranges;

PRINT_ERR1( "invalid sensor index specified (%d)", sensor );
exit(-1);
}
/** returns a const reference to a vector of range and reflectance samples */
const std::vector<Sensor>& GetSensors() const
{ return sensors; }

/** returns a vector of range samples from the indicated sensor
(defaults to zero) */
const std::vector<meters_t>& GetRanges( unsigned int sensor=0) const
{
if( sensor < sensors.size() )
return sensors[sensor].ranges;

/** returns a vector of intensitye samples from the indicated sensor
(defaults to zero) */
const std::vector<float_t>& GetIntensities( unsigned int sensor=0) const
{
if( sensor < sensors.size() )
return sensors[sensor].intensities;
PRINT_ERR1( "invalid sensor index specified (%d)", sensor );
exit(-1);
}
PRINT_ERR1( "invalid sensor index specified (%d)", sensor );
exit(-1);
}

/** returns a vector of intensitye samples from the indicated sensor
(defaults to zero) */
const std::vector<double>& GetIntensities( unsigned int sensor=0) const
{
if( sensor < sensors.size() )
return sensors[sensor].intensities;

PRINT_ERR1( "invalid sensor index specified (%d)", sensor );
exit(-1);
}

void LoadSensor( Worldfile* wf, int entity );

private:
Expand Down
2 changes: 1 addition & 1 deletion libstageplugin/p_driver.cc
Expand Up @@ -106,7 +106,7 @@ driver
driver
(
name "stage"
provides ["position2d:0" "laser:0"]
provides ["position2d:0" "ranger:0"]
model "marvin"
)
Expand Down
4 changes: 2 additions & 2 deletions libstageplugin/p_driver.h
Expand Up @@ -176,8 +176,8 @@ class InterfaceRanger : public InterfaceModel
private:
int scan_id;
public:
InterfaceLaser( player_devaddr_t addr, StgDriver* driver, ConfigFile* cf, int section );
virtual ~InterfaceLaser( void ){ /* TODO: clean up*/ };
InterfaceRanger( player_devaddr_t addr, StgDriver* driver, ConfigFile* cf, int section );
virtual ~InterfaceRanger( void ){ /* TODO: clean up*/ };
virtual int ProcessMessage(QueuePointer & resp_queue,
player_msghdr_t* hdr,
void* data);
Expand Down

0 comments on commit 1d44d2b

Please sign in to comment.