}
// Add a stepper motor object to our list of steppers we must take care of
-StepperMotor* StepTicker::add_stepper_motor(StepperMotor* stepper_motor){
+Actuator* StepTicker::add_stepper_motor(Actuator* stepper_motor){
this->stepper_motors.push_back(stepper_motor);
stepper_motor->step_ticker = this;
this->has_axes = true;
// We make a list of steppers that want to be called so that we don't call them for nothing
-void StepTicker::add_motor_to_active_list(StepperMotor* motor)
+void StepTicker::add_motor_to_active_list(Actuator* motor)
{
uint32_t bm;
int i;
}
// Remove a stepper from the list of active motors
-void StepTicker::remove_motor_from_active_list(StepperMotor* motor)
+void StepTicker::remove_motor_from_active_list(Actuator* motor)
{
uint32_t bm; int i;
for (i = 0, bm = 1; i < 12; i++, bm <<= 1)
#include "libs/nuts_bolts.h"
#include "libs/Module.h"
#include "libs/Kernel.h"
-#include "libs/actuators/StepperMotor.h"
+#include "libs/actuators/Actuator.h"
class StepTicker{
public:
void set_frequency( double frequency );
void tick();
void signal_moves_finished();
- StepperMotor* add_stepper_motor(StepperMotor* stepper_motor);
+ Actuator* add_stepper_motor(Actuator* stepper_motor);
void set_reset_delay( double seconds );
void reset_tick();
- void add_motor_to_active_list(StepperMotor* motor);
- void remove_motor_from_active_list(StepperMotor* motor);
+ void add_motor_to_active_list(Actuator* motor);
+ void remove_motor_from_active_list(Actuator* motor);
double frequency;
- vector<StepperMotor*> stepper_motors;
+ vector<Actuator*> stepper_motors;
uint32_t delay;
uint32_t period;
uint32_t debug;
bool moves_finished;
bool reset_step_pins;
- StepperMotor* active_motors[12];
+ Actuator* active_motors[12];
uint32_t active_motor_bm;
};
#define ACTUATOR_H
#include "libs/Hook.h"
+#include "libs/StepTicker.h"
/* Actuator is the base class for all actuator-type things ( StepperMotors, ServoMotors etc ). */
+class StepTicker;
+
class Actuator {
public:
Actuator(){};
/* Functions all actuators must have are still to be defined, but here are a few bellow for a start */
- void tick();
- void step();
- void move_finished();
- void move( bool direction, unsigned int steps );
- void signal_move_finished();
- void set_speed( double speed );
- void update_exit_tick();
- void pause();
- void unpause();
+ void tick(){};
+ void step(){};
+ void move_finished(){};
+ void move( bool direction, unsigned int steps ){};
+ void signal_move_finished(){};
+ void set_speed( double speed ){};
+ void update_exit_tick(){};
+ void pause(){};
+ void unpause(){};
template<typename t> void attach( t *optr, uint32_t ( t::*fptr )( uint32_t ) ){
Hook* hook = new Hook();
bool signal_step;
uint32_t signal_step_number;
+ double steps_per_second;
+
+ volatile bool moving;
+ bool paused;
+
+ uint32_t steps_to_move;
+
+ StepTicker* step_ticker;
+ Pin* step_pin;
+ Pin* dir_pin;
+ Pin* en_pin;
+
+
+ uint32_t stepped;
+ uint32_t fx_counter;
+ uint32_t fx_ticks_per_step;
+
+ bool remove_from_active_list_next_reset;
+ bool is_move_finished; // Whether the move just finished
};
void update_exit_tick();
void pause();
void unpause();
-
-
+
StepTicker* step_ticker;
Pin* step_pin;
Pin* dir_pin;
Pin* en_pin;
- double steps_per_second;
-
- volatile bool moving;
- bool paused;
-
- uint32_t steps_to_move;
- uint32_t stepped;
- uint32_t fx_counter;
- uint32_t fx_ticks_per_step;
-
- bool remove_from_active_list_next_reset;
-
bool is_move_finished; // Whether the move just finished
};
#include "arm_solutions/BaseSolution.h"
#include "Planner.h"
#include "libs/Pin.h"
-#include "libs/actuators/StepperMotor.h"
+#include "libs/actuators/Actuator.h"
#include "RobotPublicAccess.h"
#define default_seek_rate_checksum CHECKSUM("default_seek_rate")
Pin gamma_dir_pin;
Pin gamma_en_pin;
- StepperMotor* alpha_stepper_motor;
- StepperMotor* beta_stepper_motor;
- StepperMotor* gamma_stepper_motor;
+ Actuator* alpha_stepper_motor;
+ Actuator* beta_stepper_motor;
+ Actuator* gamma_stepper_motor;
double seconds_per_minute; // for realtime speed change
};
#define STEPPER_H
#include "libs/Module.h"
#include "libs/Kernel.h"
+#include "libs/actuators/Actuator.h"
#include "Planner.h"
#include "Block.h"
bool enable_pins_status;
Hook* acceleration_tick_hook;
- StepperMotor* main_stepper;
+ Actuator* main_stepper;
};
#include "Endstops.h"
#include "libs/nuts_bolts.h"
#include "libs/Pin.h"
-#include "libs/actuators/StepperMotor.h"
+#include "libs/actuators/Actuator.h"
#include "wait_api.h" // mbed.h lib
Endstops::Endstops(){
#include "libs/Module.h"
#include "libs/Kernel.h"
#include "modules/communication/utils/Gcode.h"
-#include "libs/actuators/StepperMotor.h"
+#include "libs/actuators/Actuator.h"
#include "libs/Pin.h"
#define ALPHA_AXIS 0
void on_gcode_received(void* argument);
void on_config_reload(void* argument);
- StepperMotor* steppers[3];
+ Actuator* steppers[3];
Pin pins[6];
double slow_rates[3];
double fast_rates[3];
#include "modules/robot/Conveyor.h"
#include "modules/robot/Block.h"
#include "modules/tools/extruder/Extruder.h"
+#include "libs/actuators/StepperMotor.h"
#include <mri.h>
/* The extruder module controls a filament extruder for 3D printing: http://en.wikipedia.org/wiki/Fused_deposition_modeling
#include "libs/Module.h"
#include "libs/Kernel.h"
+#include "libs/actuators/Actuator.h"
#include "modules/robot/Block.h"
#define microseconds_per_step_pulse_checksum CHECKSUM("microseconds_per_step_pulse")
bool paused;
- StepperMotor* stepper_motor;
+ Actuator* stepper_motor;
};
#include "modules/robot/Conveyor.h"
#include "libs/Kernel.h"
#include "modules/communication/utils/Gcode.h"
-#include "libs/actuators/StepperMotor.h"
+#include "libs/actuators/Actuator.h"
#include "libs/Pin.h"
FILE* logfile;
string filename;
- StepperMotor* steppers[3];
+ Actuator* steppers[3];
Pin pin;
unsigned int debounce_count;