I changed something and I think the problem might come from the client I am
running. I get an error,** glibc detected *** free(): invalid pointer:
0xbfc43cdc ***, when I run the function updateProb(), which makes use of
the helper class BlobMap.C
updateProb()
-----------------------------------------
void updateProb(BlobfinderProxy blobProxy, BlobMap map){
int i,j,k,pixelDist,numHighParts=0,correctBlobs;
double prob,compx,compy,comparea,compheight;
Particle high_particles[PARTICLES];
Color checkColor;
BlobSite compSite;
Particle compPart;
playerc_blobfinder_blob_t compBlob;
cout<<"In updateProb"<<endl;
//find high particles
for (i=0;i<PARTICLES;++i){
prob=0.0;
correctBlobs=0;
compPart= _particles[i];
for (j=0;j<blobProxy.GetCount();++j){
compBlob = blobProxy.GetBlob(j);
compx = compBlob.x + compPart.x;
compy = compBlob.y + compPart.y;
comparea = compBlob.area;
compheight = compBlob.top-compBlob.bottom;
for (k=0;k<map.getNumBlobs();++j){
compSite = (map.getLocations())[k];
if ((abs((comparea/compheight) -
(compSite.area/compSite.height))<=5000)){
++correctBlobs;
}
}
}
prob /= map.getNumBlobs();
if (prob>=.8){
high_particles[numHighParts]=_particles[i];
++numHighParts;
}
}
//randomly arrange the rest of the particles around the high particles
cout<<"Halfway"<<endl;
if (numHighParts>0){
for (j=0;j<PARTICLES;++j){
cout<<"testing ";
if (j<numHighParts){
_particles[j]=high_particles[j];
}
else{
_particles[j].x= high_particles[(j%numHighParts)].x;
cout<<"x";
_particles[j].y= high_particles[(j%numHighParts)].x;
cout<<"y";
_particles[j].theta= (rand()*3.14159265);
while(absd(high_particles[j].theta)>3.14159265)
(high_particles[j].theta)/=2.0;
cout<<"theta";
}
}
}else{
for (j=0;j<PARTICLES;++j){
if (_particles[j].x>_width||_particles[j].y>_height){
_particles[j].x= abs((rand()*_width)%_width);
_particles[j].y= abs((rand()*_height)%_height);
_particles[j].theta= (rand()*3.14159265);
while(absd(_particles[j].theta)>3.14159265)
(_particles[j].theta)/=2.0;
}
}
}
cout<<"Leaving updateProb"<<endl;
}
----------------------------------------------------------------
BlobMap.C
-----------------------------------------------------------
//dbloom
#include "BlobMap.H"
#include <stdlib.h>
using namespace std;
using namespace cs148;
BlobMap::BlobMap(std::istream& input){
cout <<"Blobmap start"<<endl;
char check;
double x,y,area;
int i;
BlobSite blobToAdd;
input >> check;
assert (check=='C');
for (i=0;i<10; ++i){
input >> blobToAdd.x;
input >> blobToAdd.y;
input >> blobToAdd.height;
input >> blobToAdd.area;
cout <<"Blobmap cont.
("<<blobToAdd.x<<","<<blobToAdd.y<<","<<blobToAdd.height<<","<<blobToAdd.area<<")"<<endl;
if (blobToAdd.area!=0)
locations[i]=blobToAdd;
else{
blob_count=i-1;
i=11;
}
cout <<"next Blob"<<endl;
}
}
BlobMap::~BlobMap(){
delete[] locations;
}
int
BlobMap::getNumBlobs(){
return blob_count;
}
BlobSite*
BlobMap::getLocations(){
return locations;
}
--
View this message in context:
http://www.nabble.com/Player-runtime-error-CMVision-shutdown-tf1943590.html#a5367428
Sent from the playerstage-gazebo forum at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Playerstage-gazebo mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo