rename delta arm solutions
authorJim Morris <morris@wolfman.com>
Mon, 2 Jun 2014 20:20:46 +0000 (13:20 -0700)
committerJim Morris <morris@wolfman.com>
Mon, 2 Jun 2014 20:20:46 +0000 (13:20 -0700)
ConfigSamples/AzteegX5Mini.delta/config
ConfigSamples/Smoothieboard.delta/config [moved from ConfigSamples/Smoothieboard.Kossel/config with 99% similarity]
src/modules/robot/Robot.cpp
src/modules/robot/arm_solutions/ExperimentalDeltaSolution.cpp [moved from src/modules/robot/arm_solutions/RostockSolution.cpp with 68% similarity]
src/modules/robot/arm_solutions/ExperimentalDeltaSolution.h [new file with mode: 0644]
src/modules/robot/arm_solutions/LinearDeltaSolution.cpp [moved from src/modules/robot/arm_solutions/JohannKosselSolution.cpp with 89% similarity]
src/modules/robot/arm_solutions/LinearDeltaSolution.h [moved from src/modules/robot/arm_solutions/JohannKosselSolution.h with 77% similarity]
src/modules/robot/arm_solutions/RostockSolution.h [deleted file]

index 5a9d637..dd8a2c7 100644 (file)
@@ -1,6 +1,6 @@
 # Robot module configurations : general handling of movement G-codes and slicing into moves
 
-arm_solution                                 kossel           # delta selection
+arm_solution                                 linear_delta     # delta selection
 arm_length                                   370.00           # this is the length of an arm from hinge to hinge
 arm_radius                                   203.00           # this is the horiontal distance from hinge to hinge when the effector is centered
 
similarity index 99%
rename from ConfigSamples/Smoothieboard.Kossel/config
rename to ConfigSamples/Smoothieboard.delta/config
index 477f7e5..2b23f35 100644 (file)
@@ -12,7 +12,7 @@ delta_segments_per_second                    100              # for deltas only
 
 
 # Arm solution configuration : Cartesian robot. Translates mm positions into stepper positions
-arm_solution                                 kossel           # selects the kossel arm solution
+arm_solution                                 linear_delta     # selects the delta arm solution
 alpha_steps_per_mm                           100              # Steps per mm for alpha stepper
 beta_steps_per_mm                            100              # Steps per mm for beta stepper
 gamma_steps_per_mm                           100              # Steps per mm for gamma stepper
index 281da36..2caa5fb 100644 (file)
@@ -24,8 +24,7 @@ using std::string;
 #include "arm_solutions/BaseSolution.h"
 #include "arm_solutions/CartesianSolution.h"
 #include "arm_solutions/RotatableCartesianSolution.h"
-#include "arm_solutions/RostockSolution.h"
-#include "arm_solutions/JohannKosselSolution.h"
+#include "arm_solutions/LinearDeltaSolution.h"
 #include "arm_solutions/HBotSolution.h"
 #include "StepTicker.h"
 #include "checksumm.h"
@@ -49,6 +48,7 @@ using std::string;
 #define  cartesian_checksum                  CHECKSUM("cartesian")
 #define  rotatable_cartesian_checksum        CHECKSUM("rotatable_cartesian")
 #define  rostock_checksum                    CHECKSUM("rostock")
+#define  linear_delta_checksum               CHECKSUM("linear_delta")
 #define  delta_checksum                      CHECKSUM("delta")
 #define  hbot_checksum                       CHECKSUM("hbot")
 #define  corexy_checksum                     CHECKSUM("corexy")
@@ -151,15 +151,8 @@ void Robot::on_config_reload(void *argument)
     if(solution_checksum == hbot_checksum || solution_checksum == corexy_checksum) {
         this->arm_solution = new HBotSolution(THEKERNEL->config);
 
-    } else if(solution_checksum == rostock_checksum) {
-        this->arm_solution = new RostockSolution(THEKERNEL->config);
-
-    } else if(solution_checksum == kossel_checksum) {
-        this->arm_solution = new JohannKosselSolution(THEKERNEL->config);
-
-    } else if(solution_checksum ==  delta_checksum) {
-        // place holder for now
-        this->arm_solution = new RostockSolution(THEKERNEL->config);
+    } else if(solution_checksum == rostock_checksum || solution_checksum == kossel_checksum || solution_checksum == delta_checksum || solution_checksum ==  linear_delta_checksum) {
+        this->arm_solution = new LinearDeltaSolution(THEKERNEL->config);
 
     } else if(solution_checksum == rotatable_cartesian_checksum) {
         this->arm_solution = new RotatableCartesianSolution(THEKERNEL->config);
@@ -1,11 +1,23 @@
-#include "RostockSolution.h"
+#include "ExperimentalDeltaSolution.h"
+
 #include <fastmath.h>
-#include "checksumm.h"
 #include "ConfigValue.h"
+#include "libs/Kernel.h"
+#include "libs/nuts_bolts.h"
+#include "libs/Config.h"
+#include "checksumm.h"
+
+#define arm_length_checksum         CHECKSUM("arm_length")
+#define arm_radius_checksum         CHECKSUM("arm_radius")
+
+#define alpha_angle_checksum                CHECKSUM("alpha_angle")
+#define beta_relative_angle_checksum         CHECKSUM("beta_relative_angle")
+#define gamma_relative_angle_checksum        CHECKSUM("gamma_relative_angle")
 
 #define PIOVER180       0.01745329251994329576923690768489F
 
-RostockSolution::RostockSolution(Config* config)
+// NOTE this currently does not work, needs FK and settings
+ExperimentalDeltaSolution::ExperimentalDeltaSolution(Config* config)
 {
     float alpha_angle  = PIOVER180 * config->value(alpha_angle_checksum)->by_default(30.0f)->as_number();
     sin_alpha     = sinf(alpha_angle);
@@ -25,7 +37,7 @@ RostockSolution::RostockSolution(Config* config)
     arm_length_squared = powf(arm_length, 2);
 }
 
-void RostockSolution::cartesian_to_actuator( float cartesian_mm[], float actuator_mm[] ){
+void ExperimentalDeltaSolution::cartesian_to_actuator( float cartesian_mm[], float actuator_mm[] ){
     float alpha_rotated[3], rotated[3];
 
     if( sin_alpha == 0 && cos_alpha == 1){
@@ -44,15 +56,15 @@ void RostockSolution::cartesian_to_actuator( float cartesian_mm[], float actuato
     actuator_mm[GAMMA_STEPPER] = solve_arm( rotated );
 }
 
-void RostockSolution::actuator_to_cartesian( float actuator_mm[], float cartesian_mm[] ){
+void ExperimentalDeltaSolution::actuator_to_cartesian( float actuator_mm[], float cartesian_mm[] ){
     // unimplemented
 }
 
-float RostockSolution::solve_arm( float cartesian_mm[]) {
+float ExperimentalDeltaSolution::solve_arm( float cartesian_mm[]) {
     return sqrtf(arm_length_squared - powf(cartesian_mm[X_AXIS] - arm_radius, 2) - powf(cartesian_mm[Y_AXIS], 2)) + cartesian_mm[Z_AXIS];
 }
 
-void RostockSolution::rotate(float in[], float out[], float sin, float cos ){
+void ExperimentalDeltaSolution::rotate(float in[], float out[], float sin, float cos ){
     out[X_AXIS] = cos * in[X_AXIS] - sin * in[Y_AXIS];
     out[Y_AXIS] = sin * in[X_AXIS] + cos * in[Y_AXIS];
     out[Z_AXIS] = in[Z_AXIS];
diff --git a/src/modules/robot/arm_solutions/ExperimentalDeltaSolution.h b/src/modules/robot/arm_solutions/ExperimentalDeltaSolution.h
new file mode 100644 (file)
index 0000000..5479997
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef EXPERIMENTALDELTASOLUTION_H
+#define EXPERIMENTALDELTASOLUTION_H
+
+#include "BaseSolution.h"
+
+class Config;
+
+class ExperimentalDeltaSolution : public BaseSolution {
+    public:
+        ExperimentalDeltaSolution(Config*);
+        void cartesian_to_actuator( float[], float[] );
+        void actuator_to_cartesian( float[], float[] );
+
+        float solve_arm( float millimeters[] );
+        void rotate( float in[], float out[], float sin, float cos );
+
+    private:
+        float arm_length;
+        float arm_radius;
+        float arm_length_squared;
+
+        float sin_alpha;
+        float cos_alpha;
+        float sin_beta;
+        float cos_beta;
+        float sin_gamma;
+        float cos_gamma;
+};
+
+
+
+
+
+
+#endif // EXPERIMENTALDELTASOLUTION_H
@@ -1,4 +1,4 @@
-#include "JohannKosselSolution.h"
+#include "LinearDeltaSolution.h"
 #include <fastmath.h>
 #include "checksumm.h"
 #include "ConfigValue.h"
@@ -16,7 +16,7 @@
 #define SQ(x) powf(x, 2)
 #define ROUND(x, y) (roundf(x * 1e ## y) / 1e ## y)
 
-JohannKosselSolution::JohannKosselSolution(Config* config)
+LinearDeltaSolution::LinearDeltaSolution(Config* config)
 {
     // arm_length is the length of the arm from hinge to hinge
     arm_length         = config->value(arm_length_checksum)->by_default(250.0f)->as_number();
@@ -26,7 +26,7 @@ JohannKosselSolution::JohannKosselSolution(Config* config)
     init();
 }
 
-void JohannKosselSolution::init() {
+void LinearDeltaSolution::init() {
     arm_length_squared = SQ(arm_length);
 
     // Effective X/Y positions of the three vertical towers.
@@ -45,7 +45,7 @@ void JohannKosselSolution::init() {
     DELTA_TOWER3_Y = DELTA_RADIUS;
 }
 
-void JohannKosselSolution::cartesian_to_actuator( float cartesian_mm[], float actuator_mm[] )
+void LinearDeltaSolution::cartesian_to_actuator( float cartesian_mm[], float actuator_mm[] )
 {
     actuator_mm[ALPHA_STEPPER] = sqrtf(this->arm_length_squared
                                 - SQ(DELTA_TOWER1_X - cartesian_mm[X_AXIS])
@@ -61,7 +61,7 @@ void JohannKosselSolution::cartesian_to_actuator( float cartesian_mm[], float ac
                                 ) + cartesian_mm[Z_AXIS];
 }
 
-void JohannKosselSolution::actuator_to_cartesian( float actuator_mm[], float cartesian_mm[] )
+void LinearDeltaSolution::actuator_to_cartesian( float actuator_mm[], float cartesian_mm[] )
 {
     // from http://en.wikipedia.org/wiki/Circumscribed_circle#Barycentric_coordinates_from_cross-_and_dot-products
     // based on https://github.com/ambrop72/aprinter/blob/2de69a/aprinter/printer/DeltaTransform.h#L81
@@ -100,7 +100,7 @@ void JohannKosselSolution::actuator_to_cartesian( float actuator_mm[], float car
     cartesian_mm[2] = ROUND(cartesian[2], 4);
 }
 
-bool JohannKosselSolution::set_optional(const arm_options_t& options) {
+bool LinearDeltaSolution::set_optional(const arm_options_t& options) {
 
     arm_options_t::const_iterator i;
 
@@ -117,7 +117,7 @@ bool JohannKosselSolution::set_optional(const arm_options_t& options) {
     return true;
 }
 
-bool JohannKosselSolution::get_optional(arm_options_t& options) {
+bool LinearDeltaSolution::get_optional(arm_options_t& options) {
     options['L']= this->arm_length;
     options['R']= this->arm_radius;
     return true;
@@ -1,13 +1,13 @@
-#ifndef JOHANNKOSSELSOLUTION_H
-#define ROSTOCKSOLUTION_H
+#ifndef LINEARDELTASOLUTION_H
+#define LINEARDELTASOLUTION_H
 #include "libs/Module.h"
 #include "BaseSolution.h"
 
 class Config;
 
-class JohannKosselSolution : public BaseSolution {
+class LinearDeltaSolution : public BaseSolution {
     public:
-        JohannKosselSolution(Config*);
+        LinearDeltaSolution(Config*);
         void cartesian_to_actuator( float[], float[] );
         void actuator_to_cartesian( float[], float[] );
 
@@ -28,4 +28,4 @@ class JohannKosselSolution : public BaseSolution {
         float DELTA_TOWER3_X;
         float DELTA_TOWER3_Y;
 };
-#endif // JOHANNKOSSELSOLUTION_H
+#endif // LINEARDELTASOLUTION_H
diff --git a/src/modules/robot/arm_solutions/RostockSolution.h b/src/modules/robot/arm_solutions/RostockSolution.h
deleted file mode 100644 (file)
index 88e7465..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef ROSTOCKSOLUTION_H
-#define ROSTOCKSOLUTION_H
-#include "libs/Module.h"
-#include "libs/Kernel.h"
-#include "BaseSolution.h"
-#include "libs/nuts_bolts.h"
-
-#include "libs/Config.h"
-
-#define arm_length_checksum         CHECKSUM("arm_length")
-#define arm_radius_checksum         CHECKSUM("arm_radius")
-
-#define alpha_angle_checksum                CHECKSUM("alpha_angle")
-#define beta_relative_angle_checksum         CHECKSUM("beta_relative_angle")
-#define gamma_relative_angle_checksum        CHECKSUM("gamma_relative_angle")
-
-class RostockSolution : public BaseSolution {
-    public:
-        RostockSolution(Config*);
-        void cartesian_to_actuator( float[], float[] );
-        void actuator_to_cartesian( float[], float[] );
-
-        float solve_arm( float millimeters[] );
-        void rotate( float in[], float out[], float sin, float cos );
-
-        float arm_length;
-        float arm_radius;
-        float arm_length_squared;
-
-        float sin_alpha;
-        float cos_alpha;
-        float sin_beta;
-        float cos_beta;
-        float sin_gamma;
-        float cos_gamma;
-};
-
-
-
-
-
-
-#endif // ROSTOCKSOLUTION_H