Code: Select all
class Joint {
public:
// Constants / Inputs
Vector3f LINK_LENGTH;
Vector3f AXIS;
Vector3f HOME_POS;
// Constants / Derived
Screw SCREW_AXIS_SPACE;
Screw SCREW_AXIS_EE;
// Variables
float JOINT_POS;
Transformation HOME_CONFIG = Matrix4f::Identity();
Transformation SPACE_CONFIG;
Transformation SCREW_SPACE_EXP_CONFIG;
Transformation SCREW_EE_EXP_CONFIG;
Jacobian JACOBIAN = MatrixXf::Zero(6,6);
Jacobian PINV_JACOBIAN = MatrixXf::Zero(6, 6);
/*
* METHODS ------------------------------------------------------
*/
// Constructor
Joint(Vector3f linklength, Vector3f axis);
// Methods
void JOINT_INIT(Vector3f displacem);
// Destructor
~Joint();
};
Im trying to create 7 objects of this class however I'm only able to create two until the stm32 stops working. Main function looks as:
Code: Select all
int main(void) {
/*
--------------------------------------------||| HARDWARE SETUP STAGE |||--------------------------------------------
*/
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
palSetPadMode(GPIOA, 2U, PAL_MODE_ALTERNATE(7) | PAL_STM32_OSPEED_HIGHEST |
PAL_STM32_OTYPE_PUSHPULL);
palSetPadMode(GPIOA, 3U, PAL_MODE_ALTERNATE(7) | PAL_STM32_OSPEED_HIGHEST |
PAL_STM32_OTYPE_PUSHPULL);
PeripheralInit();
// /*
// --------------------------------------------||| SETUP STAGE |||---------------------------------------------
// */
// 1. Joint Definitions -------------------------------------------------------------------------------------------
Joint A(Vector3f(0.0f, 0.0f, 0.0f), Vector3f(0.0f, 0.0f, 1.0f));
Joint B(Vector3f(0.0f, 0.0f, 1.7f), Vector3f(1.0f, 0.0f, 0.0f));
// Joint C(Vector3f(0.0f, 0.0f, 1.8f), Vector3f(1.0f, 0.0f, 0.0f));
// Joint D(Vector3f(0.0f, 0.0f, 0.0f), Vector3f(0.0f, 0.0f, 1.0f));
// Joint E(Vector3f(0.0f, 0.0f, 0.0f), Vector3f(1.0f, 0.0f, 0.0f));
// Joint F(Vector3f(0.0f, 0.0f, 0.0f), Vector3f(1.0f, 0.0f, 0.0f));
// Joint END_EFFECTOR(Vector3f(0.0f, 0.0f, 0.0f), Vector3f(0.0f, 0.0f, 0.0f));
while (1) {
palSetLine(LINE_LED1);
chThdSleepMilliseconds(50);
palSetLine(LINE_LED2);
chThdSleepMilliseconds(50);
palSetLine(LINE_LED3);
chThdSleepMilliseconds(200);
palClearLine(LINE_LED1);
chThdSleepMilliseconds(50);
palClearLine(LINE_LED2);
chThdSleepMilliseconds(50);
palClearLine(LINE_LED3);
chThdSleepMilliseconds(200);
}
}
I've commented out the 'Joint' declerations after 'Joint B' as the leds blink up until this point as per the while loop. When I uncomment the 'Joint C' decleration the program gets stuck. Debugging line by line with openOCD (When there are 3 or more 'Joints' declared) causes the debugger to get stuck at random lines mainly during 'halInit()'.
I know this an issue to do with memory however the H7A3 is pretty beefy and should easily be able to handle this. Is this an issue to do with chibiOS not allocating more memory?
What is causing this and how do i fix it ?