Allow TABS in config
[clinton/Smoothieware.git] / src / modules / robot / Block.h
index 8210db5..63dd144 100644 (file)
@@ -9,58 +9,66 @@
 #define BLOCK_H
 #include "libs/Module.h"
 #include "libs/Kernel.h"
+#include "Gcode.h"
+
 using namespace std;
 #include <string>
 #include <vector>
 
-#include "../communication/utils/Gcode.h"
-#include "Planner.h"
-class Planner;
-class Conveyor;
 
-double max_allowable_speed( double acceleration, double target_velocity, double distance);
+
+float max_allowable_speed( float acceleration, float target_velocity, float distance);
 
 class Block {
     public:
         Block();
-        void calculate_trapezoid( double entry_factor, double exit_factor );
-        double estimate_acceleration_distance( double initial_rate, double target_rate, double acceleration );
-        double intersection_distance(double initial_rate, double final_rate, double acceleration, double distance);
-        void reverse_pass(Block* previous, Block* next);
-        void forward_pass(Block* previous, Block* next);
-        void debug(Kernel* kernel);
+        void calculate_trapezoid( float entry_speed, float exit_speed );
+        float estimate_acceleration_distance( float initial_rate, float target_rate, float acceleration );
+        float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance);
+        float get_duration_left(unsigned int already_taken_steps);
+
+        float reverse_pass(float exit_speed);
+        float forward_pass(float next_entry_speed);
+
+        float max_exit_speed();
+
+        void debug();
+
         void append_gcode(Gcode* gcode);
-        void pop_and_execute_gcode(Kernel* &kernel);
-        double get_duration_left(unsigned int already_taken_steps);
+
         void take();
         void release();
+
         void ready();
 
-        vector<std::string> commands;
-        vector<double> travel_distances;
-        vector<Gcode*> gcodes;
+        void clear();
+
+        void begin();
+
+        //vector<std::string> commands;
+        //vector<float> travel_distances;
+        vector<Gcode> gcodes;
 
         unsigned int   steps[3];           // Number of steps for each axis for this block
         unsigned int   steps_event_count;  // Steps for the longest axis
-        unsigned int   nominal_rate;       // Nominal rate in steps per minute
-        float          nominal_speed;      // Nominal speed in mm per minute
+        unsigned int   nominal_rate;       // Nominal rate in steps per second
+        float          nominal_speed;      // Nominal speed in mm per second
         float          millimeters;        // Distance for this move
-        double         entry_speed;
+        float          entry_speed;
+        float          exit_speed;
         float          rate_delta;         // Nomber of steps to add to the speed for each acceleration tick
-        unsigned int   initial_rate;       // Initial speed in steps per minute
-        unsigned int   final_rate;         // Final speed in steps per minute
+        unsigned int   initial_rate;       // Initial speed in steps per second
+        unsigned int   final_rate;         // Final speed in steps per second
         unsigned int   accelerate_until;   // Stop accelerating after this number of steps
         unsigned int   decelerate_after;   // Start decelerating after this number of steps
         unsigned int   direction_bits;     // Direction for each axis in bit form, relative to the direction port's mask
 
 
-        uint8_t recalculate_flag; // Planner flag to recalculate trapezoids on entry junction
-        uint8_t nominal_length_flag; // Planner flag for nominal speed always reached
+        bool recalculate_flag;             // Planner flag to recalculate trapezoids on entry junction
+        bool nominal_length_flag;          // Planner flag for nominal speed always reached
+
+        float max_entry_speed;
 
-        double max_entry_speed;
-        Planner* planner;
-        Conveyor*  conveyor;
-        
         bool is_ready;
 
         short times_taken;    // A block can be "taken" by any number of modules, and the next block is not moved to until all the modules have "released" it. This value serves as a tracker.
@@ -68,13 +76,4 @@ class Block {
 };
 
 
-
-
-
-
-
-
-
-
-
 #endif