Skip to content

Commit

Permalink
Fixed potential memory leaks and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarattoni committed Sep 21, 2017
1 parent c6008b1 commit 773798b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/plugins/robots/e-puck/simulator/epuck_entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ CEPuckEntity::CEPuckEntity(const std::string& str_id,
m_pcOmnidirectionalCameraEquippedEntity = new COmnidirectionalCameraEquippedEntity(this,
"omnidirectional_camera_0",
ToRadians(cAperture),
CVector3(0.0f, 0.0f, OMNIDIRECTIONAL_CAMERA_ELEVATION));
CVector3(0.0f, 0.0f, OMNIDIRECTIONAL_CAMERA_ELEVATION),CQuaternion().FromEulerAngles(CRadians::ZERO,CRadians::ZERO,CRadians::ZERO));
AddComponent(*m_pcOmnidirectionalCameraEquippedEntity);

/* IRCom equipped entity */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CEpuckRABEquippedEntity : public CRABEquippedEntity {
Real f_range,
SAnchor& s_anchor,
CEmbodiedEntity& c_entity_body,
const CVector3& c_position = CVector3(),
const CVector3& c_position = CVector3(0,0,0),
const CQuaternion& c_orientation = CQuaternion().FromEulerAngles(CRadians::ZERO,CRadians::ZERO,CRadians::ZERO));


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ void CEPuckRABDefaultSensor::Update() {
/*let's copy the entities in a proper data structure in a random order.*/
for(CSet<CRABEquippedEntity*>::iterator itRABSendingEquipedEntity = setRABs.begin();
itRABSendingEquipedEntity != setRABs.end(); ++itRABSendingEquipedEntity) {
size_t selectedIndex=m_pcRNG->Uniform(CRange<UInt32>(0,indexes.size()));
vRABentities[indexes.at(selectedIndex)]=static_cast<CEpuckRABEquippedEntity*>(*itRABSendingEquipedEntity);
size_t selectedIndex=indexes.size();
// Changed because of bug on cluster. To be fixed
while(selectedIndex >= indexes.size()){
selectedIndex=m_pcRNG->Uniform(CRange<UInt32>(0,indexes.size()));
}
vRABentities[indexes.at(selectedIndex)]=static_cast<CEpuckRABEquippedEntity*>(*itRABSendingEquipedEntity);
indexes.erase(indexes.begin()+selectedIndex);
}
UInt32 unMessagesNeeded=m_uMaxNumberOfMessages;
Expand Down

0 comments on commit 773798b

Please sign in to comment.