View Full Version : can anyone help me to get gyro c++ code?
alaa abo alheja
28-01-2009, 05:24
in this year my team Decide to use the gyro sensor,can anyone give us the c++ program of rhe gyro sensor with robotdrive 4 mottors??
alaa abo alheja
29-01-2009, 09:26
here i have the c code of the gyro sensor, can anyone help me to make it work with 4 mottors?
float get_angular_velocity(){
float omega_rad_per_sec, omega_deg_per_sec, u;
u = (float) SensorRaw[S1]; // sensor port 1 is used for CRS03-02
omega_deg_per_sec =(u/1023*5 - 2.5)/0.02; // angular velocity(deg/s)
omega_rad_per_sec =omega_deg_per_sec/180*PI; // angular velocity(rad/s)
return(omega_rad_per_sec);
}
task main()
{
float omega;
motor[motorA] = 100; // power supply for voltage regulator
while(1){
omega =get_angular_velocity();
}
}
plz all who can help give their help to me.
thank u for all
Look for FRC Gyro Sample Program in Windriver.
File > New > Example > ....kernal module... >
Open that project and look at GyroSample.cpp as an example.
Hope this helps.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.