Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Inertia.cpp
- Revision:
- 3:74f9d258c276
- Parent:
- 2:3596a3f574f3
- Child:
- 4:20aca0d86990
--- a/Inertia.cpp Sun Sep 15 17:40:24 2019 +0000
+++ b/Inertia.cpp Thu Sep 19 13:00:59 2019 +0000
@@ -44,25 +44,25 @@
inertia[1] + weight[1] * length[0]*length[0]*4 +
inertia[2] + weight[2] * l_base[0]*l_base[0] +
inertia[3] + weight[3] * l_base[1]*l_base[1] +
- inertia[4] + weight[4] * l_base[2]*l_base[2]) / ratio[0];
+ inertia[4] + weight[4] * l_base[2]*l_base[2]);
i_moment[1] = (inertia[5] + weight[0] * length[0]*length[0] +
inertia[6] + weight[1] * length[0]*length[0]*4 +
inertia[7] + weight[2] * l_base[0]*l_base[0] +
inertia[8] + weight[3] * l_base[1]*l_base[1] +
- inertia[9] + weight[4] * l_base[2]*l_base[2]) / ratio[1];
+ inertia[9] + weight[4] * l_base[2]*l_base[2]);
i_moment[2] = (inertia[7] + weight[2] * length[1]*length[1] +
inertia[8] + weight[3] * length[1]*length[1]*4 +
- inertia[9] + weight[4] * l_mid*l_mid) / ratio[2];
- i_moment[3] = (inertia[9] + weight[4] * length[2]*length[2]) / ratio[3];
+ inertia[9] + weight[4] * l_mid*l_mid);
+ i_moment[3] = (inertia[9] + weight[4] * length[2]*length[2]);
- gravity[0] = 0 / ratio[0];
+ gravity[0] = 0;
gravity[1] = (weight[0] * G * length[0] * cos(angle[1]) +
weight[1] * G * length[0]*2 * cos(angle[1]) +
weight[2] * G * (length[0]*2 * cos(angle[1]) + length[1] * cos(angle[1]+angle[2])) +
weight[3] * G * (length[0]*2 * cos(angle[1]) + length[1]*2 * cos(angle[1]+angle[2])) +
- weight[4] * G * (length[0]*2 * cos(angle[1]) + length[1]*2 * cos(angle[1]+angle[2]) + length[2] * cos(angle[1] + angle[2] + angle[3]))) / ratio[1];
+ weight[4] * G * (length[0]*2 * cos(angle[1]) + length[1]*2 * cos(angle[1]+angle[2]) + length[2] * cos(angle[1] + angle[2] + angle[3])));
gravity[2] = (weight[2] * G * length[1] * cos(angle[1]+angle[2]) +
weight[3] * G * length[1]*2 * cos(angle[1]+angle[2]) +
- weight[4] * G * (length[1]*2 * cos(angle[1]+angle[2]) + length[2] * cos(angle[1] + angle[2] + angle[3]))) / ratio[2];
- gravity[3] = (weight[4] * G * length[2] * cos(angle[1] + angle[2] + angle[3])) / ratio[3];
+ weight[4] * G * (length[1]*2 * cos(angle[1]+angle[2]) + length[2] * cos(angle[1] + angle[2] + angle[3])));
+ gravity[3] = (weight[4] * G * length[2] * cos(angle[1] + angle[2] + angle[3]));
}