|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Re: Has anyone gotten useful data from the accelerometer?
the sensor connects to your analog to digital converters, and the output is an integer. What are the ADCs on the RC this year, 10 bits (I think)? that would give you a reading from 0 to 1024, with the 'zero point' around 512.
there is no need to convert that to a real number. If you are calculating tilt with the accelerometers that might be a different story. |
|
#17
|
||||
|
||||
|
Quote:
I agree it can be difficult to get reasonable data from the accelerometer. We designed a little test where we mounted the 2006 Gyro and X,Y accelerometer (plan attached) to a roll around cart and recorded the outputs using the NI data logger we got. Our plan for navigation is basically to use the gyro to set a heading and then use shaft encoders or gear tooth counters to drive straight to the next point in the waypoint list, stop, turn and then go straight again so I didn’t really think we would actually use the accelerometers for navigation. I did think that they may come in handy to tell us if we have started up a corner goal ramp and I was curious what I could get out of them. Well, after the data was put in an excel spread sheet, it looks like using only the accelerometer that is in the direction of the robot heading and the gyro and a little trig you can navigate through a few waypoints, travel over 50feet with an X,Y error when you are done of about a foot. See attached spread sheet if you are curious. We will still count wheel rotations but at least for now our controls group will use the gyro and accelerometers for navigation. The excel files list the raw readings for 5v, Gyro, Temperature, Acc X, Acc Y. The sample rate was slow, 100 s/s but that seems to be fast enough. The actual path and the estimated path using the gyro and accelerometer are shown for two test cases. The spread sheets basically take the raw gyro and Y accelerometer outputs, remove bias, let you set different dead band widths and gains. The final output is the X,Y position of the robot for each time tick. The heading from the gyro is used to update the robot position every sample. That is probably too much processing for the real application but if you assume the robot drives straight from waypoint to waypoint then you can save processing cycles and only calculate the distance traveled in the heading direction from the last waypoint in order to know when to stop and turn. If you look at the data carefully, you will see that the Y accelerometer output is zeroed while the robot is turning (for question mark that is from 6.93 to 9.23 and 15.33 to 18.74 seconds) this can be done because while turning the robot only uses the feedback from the gyro for our application. http://members.cox.net/gnsmith/Just%...e1_results.xls http://members.cox.net/gnsmith/Just%...stion_mark.xls http://members.cox.net/gnsmith/Team%..._test_plan.pdf Last edited by yoyodyne : 28-01-2006 at 22:45. Reason: Add more information on the calculations |
|
#18
|
|||
|
|||
|
Re: Has anyone gotten useful data from the accelerometer?
i used this code to find acceleration. Tipping the accelerometer 90 degrees to one side should read 9.8
place this code in void Process_Data_From_Master_uP(void) Code:
float get_x_value;
float get_y_value;
int a = 205;
float dec_x;
float dec_y;
float x;
float y;
//get analog values for ana04 and ana05
x = Get_Analog_Value(rc_ana_in04);
y = Get_Analog_Value(rc_ana_in05);
/****************************************************/
/*******divide by a(205) to get voltage**************/
/****minus 2.5 to get a range from 2.5 to -2.5*******/
/******multiply by 1000 to get millivolts************/
/*divide by 290 to get G's (290 = millivolts in 1G)**/
/***multiply by 9.803(accelertaion due to gravity)***/
/****************************************************/
get_x_value = (((((x/a) - 2.5) * 1000) / 290) * 9.803);
get_y_value = (((((y/a) - 2.5) * 1000) / 290) * 9.803);
//find and print floating point number
dec_y = ((get_y_value - (int)get_y_value) * 10);
dec_x = ((get_x_value - (int)get_x_value) * 10);
if (dec_x < 0)
dec_x = dec_x * -1;
if (dec_y < 0)
dec_y = dec_y * -1;
printf("acc_x: %3d.%3d acc_y: %3d.%3dr", (int)get_x_value, (int)dec_x, (int)get_y_value, (int)dec_y);
Last edited by p1r0o2g7 : 11-02-2006 at 13:41. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| TTL port to a serial port on a demo board | ImmortalAres | Programming | 16 | 09-07-2005 23:44 |
| Example accelerometer code released. | Kevin Watson | Programming | 0 | 20-01-2005 03:45 |
| Accelerometer data sheet | Joe Ross | Electrical | 16 | 19-01-2005 12:26 |
| heres the code. y this not working | omega | Programming | 16 | 31-03-2004 15:18 |
| Limiting PWM in pbasic | archiver | 2001 | 4 | 24-06-2002 00:38 |