After assembled with success my first hexapod,phoenix, I wanted to work for to add the capacity to have a balancing body.
I imagine that for to do it i need to add same other electronic thing,isnt’it?!
And then?
Can sameone help me about it?
Thanx
The two are not the same thing. The balance mode in the hex code balances the body height with the leg positions and has nothing to do with leveling the body. It sounds more like he wants a self leveling body on his hex. He might need an accelerometer.
Oh yes,maybe my english is not so good,and samethimes is hard for me to explane well what i mean.
So yes,I wanted to add a self leveling body on my hex, so I need to put an accelerometer on it,but how?!
I don’t know how connect it to bb2 , and i need to add same codes to corrent code that run on hex?
Yes it’s pretty easy to add an accelerometer to the Bot Board II, but the programming will be more challenging. I would try to add the sensor to the code so it reads them into variables each pass, then I would incorporate them into the proper variables that set the body angles relative to the ground plane.
Yes, the software’s where the major effort is. Reading the values into variables is not complicated, but what is done with the info can be…
I believe it amounts to a translation vector, i.e., some vector addition. I have a new compass/GPS/accelerometer module coming, so I get to play with those numbers, however that may be a little while. If I find any examples, I’ll post links to them. Looking up IMU might help. The first place I’m going to look is: “Arduino accelerometer shield”. Or maybe “Arduino IMU library”.
I have wanted to do this for a while as an idea. When I bought the device I was really interested to learn how they worked. I connected 5volts to it and put a volt meter on the output lines and when I shook the device the voltage changed.
It would seem to me that you would need something running multiple loops though code and sampling the values constantly and any change would be reflected in the acceleration value.
I thought you could power the device and as you change the direction the voltage would always be different unless you were in the same physical orientation from when it was powered on.
not sure if you can do that with the botboard… is it even fast enough??? if so I’d like to see how its done in code.
You could do it with a single loop. Read the three A/Ds quickly, do you comps, then display or do whatever with the output.
A little more advanced solution would use periodic interrupts to do the A/D conversions in the background.
The amount of acceleration felt by the three axis depends on their orientation to the direction of travel. If the XY (horizontal) plane is kept parallel to the ground (perpendicular to the local vertical), then Z always feels (measures) gravity (32.2 F/S). If one ACCELERATES exactly along the axis of the X accelerometer, then X measures that acceleration, and Y gets nothing. Converse if the acceleration is strictly along the Y. Z will not be affected. One could also add to or subtract from the Z acceleration (jump up and down). As motion of the 'bot is probably going to be a mix of XY &Z motions, then the motions must be combined by vector addition.
More later, as I get back in a little deeper into this.
If you are using the phoenix code the programming will be much easier. The phoenix code already supports body rotations. It reads the input from the remote and does all the IK stuff to get the body in a certain angle.
What you have to do is redirect the inputs from the remote for body rotations X and Z, to the accelerator sensor. If the sensor reads an angle, the module can simulate the remote input for body rotation.
You need to dig trough the phoenix code. Once you got the hang of it, it will be pretty easy to add.
I don’t have the time to write you the code. What I can do is help you by giving you the steps you should focus on. This will need some serious tweaking since I did not test or try this.
Connect the sensor the the analog inputs of the BAP and try to read the inputs. See the BAP manual about how to do this. Start with an empty program to keep it simple.
The analog input from the sensor will give you a large number. You need to convert this to something you can use in the Phoenix code. Convert the value in such a way that on a horizontal level, the sensor gives 0 in both directions. This can be done by adding an offset (example: if the analog input gives you 0-1024, add 512 to get is from -511 to +512)
The Phoenix can do a body rotation from about 30 deg? (You should check this) The min and max range of the remote input is +/- 128. So you need to adjust the range of the sensor that it gives -128 if it is hold in an angle of -30 deg. And 128 if it is hold in an angle of +30 deg.
Load the Phoenix code and connect both sensor inputs to the variables BodyRotX and BodyRotZ.
Thanx xan for ur help!
U r always ready to help…for now,with my actual knowledges about that things i prefere to don’t try…
I want to play with my hex phoenix for another bit
Cause point 2 end 3 for now i don’t understand so much…
Ohh really thanx friend ,for me is like gold this peace of code,
Thanx again!!!
So now I’ve to put that code in the phoenix code right?,I’ve to cancel samething about it?..at what point I’ve to put it inside the phoenix code?
This will help you to read the Accelerometer so that you can understand how it works then you will need to apply the code to your robot.
I had a bot that was setup for the Accelerometer I think with the Phoenix 1.3 code and if I find it I will post for you…but you will still need to study the code for the Phoenix to better understand what is happening and how things work. It will take a bit of your time on your part but it’s not that hard. Read the postings on this forum and you can find everything that you need plus.