Turn Adventurebot Using Angles
I am pretty new to working on the AdventureBot, and a class project requires me to make it turn at certain angles, such as turn left 55 degrees, turn right 34 degrees, etc. I have tried varying the speed of the left and right HDD motors, but to find an angle I have to do several tries to find the perfect setting, and repeat it for new values of angles. Also, the speed settings change with the surface of the floor. I do not seem to find a pattern in the left and right speed values either, through which I can write generic code for converting motor speeds to exact angles either for a particular surface.
Has anyone faced a similar problem? If yes, then how can I implement such an operation on AdventureBot? Is there a library or app that I can install on ARC?
Thanks
Without additional hardware this cannot be done accurately with the stock AdventureBot..... You will need either wheel encoders or an accelerometer/gyro (for example an mpu6050 accelerometer)...
I only can offer links for some help:
EzAng
@Ezang: If you know how to do it, please post the solution.
ptp, I just got back,
DJ should answer this one
@EzAng: Why you post the above URLS ?
trying to help as I stated above, my friend
I will try with my adventure Bot later
OK makes sense. You don't know the solution and you post random links for other people to follow and waste time.
@EZAng... I had already answered him and gave him solid advice. If you didn't know how to help him you should not have responded.... Perhaps you didn't understand exactly what the OP wanted to do... That's fair, but just be careful with helping if you are not clear in what is being asked...
FYI... you cannot use timing (sleep commands) to accomplish this... motor output varies and so does battery voltage. Even the surface the robot is running on (friction) will cause different results... As an example the robot will rotate a certain amount depending on battery voltage... Voltage drops so does your turning angle.... Solution.... You need wheel encoders or an IMU (accelerometer/compass) for precise angular rotation...
Even with wheel encoders, there’s no way to accurately turn accurate degrees due to wheel slippage. Any robot with wheel encoders or not will always have a margin of error.
Because the adventure bot uses lipo batteries with a voltage monitor, the speed of the servos do not change. The voltage monitor cuts off before that would happen.
the best way to have the robot turn a set number of degrees is to...
place a piece of paper on the ground with lines drawn by a protractor of the specified degrees
in the adventureBot project, press the configuration button on the continuous servo movement panel. Ensure the use stop values checkbox is checked.
the checkbox will ensure the servos are locked into a stop position vs freely rotating. When the stop command is sent, the servos will immediately stop.
IF the servos keep moving when the checkbox is set and the stop command is set, the servos will need calibration. There’s a good tutorial on ezrobot’s website for that. I think I might actually Star in that tutorial video? Can’t remember
okay, now that you have the robot on the paper and ready. Create a Script control by Add Control - Scripting - Script
press the configure button
you can use Blockly for this I’d preferred. The Blockly will generate JavaScript anyway. So select the Blockly tab (assuming you’re using ARC for JavaScript)
the code will use a turn, sleep, stop. And experiment with the turn speed and sleep to get the best degrees. I’ll add a screenshot example when I’m on my laptop in an hour
now that you have the degrees for this script set, say it’s 90 degrees. Give the script a name at the top of the configuration window. Call it Left 90 Degrees
now set the checkbox that says RoboScratch Module. What this does is turn your script into a RoboScratch module on the RoboScratch editor
now when the students program the robot using roboscratch, they will see your Left 90 Degrees module
Thanks D J, I knew there was an answer in ARC for the young man at school
EzAng
@DJ I respectively disagree. Your method will be crude at best... From what the op said he sounds like he was fairly advanced and looking for precision (Turn right 34deg, etc)... Maybe your method you can get "relatively" close but down to the degree?... I should think not. FYI wheel slippage/surface also applies to your method as well... For precision an IMU accelerometer/compass would work the best... 270deg on a calibrated compass is 270deg irregardless of battery voltage, motor variances or surface condition... The robot will keep turning until it hits 270deg or runs out of battery/or motor burnout trying. That is unless you program it to abort before that happens... Remember repeat ability is also one of the OPs requirements...
@EzAng.... You may feel vindicated, because @DJ came to your rescue, but remember it was DJ and I who were the only ones who put forth a possible solution....
FYI... In my roomba hacking days I used to routinely get any rotational angle I wanted with the old 400 series. With the old 400 series (via the ROI) you had pretty much full access to the Roomba's wheel encoders so it made precision turning a snap...
I didn't realize the solution was requiring specific degrees of 34 or some incredibly accurate number. My solution will provide a vague turning degree for a classroom to demonstrate angles (roughly) of pre-set degrees. It would be similar to any educational robot product. Perhaps with an outcome similar to Turtle Graphics or LOGO.
If you're looking for very precise (to 34 degrees), then there really isn't a great way to do it. You'll need to do it slowly, and use a kalman filter to combine multiple sensor data. A compass isn't accurate enough alone. It would require multiple scans of a lidar or camera sensor. Combined with a compass. Combined with wheel encoders. So three high grade sensors can provide you with the turning. But, the wheels will also have to be centered. Additionally, the wheels would have to have incredibly low friction, and castor could not be used either. So, that will also create some challenges because the robot may move forward a slight amount while turning.
Really, it's going to be incredibly difficult with any platform without combining significant number of sensors with high sample rate to accomplish the precision you believe the OP is requesting.
I do not believe the OP is requesting that level of precision. My interpretation is the OP would like to demonstrate angles of a robot on the ground, similar to how Turtle Graphics or LOGO would be on a computer screen. If i'm incorrect, I accept that as well
Richard R - Sort of sound childish - Why would you say "EzAng.... You may feel vindicated, because @DJ came to your rescue"?
I simply thought there was a way, not being so precise as you are describing, to use the ARC program. I also thought the young man for school just wanted to get some angles, as he said "to make it turn at certain angles, such as turn left 55 degrees, turn right 34 degrees, etc. "
for a school project, do you really need to be so precise? I think not...
If I am wrong, let akshaymathurcse0009 inform me.
I bet akshaymathurcse0009 is long gone by now, lol
by the way I tried it, was a few degrees off, due to my surface, wheels were not calibrated (5 off) - fine for a school project
EzAng
@DJ... Yes Lidar, now we're talkin'...
Cheers
@EZang.... Seriously dude time to let this go... The op wanted precise degrees not approx... Ok, preform the same script on a shag rug, oily surface, dirt and loose gravel.... Now quickly adapt it to cover any angle between 0 - 359deg... without 360 different scripts, that is.... I could have given him this and much more but again without additional hardware there would be no precision and no reliable repeat ability....
I wouldn't worry to much - the OP was scared off a long time ago with this convo
lol, that is what I said above, be well