small fixes after testing on real hardware. Still no chaining of motions and something odd with arcs

This commit is contained in:
Simen Svale Skogsrud 2011-02-03 10:42:00 +01:00
parent 420641d13d
commit 4b63cf3ab5
4 changed files with 14 additions and 6 deletions

View File

@ -133,6 +133,6 @@ void store_setting(int parameter, double value);
#define DEFAULT_STEPPING_INVERT_MASK 0 #define DEFAULT_STEPPING_INVERT_MASK 0
// The temporal resolution of the acceleration management subsystem // The temporal resolution of the acceleration management subsystem
#define ACCELERATION_TICKS_PER_SECOND 10L #define ACCELERATION_TICKS_PER_SECOND 20L
#endif #endif

View File

@ -31,10 +31,12 @@
// The current position of the tool in absolute steps // The current position of the tool in absolute steps
int32_t position[3]; int32_t position[3];
int8_t acceleration_management_enabled;
void mc_init() void mc_init()
{ {
clear_vector(position); clear_vector(position);
acceleration_management_enabled = TRUE;
} }
void mc_dwell(uint32_t milliseconds) void mc_dwell(uint32_t milliseconds)
@ -49,6 +51,7 @@ void mc_set_acceleration_manager_enabled(uint8_t enabled) {
} else { } else {
plan_disable_acceleration_management(); plan_disable_acceleration_management();
} }
acceleration_management_enabled = enabled;
} }
// Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second // Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second
@ -93,6 +96,7 @@ void mc_line(double x, double y, double z, double feed_rate, int invert_feed_rat
void mc_arc(double theta, double angular_travel, double radius, double linear_travel, int axis_1, int axis_2, void mc_arc(double theta, double angular_travel, double radius, double linear_travel, int axis_1, int axis_2,
int axis_linear, double feed_rate, int invert_feed_rate) int axis_linear, double feed_rate, int invert_feed_rate)
{ {
//plan_disable_acceleration_management(); // disable acceleration management for the duration of the arc
double millimeters_of_travel = hypot(angular_travel*radius, labs(linear_travel)); double millimeters_of_travel = hypot(angular_travel*radius, labs(linear_travel));
if (millimeters_of_travel == 0.0) { return; } if (millimeters_of_travel == 0.0) { return; }
uint16_t segments = ceil(millimeters_of_travel/settings.mm_per_arc_segment); uint16_t segments = ceil(millimeters_of_travel/settings.mm_per_arc_segment);
@ -119,6 +123,7 @@ void mc_arc(double theta, double angular_travel, double radius, double linear_tr
target[axis_2] = center_y+cos(theta)*radius; target[axis_2] = center_y+cos(theta)*radius;
mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], feed_rate, invert_feed_rate); mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], feed_rate, invert_feed_rate);
} }
//mc_set_acceleration_manager_enabled(acceleration_management_enabled); // restore acceleration management setting
} }
void mc_go_home() void mc_go_home()

View File

@ -1,4 +1,4 @@
socat -d -d READLINE /dev/tty.usbmodem24121,nonblock=1,clocal=1 socat -d -d READLINE /dev/tty.usbmodem24121,nonblock=1,clocal=1
socat -d -d READLINE /dev/tty.usbserial-A700e0GO,clocal=1,nonblock=1,cread=1,cs8,ixon=1,ixoff=1
socat -d -d READLINE /dev/tty.usbserial-A9007QcR,clocal=1,nonblock=1,cread=1,cs8,ixon=1,ixoff=1 socat -d -d READLINE /dev/tty.usbserial-A9007QcR,clocal=1,nonblock=1,cread=1,cs8,ixon=1,ixoff=1
#socat -d -d READLINE /dev/tty.FireFly-A964-SPP-1,clocal=1,nonblock=1,cread=1,cs8,ixon=1,ixoff=1 #socat -d -d READLINE /dev/tty.FireFly-A964-SPP-1,clocal=1,nonblock=1,cread=1,cs8,ixon=1,ixoff=1

View File

@ -326,6 +326,8 @@ void plan_buffer_line(int32_t steps_x, int32_t steps_y, int32_t steps_z, uint32_
block->speed_z = block->steps_z*multiplier/settings.steps_per_mm[2]; block->speed_z = block->steps_z*multiplier/settings.steps_per_mm[2];
block->nominal_speed = millimeters*multiplier; block->nominal_speed = millimeters*multiplier;
block->nominal_rate = ceil(block->step_event_count*multiplier); block->nominal_rate = ceil(block->step_event_count*multiplier);
block->millimeters = millimeters;
block->entry_factor = 0.0;
// Compute the acceleration rate for the trapezoid generator. Depending on the slope of the line // Compute the acceleration rate for the trapezoid generator. Depending on the slope of the line
// average travel per step event changes. For a line along one axis the travel per step event // average travel per step event changes. For a line along one axis the travel per step event
@ -340,8 +342,9 @@ void plan_buffer_line(int32_t steps_x, int32_t steps_y, int32_t steps_z, uint32_
if (acceleration_management) { if (acceleration_management) {
calculate_trapezoid_for_block(block,0,0); // compute a conservative acceleration trapezoid for now calculate_trapezoid_for_block(block,0,0); // compute a conservative acceleration trapezoid for now
} else { } else {
block->initial_rate = block->nominal_rate;
block->accelerate_until = 0; block->accelerate_until = 0;
block->decelerate_after = 0; block->decelerate_after = block->step_event_count;
block->rate_delta = 0; block->rate_delta = 0;
} }