grblHAL / PostProcessors

Post processors for grblHAL and Grbl
10 stars 1 forks source link

Fusion360 PostProcessor for plasma cutter #2

Open drom89 opened 1 year ago

drom89 commented 1 year ago

Im having some troubles how to setup postprocessor for plasma cutter.

I tried standard PP for grbl and grblHAL from raenji-sk. If i use Openbuilds PP https://github.com/OpenBuilds/OpenBuilds-Fusion360-Postprocessor, machine skips some movements like rapids and parts of arcs. video: https://k00.fr/d0fa2qwo

First i needed to add JET capability capabilities = CAPABILITY_MILLING | CAPABILITY_MACHINE_SIMULATION | CAPABILITY_JET;

But after that im getting error:

###############################################################################
Error: Spindle speed out of range.
Error at line: 327
Error in operation: '2D Profile5'
Failed while processing onSection() for record 277.
###############################################################################

Error: Failed to invoke function 'onSection'.
Error: Failed to invoke 'onSection' in the post configuration.
Error: Failed to execute configuration.
Stop time: Tuesday, February 28, 2023 12:11:59 PM
Post processing failed.

So after that i tried to make change in .cps file to match:

 if (spindleSpeed < 0) {
      error(localize("Spindle speed out of range."));

And now im getting:

###############################################################################
Error: Unsupported power-on command.
Error in operation: '2D Profile5'
Failed while processing onCommand() for record 282.
###############################################################################

Any ideas ?

terjeio commented 1 year ago

machine skips some movements like rapids and parts of arcs

That is odd as it seems to render correctly in the sender. Post your gocde here so I can check.

Any ideas ?

Better to ask on a Fusion 360 forum? I have never used Fusion 360 so I know nothing about their post-processors.

drom89 commented 1 year ago

Yes it is odd. This is generated with openbuilds PP 1001.zip

drom89 commented 1 year ago

Maybe i messed up something in my_machine_map.h Im testing it on NodeMCU ESP32 wroom 38pins I have ganged Y motors.

#define BOARD_NAME "PlazmaCNC_V1"

// timer definitions
#define STEP_TIMER_GROUP TIMER_GROUP_0
#define STEP_TIMER_INDEX TIMER_0

// Define step pulse output pins.
#define X_STEP_PIN          GPIO_NUM_26
#define Y_STEP_PIN          GPIO_NUM_25
#define Z_STEP_PIN          GPIO_NUM_17

// Define step direction output pins. NOTE: All direction pins must be on the same port.
#define X_DIRECTION_PIN     GPIO_NUM_16
#define Y_DIRECTION_PIN     GPIO_NUM_27
#define Z_DIRECTION_PIN     GPIO_NUM_14

// Define stepper driver enable/disable output pin(s).
//#define STEPPERS_ENABLE_PIN GPIO_NUM_12

// Define homing/hard limit switch input pins and limit interrupt vectors.
#define X_LIMIT_PIN         GPIO_NUM_21
#define Y_LIMIT_PIN         GPIO_NUM_19
#define Z_LIMIT_PIN         GPIO_NUM_18

#define Y_GANGED 1
#define Y_AXIS_GANGED 1
// Define ganged axis or A axis step pulse and step direction output pins.
#if N_ABC_MOTORS >= 1
#define M3_AVAILABLE
#define M3_STEP_PIN         GPIO_NUM_22
#define M3_DIRECTION_PIN    GPIO_NUM_23
//#define M3_LIMIT_PIN        GPIO_NUM_36
#endif

// Define spindle enable and spindle direction output pins.

#define SPINDLEPWMPIN GPIO_NUM_12
#define SPINDLE_ENABLE_PIN GPIO_NUM_13

#if SDCARD_ENABLE
// Pin mapping when using SPI mode.
// With this mapping, SD card can be used both in SPI and 1-line SD mode.
// Note that a pull-up on CS line is required in SD mode.
#define PIN_NUM_MISO        GPIO_NUM_2
#define PIN_NUM_MOSI        GPIO_NUM_0
#define PIN_NUM_CLK         GPIO_NUM_4
#define PIN_NUM_CS          GPIO_NUM_5
#endif
terjeio commented 1 year ago

define Y_GANGED 1

define Y_AXIS_GANGED 1

Enabling ganged Y is safer to do in CMakeLists.txt.

I see now in the video that the tool marker jumps a bit on the S arcs - so steps are not generated correctly. When I try with your board map here, and with default settings, this do not happen.

How do you compile and with which IDF version? What are your settings?

BTW here is the binary I made, is this ok?

app-template.zip

drom89 commented 1 year ago

Im still compiling thru visual basic and plugins IDF v4.3.4 My settigs. Plazma_settings.txt

[VER:1.1f.20230129:]
[OPT:VNSL2,500,1024,3,0]
[AXS:3:XYZ]
[NEWOPT:ENUMS,RT+,NOPROBE,REBOOT,SED,RTC,WIFI,SD]
[FIRMWARE:grblHAL]
[NVS STORAGE:*FLASH]
[DRIVER:ESP32]
[DRIVER VERSION:230125]
[DRIVER OPTIONS:v4.3.4]
[BOARD:PlazmaCNC_V1]
[COMPATIBILITY LEVEL:1]
[WIFI MAC:C8:F0:9E:51:C7:3C]
[IP:192.168.1.5]
[PLUGIN:WebUI v0.14]
[PLUGIN:SDCARD v1.07]

Tried with your binary, but the problem is still the same.

GrblHAL 1.1f ['$' or '$HELP' for help]
[VER:1.1f.20230228:]
[OPT:VNSL2,35,1024,3,0]
[AXS:3:XYZ]
[NEWOPT:ENUMS,RT+,NOPROBE,REBOOT,TC,SED,RTC]
[FIRMWARE:grblHAL]
[NVS STORAGE:*FLASH]
[DRIVER:ESP32]
[DRIVER VERSION:230210]
[DRIVER OPTIONS:v4.3.1-dirty]

[BOARD:PlazmaCNC_V1]
drom89 commented 1 year ago

It is strange only arc are bad, straight lines are ok. I will try it with MKS DKC32.

terjeio commented 1 year ago

Settings are from the $$ command output... You can copy them to the clipboard via Help -> About... > To clipboard and pasting it in a comment.

The gcode in the video is mirrored, the one you posted above is not. Did you mirror it in the 3D viewer or by transforming it?

drom89 commented 1 year ago

% ; grblHAL ; 1.1f.20230228 ; [OPT:VNSL2,500,1024,3,0] ; [NEWOPT:ENUMS,RT+,NOPROBE,REBOOT,TC,SED,RTC] ; [FIRMWARE:grblHAL] ; [NVS STORAGE:*FLASH] ; [DRIVER:ESP32] ; [DRIVER VERSION:230210] ; [DRIVER OPTIONS:v4.3.1-dirty] ; [BOARD:PlazmaCNC_V1] ; $N0= $N1= ; 0 - Step pulse time $0=10.0 ; 1 - Step idle delay $1=255 ; 2 - Step pulse invert $2=0 ; 3 - Step direction invert $3=0 ; 4 - Invert stepper enable pin(s) $4=7 ; 5 - Invert limit pins $5=7 ; 8 - Ganged axes direction invert $8=0 ; 10 - Status report options $10=511 ; 11 - Junction deviation $11=0.010 ; 12 - Arc tolerance $12=0.002 ; 13 - Report in inches $13=0 ; 14 - Invert control pins $14=3 ; 15 - Invert coolant pins $15=0 ; 16 - Invert spindle signals $16=0 ; 17 - Pullup disable control pins $17=0 ; 18 - Pullup disable limit pins $18=0 ; 20 - Soft limits enable $20=0 ; 21 - Hard limits enable $21=0 ; 22 - Homing cycle $22=0 ; 23 - Homing direction invert $23=0 ; 24 - Homing locate feed rate $24=25.0 ; 25 - Homing search seek rate $25=500.0 ; 26 - Homing switch debounce delay $26=250 ; 27 - Homing switch pull-off distance $27=1.000 ; 28 - G73 Retract distance $28=0.100 ; 29 - Pulse delay $29=0.0 ; 30 - Maximum spindle speed $30=1000.000 ; 31 - Minimum spindle speed $31=0.000 ; 32 - Mode of operation $32=0 ; 33 - Spindle PWM frequency $33=5000 ; 34 - Spindle PWM off value $34=0.0 ; 35 - Spindle PWM min value $35=0.0 ; 36 - Spindle PWM max value $36=100.0 ; 37 - Steppers deenergize $37=7 ; 39 - Enable legacy RT commands $39=1 ; 40 - Limit jog commands $40=0 ; 43 - Homing passes $43=1 ; 44 - Axes homing, first pass $44=4 ; 45 - Axes homing, second pass $45=3 ; 46 - Axes homing, third pass $46=0 ; 62 - Sleep enable $62=0 ; 63 - Feed hold actions $63=2 ; 64 - Force init alarm $64=0 ; 100 - X-axis travel resolution $100=1000.000 ; 101 - Y-axis travel resolution $101=1000.000 ; 102 - Z-axis travel resolution $102=320.000 ; 110 - X-axis maximum rate $110=7000.000 ; 111 - Y-axis maximum rate $111=5000.000 ; 112 - Z-axis maximum rate $112=500.000 ; 120 - X-axis acceleration $120=2000.000 ; 121 - Y-axis acceleration $121=1000.000 ; 122 - Z-axis acceleration $122=10.000 ; 130 - X-axis maximum travel $130=1000.000 ; 131 - Y-axis maximum travel $131=2000.000 ; 132 - Z-axis maximum travel $132=200.000 ; 341 - Tool change mode $341=0 ; 342 - Tool change probing distance $342=30.0 ; 343 - Tool change locate feed rate $343=25.0 ; 344 - Tool change search seek rate $344=200.0 ; 345 - Tool change probe pull-off rate $345=200.0 ; 346 - Restore position after M6 $346=1 ; 384 - Disable G92 persistence $384=0 ; 398 - Planner buffer blocks $398=500 ; 481 - Autoreport interval $481=0 %

drom89 commented 1 year ago

The gcode in the video is mirrored, the one you posted above is not. Did you mirror it in the 3D viewer or by transforming it?

I generated another one.

drom89 commented 1 year ago

new Gcode - only S and T letters 100mm height.

1001.zip video: https://k00.fr/e88xku0o

terjeio commented 1 year ago

I have tested with an ESP32 and a STM32F303 (your settings) and there are no abnormal movements in the 3D viewer that shows in your videos. I see that you have increased $398 to 500, do you have the same issue when set to the default 35?

Another option would be to run a test without the motor drivers connected - same issue? If so then please try the MKS controller.

drom89 commented 1 year ago

So i downloaded newest version of grblHAL, compile it with basic settings and it somehow started to work. But now i cant compile with wifi, im starting to think that im cursed 😢

-c ../main/wifi.c ../main/wifi.c: In function 'wifi_event_handler': ../main/wifi.c:460:13: error: implicit declaration of function 'telnetd_close_connections'; did you mean 'netconn_connect'? [-Werror=implicit-function-declaration] telnetd_close_connections(); ^~~~~~~~~~~~~~~~~~~~~~~~~ netconn_connect ../main/wifi.c:461:13: error: implicit declaration of function 'websocketd_close_connections' [-Werror=implicit-function-declaration] websocketd_close_connections(); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ At top level: ../main/wifi.c:209:13: warning: 'lwIPHostTimerHandler' defined but not used [-Wunused-function] static void lwIPHostTimerHandler (void *arg) ^~~~~~~~~~~~~~~~~~~~ cc1.exe: some warnings being treated as errors [62/70] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/networking/ssdp.c.obj ninja: build stopped: subcommand failed.

terjeio commented 1 year ago

So i downloaded newest version of grblHAL, compile it with basic settings and it somehow started to work.

That is strange - you have no idea why?

But now i cant compile with wifi, im starting to thing that im cursed

Ouch - the compile error is on me. Add these lines inside the Wifi option:

target_compile_definitions("${COMPONENT_LIB}" PUBLIC TELNET_ENABLE=1)
target_compile_definitions("${COMPONENT_LIB}" PUBLIC WEBSOCKET_ENABLE=1)
drom89 commented 1 year ago

So i downloaded newest version of grblHAL, compile it with basic settings and it somehow started to work.

That is strange - you have no idea why?

I checked all cables they seemed to be ok, tried new driver, after that i tried the new FW and i think that i still had the same problem (not 100% sure), so i tinkered with setup, tried inverting step and dir signals and it some how started to work, changed microstepping from 10000 to 1000steps/rev, i fliped step and dir signals back and it still works.

drom89 commented 1 year ago

Ouch - the compile error is on me. Add these lines inside the Wifi option:

target_compile_definitions("${COMPONENT_LIB}" PUBLIC TELNET_ENABLE=1)
target_compile_definitions("${COMPONENT_LIB}" PUBLIC WEBSOCKET_ENABLE=1)

Another error: In file included from ../main/driver.c:35: ../main/./driver.h:74:2: error: #error "Cannot use static IP for station when soft AP is enabled!"

error "Cannot use static IP for station when soft AP is enabled!"

Without soft AP it compiles ok.

drom89 commented 1 year ago

First cut 😄 https://k00.fr/i3f6dhsf

Now i need to figure out THC and test your plasma plugin.

terjeio commented 1 year ago

First cut

Looks good, I want such a machine...

Now i need to figure out THC and test your plasma plugin.

I am not sure the ESP32 is the correct choice for that due to limited number of pins. And the plugin hs not yet been tested properly. A few days ago I created a CNC project for milling a test rig I will use for simulating tool height control, basically a stepper motor connected to a movable potmeter. Hopefully I will be able to make that test rig soon.