Work I completed
This week I was less focussed on making more progress on any physical of software aspect of my project, but rather looking more into theory and developing a better concept of what my design will consist of. I decided to talk with my teacher more about what I will need to do for this project. IK, while not simple, has multiple solutions, and I just need to find how to incorporate it into my design. The issue is that there is currently no way for Winston to know where he needs to go, and so I have no external data for where the endpoint target for each leg should be. On top of that, I need a way to check if the legs have gone wherever the program has wanted them to go.
The solution to the first of these problems is likely in LiDAR – Light Detection and Ranging, a system that uses a pulsating laser to determine distances and measure the range of objects. Without having looked too much into getting this, the initial concerns are that it may be expensive, and heavy. I don’t think it’ll be too expensive to buy a basic one, which is all I would need, so this is less of a concern to me. The bigger concern is that it may be very heavy, and I will have to redesign parts of Winston’s chassis to accommodate for this new weight.
The solution to the second problem is also relatively simple and lies in accelerometers. Accelerometers are capable of measuring the motion of an object. If I attach an accelerometer to each joint that needs to move, then reading data from the accelerometers should be able to tell the machine whether they have gone the required distance or not. The concerns I have with these are that I will need eight of them to measure each part of each limb, and having not looked too much into these, I do not know how much power this will require. If their size is any indication, then it shouldn’t take too much more power to use this in conjunction with the rest of the robot. Additionally, the accelerometers will have to be very accurate in order to be of any use. Once again, I have not done enough testing to decide whether the GY-61 accelerometer which I have access to are accurate enough, and I will continue to test in the coming weeks to come to a conclusion on that.
Accelerometers are something that I haven’t used yet, and I know very little about the logic or code that goes with one of these. Because of that, I spent some of this week playing around with one to try and understand better how they work. The first issue I came across while trying to code one is that all the places, I looked for examples to see what to do to read data used libraries which I couldn’t find in the Arduino Library Manager. I did learn more about how libraries in Arduino work though, as I found how to create a library, and although I still failed to import it, it showed me a lot about how to incorporate C and C++. It turns out that all of this seemed pointless when I realised I could just use analogRead() to get the input of the x, y, and z coordinates, although I did find a way to get roll and pitch too, which I am not sure is useful yet but definitely shouldn’t hurt to have more possible data.
1. void loop() {
2. int x_adc_value, y_adc_value, z_adc_value;
3. double x_g_value, y_g_value, z_g_value;
4. double roll, pitch, yaw;
5. x_adc_value = analogRead(x_out); // Digital value of voltage on x_out pin
6. y_adc_value = analogRead(y_out); // Digital value of voltage on y_out pin
7. z_adc_value = analogRead(z_out); // Digital value of voltage on z_out pin
8. x_g_value = ((((double)(x_adc_value * 5)/1024) - 1.65)/0.330); // Acceleration in x-direction in g units
9. y_g_value = ((((double)(y_adc_value * 5)/1024) - 1.65)/0.330); // Acceleration in y-direction in g units
10. z_g_value = ((((double)(z_adc_value * 5)/1024) - 1.80)/0.330); // Acceleration in z-direction in g units
11.
12. roll = (((atan2(y_g_value,z_g_value) * 180)/3.14) + 180); // Formula for roll
13. pitch = (((atan2(z_g_value,x_g_value) * 180)/3.14) + 180); // Formula for pitch
Using this code I was successfully able to read the data coming in from the accelerometer, and it seems useful, but I will need to do more to find how precise it is.
Reflection
I feel that I could have completed far more work than I have this week in terms of developing more of the physical prototype for different parts, but at the same time I think I have done a lot more when it comes to thinking about the design as a whole and coming up with solutions and knowing what I will need to do this term so I can have it done by the end of the semester.
I feel like this week I have learnt a bit more different content than what I would normally look into. I never really thought about libraries, just which ones I need to install, and I believe this is the first time I have seen what a library looks like, and seeing how simple it is, and understanding more about how to import and use them means that if I needed something that I couldn’t find online, I could possibly create something custom to my needs.