#[solved] servo deploying late

1 messages · Page 1 of 1 (latest)

copper cradle
#

First time setting up a servo.
When the command to cut is given, the toolhead moves to the cut position (no problem) then moves to cut, then the servo deploys.
I've adjusted the variable dwell time from 0 (servo does not deploy) to 1000 and the servo still deploys late.

#

`#--=================================================================================-
#------- Helper macro for cut pin servo -----------------------------------------------
#--=================================================================================-
[gcode_macro _CUTTER_SERVO]

Increase this value if the servo doesn't have enough time to fully retract or extend

variable_dwell_time: 1000
gcode:
{% set c1 = printer['gcode_macro _AFC_CUT_TIP_VARS'] %}
{% set pos = params.POS %}
{% if pos == "in" %}
SET_SERVO SERVO={c1.tool_servo_name} ANGLE={c1.tool_servo_angle_in}
G4 P{dwell_time}
{% elif pos == "out" %}
SET_SERVO SERVO={c1.tool_servo_name} ANGLE={c1.tool_servo_angle_out}
G4 P{dwell_time}
{% else %}
{action_respond_info("Cutter Servo: provide POS=[in|out]")}
{% endif %}
SET_SERVO SERVO={c1.tool_servo_name} WIDTH=0`

#

# Addon variables for cutter pin servo control variable_tool_servo_enable : True variable_tool_servo_name : "tool_cut" variable_tool_servo_angle_out : 180 variable_tool_servo_angle_in : 90

#

the servo moves when i use the servo macro i set up to test it

#

`[servo tool_cut]
pin: PC15 # Change to your specific MCU pin
maximum_servo_angle: 180
minimum_pulse_width: 0.0005
maximum_pulse_width: 0.0024
initial_angle: 90 # Stowed position

[gcode_macro CUT_FILAMENT]
gcode:
SET_SERVO SERVO=tool_cut ANGLE=180 # Actuate cutter
G4 P500 # Wait for cut
SET_SERVO SERVO=tool_cut ANGLE=90 # Retract

[gcode_macro SERVO_HOME]
gcode:
SET_SERVO SERVO=tool_cut ANGLE=90`

#

sorry to paste so much, but that's anything i have set up ror the servo

#

my cut variables - all work if i manually set the servo arm in position

#

`# Direction to make the cut move (left, right, front, back)
variable_cut_direction : "right"

This distance is used to move toolhead to cut filament

and to create a small safety distance that aids in generating momentum

variable_pin_park_dist : 15 # Distance in mm

Position of the toolhead when the cutter is fully compressed.

Distance the toolhead needs to travel to compress the cutter arm.

To calculate this distance start at the pin_loc_xy position and move

your toolhead till the cutter arm is completely compressed. Take 0.5mm off this distance

as a buffer.

Ex pin_loc_x : 9, 310 fully compressed at 0, 310 set cut_move_dist to 8.5

variable_cut_move_dist : 8.5 # Distance in mm`

astral sand
#

@copper cradle I don't have experience with the servos, but for readability for others to digest your messages, you should enclose code blocks in three backticks ``` at the beginning and end of the blocks

copper cradle
astral sand
#

Yes, for all of them so that the comments don’t invoke discords markdown formatting

copper cradle
#

It almost seems like the command to move and cut is being given before the command to deploy the servo.

#

Wondering if I can set the AFC macro to not use the servo, then make an override to deploy the servo, call AFC cut, then retract the servo?

astral sand
#

Just a guess, but what if you put an m400 right after the servo command? That flushes the command queue

lime orchid
#

yes at the end of this

copper cradle
#

Ok. I tried that and it didn't help.
I am going to hard code the servo move at the beginning of the AFC cut macro
And stow at the end of the clear pin macro and see if that does it. Since I will always use the servo. I don't particularly like hard coding anything, especially in a macro I barely understand, but will see after work if that does anything.
I tried setting up and override macro but got the error that AFC cut was not found to rename (I think it has to be in the main printer.cfg to use that) and I tried putting the rename macro in front of the afc cut macro but same thing.

copper cradle
#

Hard coding it in the macro works.

tawdry radishBOT
lime orchid
#

I didn't watch your video earlier. I am wondering if you are just setting the cut park location in a spot that interferes with the servo

#

and correct me if I am wrong but you actually want to move left not right for your cut

copper cradle
#

I am moving right. My park is at the back left side. The servo is at the front right side. When it does a filament change, it goes to the park at 310,310 then to the cut position at 28, 28.
It will park and move to cut. It makes one move to the cutter pin then the servo deploys as the tool head is at the end of the first cut move of 2. It will stay deployed until after the second cut move.
After I inserted the line to deploy the servo at the beginning of the AFC cut macro it will go to the park, deploy servo and pause for a beat (200ms) and then move to the cut, perform a second cut, and then stow. So problem solved, even if it's a bit sloppy.

lime orchid
#

28,28 would mean a front left cut location

#

Please run the debug when you get a chance

copper cradle
#

my printer is set up with 0,0 in the front right.

#

if looking at the printer, it is the left front corner.

lime orchid
#

Also if you have X0 defined on right side you should technically be operation in negatives, do all your parts come out mirrored?

astral sand
#

Yeah, always think of this as a normal cartesian coordinate system projected onto the bed with [0,0] being near the front door of the printer at your left when looking at it

#

We will all go crazy if we don't agree on this

ember pollen
#

Well, he will have to work opposite what a typical config would be as a default voron config is 0,0 front left.

My assessment here is youre parking too close initially blocking servo deployment, your cut direction is wrong, its moving away from the servo when it would be making the cut moves, meaning you would not be getting a cut even if it was not blocking the servo.

astral sand
#

I mean, sure one could do this, but it would be a bit insane, because it flips the meaning of left and right in the configs unless you're in australia

ember pollen
#

Indeed.

#

If you configure your printer in a non-standard way you have to work around that. His decision.

ember pollen
# copper cradle if looking at the printer, it is the left front corner.

That being said it seems this may be a cross-up in terminololgy. To establish a norm going forward, its generally referered to as you are looking at the printer, not like in automotive where you assume youre inside the machine looking out. lol

I would: Move the cut park position further out on X to give the servo room to properly deploy; Change the cut direction to LEFT since you were crossed up on this terminology; Report back to us as after adjusting these things.

copper cradle
#

"Left" makes it cut to the other side. My original setup was a static pin on the other side.
It parks in the opposite side rear. The servo deploys after it parks, and mines the entire length of the bed to the cut position and cuts the first time.
This is a custom printer and just finding and modifying parts to make it work with the BT took weeks if trial and error and reprinting and tweaking.
I have it working for me now.
I appreciate the help, but I have a ton of tuning to do now that I can reliably cut the filament and have only lost a 4x4 section of build plate that I'm not sure I've ever printed on anyway.

lime orchid
#

I am just trying to make sure that there isn't actually a problem with the Cut macro in regards to servo.
the slower move it does is supposed to be the actual cut with the fast jerk a return to the pin_park location

copper cradle
#

I have damaged one servo and had to replace the arm a few times already by not being fast enough to the power switch trying to get it working. I don't have another on hand. I appreciate what you are saying, but I don't wanna break anything else lol.

lime orchid
#

if we don't touch your macro as is I don't see how we would damage anything but whatever
Just remeber to never update your macros then or you will loose the modification

copper cradle
#

I don't understand how it would test anything as the pin would deploy due to it being hard coded. Wouldn't be able to tell if it was working or not?

#

And it's cutting to the correct direction already. Adding a pause would only add a pause after the pin deployed. If you can explain how that would help, I am more than happy to do whatever.

lime orchid
#

Your initial “cut” isn’t meant to be a cut according to the macro though it’s meant to just be a travel move.
So if you end up with skipping steps that will be it, we don’t change the current until we actually expect it to be a cut

copper cradle
#

So it's going to my AFC Park position and then it's going to another position which is acting like a cut. Where do I change the coordinates for that second Park position?

astral sand
#

There's a park position, and a cut position, they are two different locations. The cut position is meant to be set just before making contact with the arm. This is the cut location, variable_pin_loc_xy.

#

Maybe though, what you're talking about is the variable_pin_park_dist, which is the distance away from the pin it moves to quickly, before it bumps up the current and does the cut

copper cradle
#

I have the cut position defined in the macro as the point the arm makes contact. The cut distance is the move minus .5mm it takes to make a cut. I have the avoidance set to 15mm (pin park distance)
When the AFC cut macro is called it goes to the cutter about 15mm away. Makes a fast move and then rebounds and does it again. It's set for 2 cuts in the macro.
It would be after the pin park distance that I would add a pause. Which again would mean my macro would not match the repo and would change as soon as I updated?
When the servo is defined it makes that initial movement and then deploys the servo.

lime orchid
#

it should be going to pin_park location and then activating the servo normally. this is the same location that it should be retracting the filament beofre cutting.
The moves after this are medium speed-> slow cut then returns at high speed to pin park

astral sand
#

If you have your cut direction set in the wrong direction, you've overshooting the pin location by the variable_pin_park_dist

copper cradle
#

Ok. I think I am understanding. It is moving to the pin park location and cutting right then moving fast back to the pin park location and making another cut.

lime orchid
#

yes, thats why we are saying the cut direction is supposed to be left in your cfg

copper cradle
#

Ok. I'll give that a try and let you guys know tomorrow. Off to work for the night

copper cradle
#

Ok, now that I understand and the direction of cut is set correctly, it is moving to the pin park position and then cutting instead of good straight to the cutter. I am going to take off the servo arm and set the macro back to stock and uncomment all the servo info. If that works, I'll let you know to close out the help.
Appreciate the patience and help.

copper cradle
#

Once again, I'd like to thank you guys for your patience, everything is working with the original macro. Nothing added

astral sand
#

Glad you got it going! Happy printing