Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: in-accurate compass readings with servos running on: January 14, 2013, 05:08:38 pm
@arbutus
My posted code does not show it but the getHeading() method that does the read of the compass is run every 100ms by my home made scheduler..

I am really intrigued about what you are saying about the noise being more of sharing a common power / ground (all my components do)  I will read up more on introducing a capacitor.  I might have a question or two on it as i get into it.  But being that moving the compass around trying to increase physical distance was getting me about nothing your idea makes perfect sense.

@retrolefty
Yes the servos are pwm driven, thanks for the search terms on the shielding material, will take a look and see what i uncover.

Thank you,

Brian
2  Using Arduino / Sensors / Re: in-accurate compass readings with servos running on: January 14, 2013, 03:08:36 pm
thanks for the links, I will try them out.  I was going to do some "smoothing" regardless so I might as well see how much it corrects the issue with the current noise level. 

Here is the code (pulled out from the rest) My compass is a pointer.  Most of this is pretty standard I think.

Code:
  // the following is setup in when my Robot.cpp class is instantiated.

  // set up the compass
  compass = new LSM303();
  LSM303::vector running_min = {2047, 2047, 2047}, running_max = {-2048, -2048, -2048};
 
  // initialize the compass
  Wire.begin();
  compass->init(LSM303DLHC_DEVICE, LSM303_SA0_A_AUTO);
  compass->enableDefault();
  compass->writeAccReg(LSM303_CTRL_REG1_A, 0x27); // Bump accelerometer from 50 hz to 400 hz
 
  compass->setMagGain(LSM303::magGain_25);

  // calibrate
  compass->m_min.x = -449; compass->m_min.y = -440; compass->m_min.z = -405;
  compass->m_max.x = 223; compass->m_max.y = 321; compass->m_max.z = 389;


  // the following is called in a getHeading method anytime the heading reading is called for

  compass->read();
  int heading = compass->heading((LSM303::vector){0,-1,0});

I am still hoping to get the noise out even if the averaging works pretty well.  Having that much deviation in the numbers has got to lead to error occasionally, even with the smoothing...

Thanks,

Brian

3  Using Arduino / Sensors / in-accurate compass readings with servos running on: January 14, 2013, 11:10:16 am
I have been struggling to get my LSM303DLHC to return accurate compass readings when the servos on the robot are in use.  The robot is a parallax BOE-BOT chassis with 2 continuous parallax servos in a differential setup and a servo rotating a ping sensor on the front of the chassis.  I have tried moving the compass up to about 13cm or 5" away from the nearest servo, but with such a small chassis it is difficult to locate the compass further away with sticking on a "pole" that would leave it exposed to colliding with objects the robot cannot see.

All the following were taken while the compass was facing south (180 degrees)
Here is a set of readings after calibration with all the servos off.
180 181 181 181 180 181 180 182 181 181 180 180 182

Here is a set with just the drive servos running
188 185 193 186 183 188 181 169 182 173 193 166 194 183 192 170 174 176 167

Here is a set with just the turret servo running
178 164 177 179 181 189 179 198 186 164 177 179 189 179 190 166 181 180

And lastly here is a set with all 3 servos moving:
180 214 181 169 160 189 183 190 177 175 189 211 176 193 165 182 204 189

I have read about soothing out the compass signal by averaging out readings and have been trying different calibrations and calibrating at different gain levels, etc. (so far to no avail).

I am looking for any advice and the experience others have had on ways to deal with this issue.  Is the noise from the servos possible to "calibrate out" at this physical distance from the servos?  Is it possible to shield the compass with some sort of container for the LSM303DLHC?  Has anyone else done an averaging or smoothing on a compass which was giving off such noisy results?

Thanks,

Brian
4  Using Arduino / Motors, Mechanics, and Power / Re: Arduino & Continous Rotation Servos on: January 09, 2013, 11:50:32 pm
Not to my knowledge, the processor on the Arduino is only capable of handling one instruction at any given moment in time.  But that is a extremely small amount of time.  Unless there is a delay or sleep between the 2 calls to the servos will start at the same (human percevable) time.
5  Using Arduino / Motors, Mechanics, and Power / Re: Arduino & Continous Rotation Servos on: January 09, 2013, 09:53:11 pm
without seeing the code that you have working I can only guess based on what you posted before.

You have to initialize another servo:

Servo motor2;

Then initialize it to the pin of the second motor, something like this (assuming this code works for your first servo

void setup() {
  motor2.attach(XX); // where XX is the pin of the other servo.
  for(int t=0;t<=3000;t += 1000){  
    motor.write(80);
  }
}
void loop(){
}
6  Using Arduino / Motors, Mechanics, and Power / Re: Question on monitoring the rotation of continuous servos on: January 06, 2013, 08:45:48 pm
There was some error on the nxt's (there were 2 of them) when there was wheel slip (generally it only happend when the side clipped an obstacle.  For the application it worked surprisingly well.  Basically I had to use 2 nxt bots in an obstacle coures the first robot was a seeker and was allowed to have an IR sensor.  It had to find multiple IR beacons around the course and communicate the location back to the second one.  The second robot was not allowed an IR sensor but had to have a way to retrieve the IR beacon (spherical).  The retriever used the x,y co-ordinates sent by the seeker to get the ball then return it to 0,0 (home).  Here is a video i took of the process a bit before the final version, but all in all it shows how it was intended to work. https://plus.google.com/103670107949098796410/posts/A96iapotHns

Now I have ported the software to the Arduino, but this time around I am adding a android phone to the mix that will receive the sensor data and "assumed" x,y position info from the arduino and attempt to reconcile it against it's own mapping and localization.  It then could pass back a x,y destination to the ardiuno as an attractive field and possibly modify the arduino's own x,y location if there is reason to believe it is off.

My big concern with the parallax encoder setup for the boe-bot is that it will not be accurate even when there is no wheel error, but I will be finding out soon, because i decided to order it.

Also I did consider using nxt motors, I even looked at a shield that is available for nxt gear, but the nxt bots belonged to the school where I am taking my masters (the arduino stuff is mine) so I would have had to purchase new nxt motors anyway..

Thanks again for everyone help

Brian
7  Using Arduino / Motors, Mechanics, and Power / Re: Question on monitoring the rotation of continuous servos on: January 05, 2013, 03:57:11 pm
thank you all again for taking some time to respond.  I have been doing a bit more research and i think i have narrowed my choices down to 2:

Because my project is based on the BOE-BOT the easiest choice would appear to be: the digital encoder kit made by parallax http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/ProductID/80/List/0/Default.aspx?SortField=ProductName,ProductName 
I have some reservations though that it will not be the most accurate system.  But I do believe it will be the most economical when considering time and other factors.

The other way I am thinking of going is with new gearmotors such as these: http://www.pololu.com/catalog/product/2286
They are slightly longer then my current servos so I think they will require some amount of modification to the BOE bot chassis, in addition if I am understanding correctly it seems i could not run them off the regulated 5v provided by my boe bot arduino shield because it provides up to 1A and each gearmotor is listed as using 40ma running and 2.2A stall.  Am I understanding correctly that I need to provide for 2.2 X 2 or 4.4A regulated 6V? (although the motors would run ok on 5V) Also with regards to the motor controller I would think I would need to have one to control the motor RPM?

Is it likely accurate then that to go the gearmotor route I would be looking at getting the motors, doing chassis modification (or replacement), would need some form of DC motor control board and possibly another batter pack depending on consumption and the input range on what ever is regulating the voltage to the gearmotors? 

I am leaning towards the parallax encoders and am curious if anyone here has tried them out and has any feedback about their error rate.  I am thinking i will start there and for the next project plan ahead for the gearmotor / encoder route.

Thanks again,

Brian

8  Using Arduino / Motors, Mechanics, and Power / Re: Question on monitoring the rotation of continuous servos on: January 01, 2013, 07:10:21 pm
Thank you very much, reading up on gear ratios, etc.
9  Using Arduino / Motors, Mechanics, and Power / Question on monitoring the rotation of continuous servos on: January 01, 2013, 03:46:48 pm
I am trying currently trying to covert a project I did with NXT using Lejos to Arduino.  I am using a Parallax BOE shield bot and Parallax continuous rotation servos. 

In the NXT/Lejos project I was able to map the robot in 2d space by using the compass and counting the rotation of both servos in a differential setup.

I am very close to getting the Arduino based robot to do the same but I cannot figure out how to accurately count the servo rotations.  It seems that the NXT servos allowed for this as all api's for the NXT servos provided some form of getTachoCount() method that would return the current count of the servo.  It was also possible to rotate the continuous servos a particular amount of degrees

Can anyone suggest a way to do this?  I have not been turning up much in my searching, but i might not be looking for the right thing so any terms you can think of that might be helpful to my searching would be appreciated as well.  At this point my best guess is to find the amount of time it takes the servo to rotate once at full speed and then do the math.  But I have a feeling this will become in-accurate rather quickly.  Are there any clever libraries already in existence?

I am open to completely new approaches but would like to work with what I have if possible.

Thanks,

Brian
Pages: [1]