Skip to content
Snippets Groups Projects
Commit 539e23ed authored by Rohan Budhiraja's avatar Rohan Budhiraja
Browse files

[Bug] nbOfJoints_ is not initialized if rosparam(sot/state_vector_map) is undefined.

Leads to resize with garbage value

TODO: where to set the size of angleEncoder_?
parent 5536ca86
No related branches found
No related tags found
No related merge requests found
......@@ -76,15 +76,20 @@ void SotLoader::startControlLoop()
void SotLoader::initializeRosNode(int argc, char *argv[])
{
SotLoaderBasic::initializeRosNode(argc, argv);
angleEncoder_.resize(nbOfJoints_);
//Temporary fix. TODO: where should nbOfJoints_ be initialized from?
if (ros::param::has("/sot/state_vector_map")) {
angleEncoder_.resize(nbOfJoints_);
}
startControlLoop();
}
void
SotLoader::fillSensors(map<string,dgs::SensorValues> & sensorsIn)
{
// Update joint values.w
assert(angleControl_.size() == angleEncoder_.size());
sensorsIn["joints"].setName("angle");
for(unsigned int i=0;i<angleControl_.size();i++)
angleEncoder_[i] = angleControl_[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment