crash course in Halui

More
23 Dec 2023 23:00 #288952 by B.Reilly01
Let me just start by saying thank you, you guys have been incredibly helpful.  That said, I'm still in way over my head and am trying to learn.  Is there a crash course in Halui? or is it preferrable to edit hal and ini files directly?  I successfully converted a mill years ago, but I used PNCConf with a 5i25 + 7i77 for it.  Now I'm using a 7i97 + 7i76 to convert a Bridgeport Interact w/ tool changer.  I know PNCConf does not support the 7i97, so I figured I'd use MesaCT and edit the HAL/INI files.  I tried to launch HALUI using a very simple INI file, and I get the following error:  emc/usr_intf/halui.cc 2335: can't connect to emc I tried searching for this error and cannot find what's going on.  I know it's something simple, like all my errors have been.  Instead of coming back and asking every dumb question, it would be helpful if there was a crash course to get me started.

Thanks again

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

More
24 Dec 2023 00:14 #288957 by tommylight
Replied by tommylight on topic crash course in Halui
Not sure halui will run without other LinuxCNC stuff already running, supported by the error report of not being able to connect to EMC.
EMC2 was the old LinuxCNC name, had to be changed to avoid a lawsuit, unfortunately.

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

More
25 Dec 2023 08:20 #289025 by blazini36
Replied by blazini36 on topic crash course in Halui
You should probably post that hal file you're working on, else nobody knows what your missing. There's not much to halui. Make sure you are at least starting it with this in your ini file.....

[HAL]
HALUI = halui

It can also be loaded in your main hal file which I suspect is how it was done if you used one of those setup programs and you tried to copy stuff out of an old ini file. If it wasn't done this way this would not be in the ini file but it's fine just to do it like this.

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

More
25 Dec 2023 16:26 #289033 by B.Reilly01
Replied by B.Reilly01 on topic crash course in Halui
I think the problem may be that I'm trying to build the config/controller off the machine - and therefore have nothing hooked up to my Mesa boards. Do I need to be on the machine to use Halui? I do indeed have HALUI=halui in the INI file - I grabbed an INI file off my working machine, but I do not have the hardware beyond the mesa boards hooked to the computer.

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

More
25 Dec 2023 17:02 - 25 Dec 2023 17:16 #289037 by Mecanix
Replied by Mecanix on topic crash course in Halui

EMC2 was the old LinuxCNC name, had to be changed to avoid a lawsuit, unfortunately.
 


OT - Is that for real??? As in world's most famous equation being legalized/politicized, who the f went that length? What's next; hide in a window-less bunker to avoid legal and prosecution for singing the happy birthday song? 

Seriously. Are you serious?


Edit: oh my foo kin god this is for real. Speechless... carry on HALUI conversation. Sorry. 
"Around 2011, the name was changed officially from EMC2 to LinuxCNC. This was done at the insistence of  EMC Corporation  and the agreement of the project leadership. Internally some refer to LinuxCNC by EMC or EMC2 as it was historically known. EMC Corporation proposed that the LinuxCNC project, as previously named, would be confusing for customers or potential customers with their (mainly) storage related products." ~wiki
Last edit: 25 Dec 2023 17:16 by Mecanix.

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

More
25 Dec 2023 20:40 #289043 by blazini36
Replied by blazini36 on topic crash course in Halui

I think the problem may be that I'm trying to build the config/controller off the machine - and therefore have nothing hooked up to my Mesa boards. Do I need to be on the machine to use Halui? I do indeed have HALUI=halui in the INI file - I grabbed an INI file off my working machine, but I do not have the hardware beyond the mesa boards hooked to the computer.
 

That doesn't have anything to do with the error you're getting. The Mesa cards obviously have to be connected to the PC in order for the pins to get instantiated if they are referred to in the hal file. Only serial devices need to be connected to the card so they can be discovered if the pins are referenced. Steppers/encoders/IO does not matter but again, none of this has anything to do with the error you mentioned.

Why don't you just post your hal and ini files like I said before? You're making anyone trying to help you just throw out wild guesses.

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

More
26 Dec 2023 16:39 #289097 by B.Reilly01
Replied by B.Reilly01 on topic crash course in Halui
Included are a basic HAL and INI - once axis and an e-stop.  I cannot launch LinuxCNC nor halui.
[MESA]
VERSION = 2.0.6
BOARD = 7i97
BOARD_NAME = 7i97T
FIRMWARE = None
CARD_0 = 7i76

[EMC]
VERSION = 1.1
MACHINE = BasicTest
DEBUG = None

[HM2]
DRIVER = hm2_eth
ADDRESS = 10.10.10.10

[DISPLAY]
DISPLAY = axis
EDITOR = geany
PROGRAM_PREFIX = /home/interact/linuxcnc/nc_files
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = COMMANDED
MAX_FEED_OVERRIDE = 1.2
MIN_LINEAR_VELOCITY = 0.0
DEFAULT_LINEAR_VELOCITY = 0.5
MAX_LINEAR_VELOCITY = 5.0
CYCLE_TIME = 0.1
INTRO_GRAPHIC = emc2.gif
INTRO_TIME = 0
OPEN_FILE = ""

[KINS]
KINEMATICS = trivkins coordinates=X
JOINTS = 1

[EMCIO]
EMCIO = iov2
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl

[RS274NGC]
PARAMETER_FILE = parameters.var

[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000

[TASK]
TASK = milltask
CYCLE_TIME = 0.010

[TRAJ]
COORDINATES = X
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
MAX_LINEAR_VELOCITY = 5.0
NO_FORCE_HOMING = 1

[HAL]
HALUI=halui
HALFILE = main.hal
HALFILE = io.hal

[AXIS_X]
MIN_LIMIT = 0
MAX_LIMIT = 18
MAX_VELOCITY = 5.0
MAX_ACCELERATION = 40

[JOINT_0]
CARD = 0
TAB = 0
AXIS = X
MIN_LIMIT = 0
MAX_LIMIT = 18
MAX_VELOCITY = 5.0
MAX_ACCELERATION = 40
TYPE = LINEAR
SCALE = 40000
ANALOG_SCALE_MAX = 10
ANALOG_MIN_LIMIT = -10
ANALOG_MAX_LIMIT = 10
ENCODER_SCALE =
FERROR =  0.002
MIN_FERROR =  0.001
DEADBAND = 0
P = 140
I = .2
D = 0
FF0 = 0
FF1 = 1.446
FF2 = .008
BIAS = 0
MAX_OUTPUT = 0
HOME_IGNORE_LIMITS = False
HOME_USE_INDEX = False
HOME_IS_SHARED = False

[INPUTS]
# DO NOT change the inputs they are used by the configuration tool
INPUT_0_0 = E Stop 0
INPUT_INVERT_0_0 = True
INPUT_SLOW_0_0 = False

[OUTPUTS]
# DO NOT change the outputs they are used by the configuration tool

[OPTIONS]
# DO NOT change the options they are used by the configuration tool
LOAD_CONFIG = False
INTRO_GRAPHIC = emc2.gif
INTRO_GRAPHIC_TIME = 0
MANUAL_TOOL_CHANGE = False
CUSTOM_HAL = False
POST_GUI_HAL = False
SHUTDOWN_HAL = False
HALUI = False
PYVCP = False
GLADEVCP = False
LADDER = False
BACKUP = False
# kinematics
loadrt [KINS](KINEMATICS)

# motion controller
loadrt [EMCMOT](EMCMOT) servo_period_nsec=[EMCMOT](SERVO_PERIOD) num_joints=[KINS](JOINTS)

# hostmot2 driver
loadrt hostmot2
loadrt [HM2](DRIVER) board_ip=[HM2](ADDRESS) config="sserial_port_0=00000000"

setp hm2_[MESA](BOARD).0.watchdog.timeout_ns 5000000

loadrt pid names=pid.x

# THREADS
addf hm2_[MESA](BOARD).0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.x.do-pid-calcs servo-thread
addf hm2_[MESA](BOARD).0.write servo-thread

# DPLL TIMER
setp hm2_[MESA](BOARD).0.dpll.01.timer-us -50
setp hm2_[MESA](BOARD).0.stepgen.timer-number 1

# Joint 0 Axis X
# PID Setup
setp pid.x.Pgain [JOINT_0](P)
setp pid.x.Igain [JOINT_0](I)
setp pid.x.Dgain [JOINT_0](D)
setp pid.x.bias [JOINT_0](BIAS)
setp pid.x.FF0 [JOINT_0](FF0)
setp pid.x.FF1 [JOINT_0](FF1)
setp pid.x.FF2 [JOINT_0](FF2)
setp pid.x.deadband [JOINT_0](DEADBAND)
setp pid.x.maxoutput [JOINT_0](MAX_OUTPUT)
setp pid.x.maxerror [JOINT_0](MAX_ERROR)
setp pid.x.error-previous-target true

# joint-0 enable chain
net joint-0-index-enable <=> pid.x.index-enable
net joint-0-index-enable <=> joint.0.index-enable

net joint-0-enable <= joint.0.amp-enable-out
net joint-0-enable => pid.x.enable

# position command and feedback
net joint-0-pos-cmd <= joint.0.motor-pos-cmd
net joint-0-pos-cmd => pid.x.command

net joint-0-pos-fb <= hm2_[MESA](BOARD).0.encoder.00.position
net joint-0-pos-fb => joint.0.motor-pos-fb
net joint-0-pos-fb => pid.x.feedback

net joint.0.output <= pid.x.output
net joint.0.output => hm2_[MESA](BOARD).0.7i76.0.3.analogout0

# Joint 0 Analog setup
setp hm2_[MESA](BOARD).0.7i76.0.3.analogout0-scalemax [JOINT_0](ANALOG_SCALE_MAX)
setp hm2_[MESA](BOARD).0.7i76.0.3.analogout0-minlim [JOINT_0](ANALOG_MIN_LIMIT)
setp hm2_[MESA](BOARD).0.7i76.0.3.analogout0-maxlim [JOINT_0](ANALOG_MAX_LIMIT)


 
Attachments:

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

More
26 Dec 2023 18:15 #289101 by blazini36
Replied by blazini36 on topic crash course in Halui

Included are a basic HAL and INI - once axis and an e-stop.  I cannot launch LinuxCNC nor halui.
 

I'm not sure what you think halui is supposed to do, you don't "launch it". It launches with the ini line I told you to add and it does in fact launch in your config. You can't get Axis out of E-stop because you never made the connection in hal for the GUI button to work.....

You have this in your hal file
setp pid.x.maxerror [JOINT_0](MAX_ERROR)

So you need to add this to your ini
MAX_ERROR =

Your problem isn't halui, no idea why you had that error because I don't have it. Your main issue is iocontrol (iov2) which is being loaded in your ini....
[EMCIO]
EMCIO = iov2

But you didn't connect the E-stop to anything which is why you can't unset it.

You need to add this to for Axis E-stop to work or you can't get it unset:
#  ---estop signals---
net estop-out     <=  iocontrol.0.user-enable-out
net estop-out     =>  iocontrol.0.emc-enable-in

Any other issues you have are with the way you configured your Mesa cards. I don't have those cards so they are commented out in my test but your config works if modified as above.
The following user(s) said Thank You: B.Reilly01

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

More
29 Dec 2023 13:56 #289311 by mighty_mick
Replied by mighty_mick on topic crash course in Halui
I think this is about the executable file is trying to use wrong nml file, which actually does not exist. First of all, you need to know that executables running in LinuxCNC and Machinekit named as hal component are looking for an appropriate nml file to connect to nml buffers.

halui is one of them, and it is also looking for an appropriate nml file to start without error. You can check it at given page below.

-> linuxcnc.org/docs/html/man/man1/halui.1.html

In sentence "I tried to launch HALUI using a very simple INI file,", i didn't understand what you did actually. It seemed like to me that you've compiled halui component and integrated it to some other machine which is already running. If you want to be able to do this kind of stuff, you need to gain a knowledge about nml. You can follow this documentation published by NIST.

--> www.nist.gov/system/files/documents/el/isd/cs/nml-tutorial.pdf

First of all, let's go deep in the core of error. When a hal component is trying to start in main() function, it checks an nml file. If it can not find this nml file or finds wrong nml file, tryNml function quits and hal component does not start. To start without error, it should find an appropriate nml file which is located in system. The possible situations that makes you get this error could one of them that i described below:
1- You replaced a halui which has been compiled for some other platform or system, because of the .nml file location is different, it is looking for different nml, so it doesn't find any or finds wrong nml, and quitting.
2- You have missing nml file in your default directory, and it is not being able to find it anyway.

Here is the solution that you can follow, if you are compiling it from source.
* In machinekit project's src/emc/nml_intf/ directory(you can also find it in LinuxCNC source tree), there is a file named emccfg.h. When you tried to compile sources, it looks for macro named DEFAULT_EMC_NMLFILE. This macro has been set to EMC2_DEFAULT_NMLFILE macro which is actually has to be defined in compile time with -D flag (you can set it by running the configure.ac script in root directory. type "./conigure.ac --help" to see how to use it). If you are compiling your halui component from it's source, i recommend you to change this variable to location that your system's nml file located. You can find it by running this command in your system:
$ sudo find / -name *.nml
It is probably gonna be located at /usr/share/linuxcnc/ with the name linuxcnc.nml

After identifying which nml file is being used, you can set this DEFAULT_EMC_NMLFILE variable to : "your_directory/<your_file>.nml" in src/emc/nml_intf/emccfg.h file, like described below:

#define DEFAULT_EMC_NMLFILE "your_directory/<your_file>.nml"

After this step, you should be able to compile your components and locate them in your system without errors. But please don't forget, you need to find your system's nml file. Linuxcnc and it's components start with this nml file.

The halui executable gives you ability to choose custom ini file, bu it doesn't do the same thing about nml files. You can check it's usage at the link described below:

--> github.com/machinekit/machinekit/blob/ma...alui.cc#L42C1-L43C12

As you see, it is not possible to set any other nml file than compile time constant in halui executable.It means you should compile it with this variable. If you are able to make changes in source code, of course you can customize this behaviour. I think all components has designed in this way. So if you want to start your halui component or the other components(like iocontrol, motmod, inihal) you need to compile them from source, with being sure about executable is gonna use the true nml file at start.

In addition, if you are looking for crash course about this, you can check sources of project. Otherwise, making integration between different platforms or computers needs knowledge. You can check Linuxcnc's or Machinekit's documentation but as i said, if you want to learn this stuff well, i recemmend you to examine the source code of project. There is no crash course about it except using some command line programs of linuxcnc.

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

More
29 Dec 2023 16:33 #289319 by B.Reilly01
Replied by B.Reilly01 on topic crash course in Halui
Thanks both of you for your detailed and thorough help - I clearly have way more to learn before I put together the machine the way I want it - last time I just used PNCCONF and it worked well enough, but I have more inputs and signals this time. I will do some studying and start new threads as I need assistance.

Thanks again

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

Time to create page: 0.402 seconds
Powered by Kunena Forum