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.
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
kinematics.cpp
- Committer:
- joostbonekamp
- Date:
- 2019-10-07
- Revision:
- 14:4cf17b10e504
- Child:
- 15:9a1f34bc9958
File content as of revision 14:4cf17b10e504:
void kinematics1() //
{
double length_1;
double theta;
double length_2;
class H_matrix //rows_columns (als je het niet ziet, gebruik dat de onderste rij 0 0 1 is)
{
public:
int h1_1_1 = 1;
int h1_1_2 = 0;
float h1_1_3 = sin(theta*PI/180)*(length_1+length_2); //sinus en cosinus zijn standaard gedefinieërd in radians, maar theta is hier dus in graden
int h1_2_1 = 0;
int h1_2_2 = 1;
float h1_2_3 = cos(theta*PI/180)*(length_1+length_2);
int h1_3_1 = 0;
int h1_3_2 = 0;
int h1_3_3 = 1;
}
H_matrix H;
class Position_vector1 //positie vector gezien vanuit het uiteinde van de complete arm (coördinatiestelsel draait niet mee met de arm)
{
public:
float p1_1_1
float p1_2_1
float p1_3_1
}
class Position_vector2
{
public:
float p2_1_1 = h1_1_1*p1_1_1 + h1_1_2*p1_2_1 + h1_1_3*p1_3_1;
float p2_2_1 = h1_2_1*p1_1_1 + h1_2_2*p1_2_1 + h1_2_3*p1_3_1;
float p2_3_1 = h1_3_1*p1_1_1 + h1_3_2*p1_2_1 + h1_3_3*p1_3_1;
}
}
void kinematics2() //
{
double length_1;
volatile double theta;
volatile double length_2;
class H_matrix2 //rows_columns (als je het niet ziet, gebruik dat de onderste rij 0 0 1 is)
{
public:
int h2_1_1 = 1;
int h2_1_2 = 0;
float h2_1_3 = -sin(theta*PI/180)*(length_1+length_2); //sinus en cosinus zijn standaard gedefinieërd in radians, maar theta is hier dus in graden
int h2_2_1 = 0;
int h2_2_2 = 1;
float h2_2_3 = -cos(theta*PI/180)*(length_1+length_2);
int h2_3_1 = 0;
int h2_3_2 = 0;
int h2_3_3 = 1;
}
H_matrix H;
class Position_vector3 //positie vector gezien vanuit het onderste draaipunt
{
public:
float p3_1_1;
float p3_2_1;
float p3_3_1;
}
class Position_vector4
{
public:
float p4_1_1 = h2_1_1*p3_1_1 + h2_1_2*p3_2_1 + h2_1_3*p3_3_1;
float p4_2_1 = h2_2_1*p1_1_1 + h2_2_2*p1_2_1 + h2_2_3*p3_3_1;
float p4_3_1 = h2_3_1*p1_1_1 + h2_3_2*p1_2_1 + h2_3_3*p3_3_1;
}
H_matrix2 H2
}