Code:
//----------Nael2:Begin check for acceleration update
Vamos_Geometry::Three_Vector accel_sum;
Vamos_Geometry::Three_Vector rotation_sum;
if (accel_frm_count==frequency){
accel_frm_count=0;
cout<<"Accel="<<accel_sum<<endl<<"Rotation="<<rotation_sum<<endl;
cout<<"Accel/FRM_RT="<<(accel_sum/frequency)<<endl<<"Rotation="<<(rotation_sum/frequency)<<endl;
//world.writeUDP("Hello",(size_t)256,udpSocket);
//accel_sum=accel_sum/ACCEL_FRM_RATE;
//accel_sum[1]=accel_sum[1]/ACCEL_FRM_RATE;
//accel_sum[2]=accel_sum[2]/ACCEL_FRM_RATE;
//rotation_sum=rotation_sum/ACCEL_FRM_RATE;
//rotation_sum[1]=rotation_sum[1]/ACCEL_FRM_RATE;
//rotation_sum[2]=rotation_sum[2]/ACCEL_FRM_RATE;
//cout<<"(X,Y,Z)="<<accel_sum<<endl<<"(X',Y',Z')="<<rotation_sum<<endl;
}
else{
accel_frm_count++;
accel_sum=accel_sum+GetCar(CONT_PLAYERLOCAL)->car->chassis().get_cm_acceleration();
rotation_sum=accel_sum+GetCar(CONT_PLAYERLOCAL)->car->chassis().get_cm_rotation();
//cout<<"------------------------------"<<endl;
//cout<<accel_frm_count<<endl;
//cout<<"Accel="<<accel_sum<<endl<<"Rotation="<<rotation_sum<<endl;
//cout<<"Accel/10="<<(accel_sum/10)<<endl<<"Rotation/10="<<(rotation_sum/10)<<endl;
//cout<<"-----------------------------"<<endl;
}
I added that part in VAMOSWORLD::Update
I also added the following in RigidBody:
ropagate()
Code:
//-----------Begin Nael code to calculate accelerations
cm_acceleration = total_force / m_mass;
cm_rotation = total_torque;
//-----------End Nael code
The .h files were updated to work with these changes and it compiles fine. After running the following two lines I added in VAMOSWORLD::Update
Code:
cout<<"Accel="<<accel_sum<<endl<<"Rotation="<<rotation_sum<<endl;
cout<<"Accel/FRM_RT="<<(accel_sum/frequency)<<endl<<"Rotation="<<(rotation_sum/frequency)<<endl;
just write zeros meaning the accelerations in RigidBody:
ropagate were not calculated/updated. The check against the frequency is made to make it write at a certain rate set through the command line depending on the specifications of the simulation platform - currently set to every 50 frames.
From my understanding, propagate() updates the center of mass every frame, correct?
The strange thing is when I did this with the source code from the last version release, it worked and updated properly - but I had a problem with the car bouncing up and down - apparently because of issues with gcc4 -
So, I got gcc 3.3 and the latest svn checkout and now thats fixed but the modifications I made dont update every 'x' frames anymore and I just get that line of zeros...If I somehow put my code in incorrect functions pls correct me.
Thanks guys, and I hope I did not lose anybody with my explanation.