Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
net.cpp AND what on earth is vector<string>::const_ite
06-12-2006, 09:30 AM,
#12
 
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:Tongueropagate()

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:Tongueropagate 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.
Reply


Messages In This Thread
[No subject] - by thelusiv - 06-05-2006, 05:41 PM
[No subject] - by joevenzon_phpbb2_import3 - 06-05-2006, 09:44 PM
[No subject] - by thelusiv - 06-06-2006, 12:36 AM
[No subject] - by nael - 06-06-2006, 09:41 AM
[No subject] - by thelusiv - 06-06-2006, 12:49 PM
[No subject] - by joevenzon_phpbb2_import3 - 06-06-2006, 08:02 PM
[No subject] - by nael - 06-07-2006, 01:51 PM
[No subject] - by joevenzon_phpbb2_import3 - 06-07-2006, 08:52 PM
[No subject] - by matthew_i - 06-11-2006, 03:12 PM
[No subject] - by nael - 06-12-2006, 09:30 AM
[No subject] - by joevenzon_phpbb2_import3 - 06-12-2006, 08:09 PM
[No subject] - by nael - 06-13-2006, 10:59 AM
[No subject] - by thelusiv - 06-13-2006, 02:02 PM
[No subject] - by nael - 06-14-2006, 01:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)