Remove kienmatics.{c,h}
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 29 Mar 2016 12:33:23 +0000 (05:33 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 29 Mar 2016 12:33:23 +0000 (05:33 -0700)
src/plan/exec.c
src/plan/jog.c
src/plan/kinematics.c [deleted file]
src/plan/kinematics.h [deleted file]
src/plan/planner.c
src/plan/planner.h

index 66a2c66de348a36e6ac31d667e0deffe04821556..f360ef77ed428070228d9e3656d3dcae56d75f97 100644 (file)
@@ -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++)
index 206f7c8aa4eeaad8a22d0537eaf53742c81820b5..37d6e88e55424d2d30ae7bca1410d88167e73144 100644 (file)
@@ -32,7 +32,6 @@
 #include "stepper.h"
 #include "motor.h"
 #include "canonical_machine.h"
-#include "kinematics.h"
 #include "motor.h"
 
 #include <stdbool.h>
@@ -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 (file)
index 55ae593..0000000
+++ /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 <http://www.gnu.org/licenses/>.
-
-     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
-                       <http://www.gnu.org/licenses/>.
-
-                For information regarding this software email:
-                  "Joseph Coffland" <joseph@buildbotics.com>
-
-\******************************************************************************/
-
-#include "kinematics.h"
-
-#include "canonical_machine.h"
-#include "motor.h"
-
-#include <string.h>
-
-/* 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 (file)
index 0c0df0f..0000000
+++ /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 <http://www.gnu.org/licenses/>.
-
-     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
-                       <http://www.gnu.org/licenses/>.
-
-                For information regarding this software email:
-                  "Joseph Coffland" <joseph@buildbotics.com>
-
-\******************************************************************************/
-
-#pragma once
-
-
-void ik_kinematics(const float travel[], float steps[]);
index fa48ecc79bb56335e4c30cfcc62aa20ac3a58c3a..04575b67e33ccdad841bdc6d34e9a951943037a3 100644 (file)
@@ -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);
+  }
+}
index f8f4456d1568f25b642e1f19b48a3ca3a0dd12e5..f7cb19116121950739e7f36358c95f0fd01c0029 100644 (file)
@@ -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[]);