using namespace std;
#include <string>
#include <vector>
+
#include "../communication/utils/Gcode.h"
#include "Planner.h"
class Planner;
+class Player;
+
+double max_allowable_speed( double acceleration, double target_velocity, double distance);
class Block {
public:
void append_gcode(Gcode* gcode);
void pop_and_execute_gcode(Kernel* &kernel);
double get_duration_left(unsigned int already_taken_steps);
- vector<std::string> commands;
+ void take();
+ void release();
+ void ready();
- unsigned short steps[3]; // Number of steps for each axis for this block
- float speeds[3]; // Speeds for each axis, used in the planning process
- unsigned short steps_event_count; // Steps for the longest axis
+ vector<std::string> commands;
+ vector<double> 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
float millimeters; // Distance for this move
- float entry_factor; // Starting speed for the block
- unsigned int rate_delta; // Nomber of steps to add to the speed for each acceleration tick
+ double entry_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 short accelerate_until; // Stop accelerating after this number of steps
- unsigned short decelerate_after; // Start decelerating after this number of steps
+ 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
+
+ double max_entry_speed;
Planner* planner;
+ Player* player;
+
+ 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.
+
};