Skip to content

Commit

Permalink
gmoccapy: first draft to achieve smaller resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
hansu committed Jan 4, 2024
1 parent ed3b296 commit 98b7375
Show file tree
Hide file tree
Showing 4 changed files with 320 additions and 10 deletions.
207 changes: 207 additions & 0 deletions configs/sim/gmoccapy/gmoccapy_800x600.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# EMC controller parameters for a simulated machine.
# General note: Comments can either be preceded with a # or ; - either is
# acceptable, although # is in keeping with most linux config files.

# General section -------------------------------------------------------------
[EMC]
VERSION = 1.1
MACHINE = gmoccapy
DEBUG = 0

# Sections for display options ------------------------------------------------
[DISPLAY]
DISPLAY = gmoccapy -i
# Log level:
# DEBUG -d
# INFO -i
# VERBOSE -v
# ERROR -q

# Cycle time, in milliseconds, that display will sleep between polls
CYCLE_TIME = 100

# Values that will be allowed for override, 1.0 = 100%
MAX_FEED_OVERRIDE = 1.5
MAX_SPINDLE_OVERRIDE = 1.2
MIN_SPINDLE_OVERRIDE = 0.5

# Max and default jog speeds in units per second
MAX_LINEAR_VELOCITY = 166
DEFAULT_LINEAR_VELOCITY = 100
MAX_ANGULAR_VELOCITY = 234
DEFAULT_SPINDLE_SPEED = 450

# Prefix to be used
PROGRAM_PREFIX = ../../nc_files/

USER_COMMAND_FILE=gmoccapy_800x600.py

# Introductory graphic
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5

# list of selectable jog increments
INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm, 1.2345 inch

# for details see nc_files/subroutines/maco_instructions.txt
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python3

# Task controller section -----------------------------------------------------
[RS274NGC]
RS274NGC_STARTUP_CODE = G17 G21 G40 G43H0 G54 G64P0.005 G80 G90 G94 G97 M5 M9
PARAMETER_FILE = sim.var
SUBROUTINE_PATH = macros

# Motion control section ------------------------------------------------------
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 100000
SERVO_PERIOD = 1000000

# Hardware Abstraction Layer section --------------------------------------------------
[TASK]
TASK = milltask
CYCLE_TIME = 0.001

# Part program interpreter section --------------------------------------------
[HAL]
HALFILE = core_sim.hal
HALFILE = spindle_sim.hal
HALFILE = simulated_home.hal

# Single file that is executed after the GUI has started.
POSTGUI_HALFILE = gmoccapy_postgui.hal

HALUI = halui

# Trajectory planner section --------------------------------------------------
[HALUI]
#No Content

[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 35
MAX_LINEAR_VELOCITY = 234
POSITION_FILE = position.txt
NO_FORCE_HOMING = 1

[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100

# tool table file
TOOL_TABLE = tool.tbl
TOOL_CHANGE_POSITION = 100 100 -10
TOOL_CHANGE_QUILL_UP = 1

[KINS]
KINEMATICS = trivkins coordinates=xyz
JOINTS = 3

[AXIS_X]
MIN_LIMIT = -400.0
MAX_LIMIT = 400.0
MAX_VELOCITY = 166
MAX_ACCELERATION = 1500.0

[JOINT_0]
TYPE = LINEAR
MAX_VELOCITY = 166
MAX_ACCELERATION = 1500.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -400.0
MAX_LIMIT = 400.0
FERROR = 0.050
MIN_FERROR = 0.010
HOME_OFFSET = 0.0
HOME = 10
HOME_SEARCH_VEL = 200.0
HOME_LATCH_VEL = 20.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 1
HOME_IS_SHARED = 1

# Second axis
[AXIS_Y]
MIN_LIMIT = -400.0
MAX_LIMIT = 400.0
MAX_VELOCITY = 166
MAX_ACCELERATION = 1500.0

[JOINT_1]
TYPE = LINEAR
MAX_VELOCITY = 166
MAX_ACCELERATION = 1500.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -400.0
MAX_LIMIT = 400.0
FERROR = 0.050
MIN_FERROR = 0.010
HOME_OFFSET = 0.0
HOME = 10
HOME_SEARCH_VEL = 200.0
HOME_LATCH_VEL = 20.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 1

# Third axis
[AXIS_Z]
MIN_LIMIT = -400.0
MAX_LIMIT = 0.001
MAX_VELOCITY = 166
MAX_ACCELERATION = 1500.0

[JOINT_2]
TYPE = LINEAR
MAX_VELOCITY = 166
MAX_ACCELERATION = 1500.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -400.0
MAX_LIMIT = 0.001
FERROR = 0.050
MIN_FERROR = 0.010
HOME_OFFSET = 1.0
HOME = -10
HOME_SEARCH_VEL = 200.0
HOME_LATCH_VEL = 20.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
HOME_IS_SHARED = 1

# section for main IO controller parameters -----------------------------------
[MACROS]
MACRO = go_to_position x-pos y-pos z-pos
MACRO = i_am_lost
MACRO = increment x-incr y-incr
MACRO = macro_4
MACRO = macro_5
MACRO = macro_6
MACRO = macro_7
MACRO = macro_8
MACRO = macro_9
MACRO = macro_10
MACRO = macro_11
MACRO = macro_12
MACRO = macro_13
MACRO = macro_14
MACRO = macro_15


103 changes: 103 additions & 0 deletions configs/sim/gmoccapy/gmoccapy_800x600.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# reduce size of v buttons
self.widgets["vbtb_main"].set_size_request(78, -1)
self.widgets["vbtb_main"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["lbl_time"].hide()

# reorder settings
self.widgets["vbox_window"].remove(self.widgets["frm_ntb_preview"])
self.widgets["hbox_setup_appear"].remove(self.widgets["vbox_file"])
self.widgets["vbox21"].remove(self.widgets["frm_turtle_jog"])

box1 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
box1.show()
box1.pack_start(self.widgets["frm_turtle_jog"], False, False, 3)
box1.pack_start(self.widgets["frm_ntb_preview"], False, False, 3)
box2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
box2.show()

box_settings_3 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
box_settings_3.pack_start(self.widgets["vbox_file"], False, False, 3)
box_settings_3.pack_start(box1, False, False, 3)
box_settings_3.pack_start(box2, False, False, 3)
box_settings_3.show()
# box_settings_3.set_spacing(5)
label = Gtk.Label(label="Remaining")
self.widgets["ntb_setup"].append_page(box_settings_3, label)


# adjust style of button boxes to allow smaller spacing
self.widgets["hbtb_main"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_MDI"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_auto"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_ref"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_touch_off"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_setup"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_edit"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_tool"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_load_file"].set_layout(Gtk.ButtonBoxStyle.EXPAND)
self.widgets["hbtb_ref_joints"].set_layout(Gtk.ButtonBoxStyle.EXPAND)


# further
self.widgets["box_info"].remove(self.widgets["grid_search"])
self.widgets["box_info"].remove(self.widgets["ntb_info"])
self.widgets["hbox_main_info"].remove(self.widgets["box_tool_and_code_info"])
# self.widgets["hbox_main_info"].remove(self.widgets["box_cooling"])

self.widgets.tbtn_user_tabs.set_sensitive( True )
self.user_tabs_enabled = True

box_info = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
box_info.show()
box_info.pack_start(self.widgets["box_tool_and_code_info"], False, False, 0)
box_info.pack_end(self.widgets["ntb_info"], False, False, 0)
self.widgets["ntb_user_tabs"].append_page(box_info, Gtk.Label("Info"))

# buttons = [ "btn_homing", "btn_touch", "btn_tool", "btn_exit", "btn_load",
# "btn_reload", "btn_run", "btn_stop", "btn_step", "btn_from_line", "btn_edit",
# "btn_delete", "btn_classicladder", "btn_hal_scope", "btn_status",
# "btn_hal_meter", "btn_calibration", "btn_show_hal", "btn_reload_edit",
# "btn_save", "btn_save_as", "btn_new", "btn_keyb", "btn_back_edit",
# "btn_delete_tool", "btn_add_tool", "btn_reload_tooltable",
# "btn_apply_tool_changes", "btn_select_tool_by_no", "btn_index_tool",
# "btn_change_tool", "btn_tool_touchoff_x", "btn_tool_touchoff_z",
# "btn_back_tool", "btn_home", "btn_dir_up", "btn_sel_prev", "btn_sel_next",
# "btn_jump_to", "btn_select", "btn_back_file_load", "tbtn_estop", "tbtn_on",
# "tbtn_user_tabs", "tbtn_setup", "tbtn_switch_mode", "tbtn_fullsize_preview0",
# "tbtn_pause", "tbtn_optional_blocks", "tbtn_fullsize_preview1", "rbt_manual",
# "rbt_mdi", "rbt_auto" ]

# labels = [ "lbl_space_0", "lbl_space_1", "lbl_space_2", "lbl_replace_mode_btn",
# "lbl_space_3", "lbl_space_4", "lbl_version", "lbl_space_5", "lbl_space_6",
# "lbl_space_7", "lbl_space_8", "lbl_space_9", "lbl_hide_tto_x",
# "lbl_space_10", "lbl_space_11", "lbl_space_12" ]

# for b in buttons:
# self.widgets[b].set_size_request(60, 56)

# for l in labels:
# self.widgets[l].set_size_request(60, 56)


# self.widgets.window1.fullscreen()

bboxes = [
"hbtb_main",
"hbtb_MDI",
"hbtb_auto",
"hbtb_ref",
"hbtb_touch_off",
"hbtb_setup",
"hbtb_edit",
"hbtb_tool",
"hbtb_load_file",
"hbtb_ref_joints",
"vbtb_main"]

for b in bboxes:
children = self.widgets[b].get_children()
for c in children:
c.set_size_request(60, 56)

self.widgets["vbtb_jog_incr"].hide()
self.widgets["vbx_jog"].set_size_request(-1, -1)
15 changes: 6 additions & 9 deletions src/emc/usr_intf/gmoccapy/gmoccapy.glade
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<property name="step-increment">0.10</property>
</object>
<object class="GtkAdjustment" id="adj_height">
<property name="lower">750</property>
<property name="lower">400</property>
<property name="upper">3920</property>
<property name="value">750</property>
<property name="value">400</property>
<property name="step-increment">1</property>
<signal name="value-changed" handler="on_adj_height_value_changed" swapped="no"/>
</object>
Expand Down Expand Up @@ -121,9 +121,9 @@
<signal name="value-changed" handler="on_adj_turtle_jog_factor_value_changed" swapped="no"/>
</object>
<object class="GtkAdjustment" id="adj_width">
<property name="lower">979</property>
<property name="lower">200</property>
<property name="upper">3920</property>
<property name="value">979</property>
<property name="value">200</property>
<property name="step-increment">1</property>
<signal name="value-changed" handler="on_adj_width_value_changed" swapped="no"/>
</object>
Expand Down Expand Up @@ -756,8 +756,8 @@
<property name="textview">gcode_view</property>
</object>
<object class="GtkWindow" id="window1">
<property name="width-request">979</property>
<property name="height-request">750</property>
<property name="width-request">640</property>
<property name="height-request">480</property>
<property name="can-focus">False</property>
<property name="title">gmoccapy</property>
<property name="icon">icons/Logo.png</property>
Expand All @@ -771,7 +771,6 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="hbx_upper">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox" id="box_left">
Expand Down Expand Up @@ -6089,7 +6088,6 @@ Date</property>
<child>
<object class="GtkNotebook" id="ntb_button">
<property name="height-request">62</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-tabs">False</property>
<property name="show-border">False</property>
Expand Down Expand Up @@ -6206,7 +6204,6 @@ Mode</property>
<property name="use-action-appearance">False</property>
<property name="width-request">90</property>
<property name="height-request">56</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Switch motion mode between Joint and World mode
Expand Down
5 changes: 4 additions & 1 deletion src/emc/usr_intf/gmoccapy/gmoccapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def excepthook(exc_type, exc_obj, exc_tb):
#_BB_HOME_JOINTS will not be used, we will reorder the notebooks to get the correct page shown

# Default button size for bottom buttons
_DEFAULT_BB_SIZE = (90, 56)
_DEFAULT_BB_SIZE = (60, 56)

_TEMPDIR = tempfile.gettempdir() # Now we know where the tempdir is, usually /tmp

Expand Down Expand Up @@ -347,6 +347,9 @@ def __init__(self, argv):
self._show_tooledit_tab(False)
self._show_iconview_tab(False)

self.widgets["hbx_upper"].show()
self.widgets["ntb_button"].show()

# the velocity settings
self.widgets.adj_spindle_bar_min.set_value(self.min_spindle_rev)
self.widgets.adj_spindle_bar_max.set_value(self.max_spindle_rev)
Expand Down

0 comments on commit 98b7375

Please sign in to comment.