I have made arena of 10X10. I have made an array in header file. And initialize it with 0 in control step. Now when at each step of movement of robot, the values initialize again and again. What can i do now to avoid re-initialization again and again.
Code: Select all
void CFootBotDistanceScannar::ControlStep()
{
m_pcWheels->SetLinearVelocity(m_fWheelVelocity, m_fWheelVelocity);
for( int w=0;w<=9;w++)
{
for( int x=0;x<=9;x++)
{
DataStorageArray[w][x]=0.0f;
}
}
}
Code: Select all
private:
Real DataStorageArray[10][10];
I have also tried to do it in initialization function.
Code: Select all
void CFootBotDistanceScannar::Init(TConfigurationNode& t_node)
{
for( int w=0;w<=9;w++)
{
for( int x=0;x<=9;x++)
{
DataStorageArray[w][x]=0.0f;
printf("%s%f"," ", DataStorageArray[w][x]);
}
printf("\n\n");
}
}
Thanks