From: Joseph Coffland Date: Tue, 29 Mar 2016 12:33:23 +0000 (-0700) Subject: Remove kienmatics.{c,h} X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=1fbf73c2b91e7f917976f537e196a2fe07207773;p=bbctrl-firmware Remove kienmatics.{c,h} --- diff --git a/src/plan/exec.c b/src/plan/exec.c index 66a2c66..f360ef7 100644 --- a/src/plan/exec.c +++ b/src/plan/exec.c @@ -29,7 +29,6 @@ #include "planner.h" #include "buffer.h" -#include "kinematics.h" #include "stepper.h" #include "motor.h" #include "util.h" @@ -782,7 +781,7 @@ static stat_t _exec_aline_segment() { } // now determine the target steps - ik_kinematics(mr.ms.target, mr.target_steps); + mp_kinematics(mr.ms.target, mr.target_steps); // and compute the distances to be traveled for (i = 0; i < MOTORS; i++) diff --git a/src/plan/jog.c b/src/plan/jog.c index 206f7c8..37d6e88 100644 --- a/src/plan/jog.c +++ b/src/plan/jog.c @@ -32,7 +32,6 @@ #include "stepper.h" #include "motor.h" #include "canonical_machine.h" -#include "kinematics.h" #include "motor.h" #include @@ -102,7 +101,7 @@ static stat_t _exec_jog(mpBuf_t *bf) { // Convert to steps float steps[MOTORS] = {0}; - ik_kinematics(travel, steps); + mp_kinematics(travel, steps); // Queue segment float error[MOTORS] = {0}; diff --git a/src/plan/kinematics.c b/src/plan/kinematics.c deleted file mode 100644 index 55ae593..0000000 --- a/src/plan/kinematics.c +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics firmware. - - Copyright (c) 2015 - 2016 Buildbotics LLC - Copyright (c) 2010 - 2015 Alden S. Hart, Jr. - All rights reserved. - - This file ("the software") is free software: you can redistribute it - and/or modify it under the terms of the GNU General Public License, - version 2 as published by the Free Software Foundation. You should - have received a copy of the GNU General Public License, version 2 - along with the software. If not, see . - - The software is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the software. If not, see - . - - For information regarding this software email: - "Joseph Coffland" - -\******************************************************************************/ - -#include "kinematics.h" - -#include "canonical_machine.h" -#include "motor.h" - -#include - -/* Wrapper routine for inverse kinematics - * - * Calls kinematics function(s). Performs axis mapping & conversion - * of length units to steps (and deals with inhibited axes) - * - * The reason steps are returned as floats (as opposed to, say, - * uint32_t) is to accommodate fractional DDA steps. The DDA deals - * with fractional step values as fixed-point binary in order to get - * the smoothest possible operation. Steps are passed to the move prep - * routine as floats and converted to fixed-point binary during queue - * loading. See stepper.c for details. - */ -void ik_kinematics(const float travel[], float steps[]) { - // you can insert inverse kinematics transformations here - // float joint[AXES]; - // _inverse_kinematics(travel, joint); - // ...or just use travel directly for Cartesian machines - - // Map motors to axes and convert length units to steps - // Most of the conversion math has already been done during config in - // steps_per_unit() which takes axis travel, step angle and microsteps into - // account. - for (int motor = 0; motor < MOTORS; motor++) { - int axis = motor_get_axis(motor); - if (cm.a[axis].axis_mode == AXIS_INHIBITED) steps[motor] = 0; - else steps[motor] = travel[axis] * motor_get_steps_per_unit(motor); - } -} diff --git a/src/plan/kinematics.h b/src/plan/kinematics.h deleted file mode 100644 index 0c0df0f..0000000 --- a/src/plan/kinematics.h +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics firmware. - - Copyright (c) 2015 - 2016 Buildbotics LLC - Copyright (c) 2010 - 2015 Alden S. Hart, Jr. - All rights reserved. - - This file ("the software") is free software: you can redistribute it - and/or modify it under the terms of the GNU General Public License, - version 2 as published by the Free Software Foundation. You should - have received a copy of the GNU General Public License, version 2 - along with the software. If not, see . - - The software is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the software. If not, see - . - - For information regarding this software email: - "Joseph Coffland" - -\******************************************************************************/ - -#pragma once - - -void ik_kinematics(const float travel[], float steps[]); diff --git a/src/plan/planner.c b/src/plan/planner.c index fa48ecc..04575b6 100644 --- a/src/plan/planner.c +++ b/src/plan/planner.c @@ -62,7 +62,6 @@ #include "buffer.h" #include "arc.h" #include "canonical_machine.h" -#include "kinematics.h" #include "stepper.h" #include "motor.h" @@ -127,7 +126,7 @@ void mp_set_steps_to_runtime_position() { float step_position[MOTORS]; // convert lengths to steps in floating point - ik_kinematics(mr.position, step_position); + mp_kinematics(mr.position, step_position); for (uint8_t motor = 0; motor < MOTORS; motor++) { mr.target_steps[motor] = step_position[motor]; @@ -174,3 +173,29 @@ float mp_get_runtime_work_position(uint8_t axis) { uint8_t mp_get_runtime_busy() { return st_runtime_isbusy() || mr.move_state == MOVE_RUN; } + + +/* Performs axis mapping & conversion of length units to steps (and deals + * with inhibited axes) + * + * The reason steps are returned as floats (as opposed to, say, + * uint32_t) is to accommodate fractional steps. stepper.c deals + * with fractional step values as fixed-point binary in order to get + * the smoothest possible operation. Steps are passed to the move prep + * routine as floats and converted to fixed-point binary during queue + * loading. See stepper.c for details. + */ +void mp_kinematics(const float travel[], float steps[]) { + // You could insert inverse kinematics transformations here + // or just use travel directly for Cartesian machines. + + // Map motors to axes and convert length units to steps + // Most of the conversion math has already been done during config in + // steps_per_unit() which takes axis travel, step angle and microsteps into + // account. + for (int motor = 0; motor < MOTORS; motor++) { + int axis = motor_get_axis(motor); + if (cm.a[axis].axis_mode == AXIS_INHIBITED) steps[motor] = 0; + else steps[motor] = travel[axis] * motor_get_steps_per_unit(motor); + } +} diff --git a/src/plan/planner.h b/src/plan/planner.h index f8f4456..f7cb191 100644 --- a/src/plan/planner.h +++ b/src/plan/planner.h @@ -132,3 +132,4 @@ float mp_get_runtime_absolute_position(uint8_t axis); void mp_set_runtime_work_offset(float offset[]); void mp_zero_segment_velocity(); uint8_t mp_get_runtime_busy(); +void mp_kinematics(const float travel[], float steps[]);