Correct way to launch a standalone PyVCP Panel

06 Mar 2022 09:23 #236491 by bymccoy

I’ve got a DRO/NC style config that is built around a single HAL file, with an XML file for PyVCP. The UI is loaded as one of the last steps in the HAL file. There’s also a file that saves data (can’t recall the module I use for that now). 

Normally I’ve run the “app” via a terminal and cd’ing to the directory and via halrun.

I need to auto start this, or have an app shortcut in the dock etc to load it - what’s the right way to do this? Is there a template shell script etc, correct way to setup environment etc? Once I realised it needed the relative path of the GUI and saved data files, I cheated in the autostart config and used the line: “cd /opt/cnc/etc/ && halrun program.hal” and it works. But is there a better method, or is this as good as it needs to be?

It’s very much standalone and doesn’t have axis (weird interlocked VSD motor control means two axis are controlled via PID and custom logic to handle direction control and interlocking). So using the normal linuxcnc startup method isn’t an option. 

Suggestions welcome!

Please Log in or Create an account to join the conversation.

06 Mar 2022 09:24 #236492 by bymccoy
Should add, not sure if there’s a better project structure that still avoids the classic CNC machine config structure (ie totally custom HAL config with no defaults), but means it can source all of the files without path issues etc.

Please Log in or Create an account to join the conversation.

10 Mar 2022 00:20 - 10 Mar 2022 00:21 #236800 by andypugh
A script that contains;

loadusr pyVCP.....

Might do what you want.

I have examples using GladeVCP:
Start file:
#! /bin/bash

halrun -I -i pressgui.ini bender.hal
Then the bender.hal has:
loadusr -Wn pressgui gladevcp -u pressgui.ui
loadusr -Wn pressmodel ./pressmodel
Which loads the control panel and a VIsmach model.

You don't need to use a HAL if you don't want to, though. You can just use halcmd and/or halrun.
Last edit: 10 Mar 2022 00:21 by andypugh.

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum