gladeVCP timer error
14 Jan 2024 17:39 - 14 Jan 2024 17:40 #290675
by tommy
gladeVCP timer error was created by tommy
I'm migrating from 2.7 to 2.9.2, also gladeVCP and there I had two timers (cycle timer and cumulative timer).
I'm receiving error for time2 component. Did anything changed?
Here is timers code:[/code][/code]
[/code]
[/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code]
[/code]
I'm receiving error for time2 component. Did anything changed?
Here is timers code:
[code][code][code]loadrt time2
addf time2.0 servo-thread
addf not.2 servo-thread
net prog-running not.2.in <= halui.program.is-idle
net cycle-timer time2.0.start <= not.2.out
net cycle-seconds gladevcp.hal_label5 <= time2.0.seconds
net cycle-minutes gladevcp.hal_label3 <= time2.0.minutes
net cycle-hours gladevcp.hal_label1 <= time2.0.hours
net total-cycle-seconds gladevcp.hal_label10 <= time2.0.totalofseconds
net total-cycle-minutes gladevcp.hal_label8 <= time2.0.totalofminutes
net total-cycle-hours gladevcp.hal_label6 <= time2.0.totalofhours
net total-reset gladevcp.hal_button4 => time2.0.reset
[/code]
[code][code][code][code][code]And debug report:
[code][code][code][code][code][code][code][code][code][code][code][code][code]time2: dlopen: /usr/lib/linuxcnc/modules/time2.so: cannot open shared object file: No such file or directory
gladevcp.hal:19: waitpid failed /usr/bin/rtapi_app time2
gladevcp.hal:19: /usr/bin/rtapi_app exited without becoming ready
gladevcp.hal:19: insmod for time2 failed, returned -1
(gladevcp:91390): Gdk-WARNING **: 18:15:23.804: GdkWindow 0x4000003 unexpectedly destroyed
/usr/lib/python3/dist-packages/gi/overrides/Gtk.py:1689: Warning: ../../../gobject/gsignal.c:2772: instance '0x1ebd450' has no handler with id '158'
return _Gtk_main(*args, **kwargs)
**** GLADE VCP ERROR: X Protocol Error: 3
[/code]
Last edit: 14 Jan 2024 17:40 by tommy.
Please Log in or Create an account to join the conversation.
15 Jan 2024 04:41 #290729
by cmorley
Replied by cmorley on topic gladeVCP timer error
linuxcnc has no component called time2 - do you use a custom component called time2?
Please Log in or Create an account to join the conversation.
15 Jan 2024 16:59 #290770
by tommy
Replied by tommy on topic gladeVCP timer error
This solved for custom component
now this error showed up
Code used for time2 component:
component time2 "Time on in Hours, Minutes, Seconds with cumulative totals";
description
"""
Time2
When the time2.N.start bit goes true the cycle timer resets and starts
to time2 until time.N.start goes false. If you connect time2.N.start to
halui.is-running as a cycle timer it will reset during a pause. See
the example connections below to keep the timer timing during a pause.
Time2 returns the hours, minutes, and seconds that time2.N.start is true.
The cumulative total is displayed by the second set of pins
Sample pyVCP code to display the hours:minutes:seconds.
<pyvcp>
<hbox>
<label>
<text>"Cycle Time"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"time-hours"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
<label>
<text>":"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"time-minutes"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
<label>
<text>":"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"time-seconds"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
</hbox>
<hbox>
<label>
<text>"Total Time"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"total-time-hours"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
<label>
<text>":"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"total-time-minutes"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
<label>
<text>":"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"total-time-seconds"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
</hbox>
<hbox>
<button>
<halpin>"reset"</halpin>
<text>"Reset Total"</text>
<font>('Fixed',16)</font>
<relief>RAISED</relief>
</button>
</hbox>
</pyvcp>
In your post-gui.hal file you might use the following to connect it up
loadrt time2
loadrt not
addf time2.0 servo-thread
addf not.0 servo-thread
net prog-running not.0.in <= halui.program.is-idle
net cycle-timer time2.0.start <= not.0.out
net cycle-seconds pyvcp.time-seconds <= time2.0.seconds
net cycle-minutes pyvcp.time-minutes <= time2.0.minutes
net cycle-hours pyvcp.time-hours <= time2.0.hours
net total-cycle-seconds pyvcp.total-time-seconds <= time2.0.totalofseconds
net total-cycle-minutes pyvcp.total-time-minutes <= time2.0.totalofminutes
net total-cycle-hours pyvcp.total-time-hours <= time2.0.totalofhours
""";
author "John Thornton (modified by ArcEye)";
license "GPL";
// Input Pins
pin in bit start "Timer On";
pin in bit reset "Reset the cumulative timer";
// Output Pins
pin out u32 seconds "Seconds";
pin out u32 minutes "Minutes";
pin out u32 hours "Hours";
pin out u32 totalofseconds "total-Seconds";
pin out u32 totalofminutes "total-Minutes";
pin out u32 totalofhours "total-Hours";
// Global Variables
variable double totalnsec;
variable int old_start;
variable int totalseconds = 0;
variable int sumtotalseconds = 0;
function _;
;;
#include "rtapi_math.h"
FUNCTION(_)
{
if(reset)
sumtotalseconds = 0;
if(start && !old_start)
{
sumtotalseconds += totalseconds;
totalnsec = 0;
}
if(start)
{
totalnsec = totalnsec + period;
totalseconds = totalnsec * 0.000000001;
seconds = totalseconds % 60;
minutes = (totalseconds / 60) % 60;
hours = (totalseconds / 3600);
totalofseconds = (totalseconds + sumtotalseconds) % 60;
totalofminutes = ((totalseconds +sumtotalseconds) / 60) % 60;
totalofhours = ((totalseconds +sumtotalseconds) / 3600);
}
old_start = start;
}
sudo halcompile --install time2.comp
now this error showed up
HAL: ERROR: type mismatch 'time2.0.totalofseconds' <- 'total-cycle-seconds'
gladevcp.hal:26: link failed
(gladevcp:3228): Gdk-WARNING **: 17:48:04.752: GdkWindow 0x3c00003 unexpectedly destroyed
**** GLADE VCP ERROR: X Protocol Error: 3
Code used for time2 component:
Warning: Spoiler!
component time2 "Time on in Hours, Minutes, Seconds with cumulative totals";
description
"""
Time2
When the time2.N.start bit goes true the cycle timer resets and starts
to time2 until time.N.start goes false. If you connect time2.N.start to
halui.is-running as a cycle timer it will reset during a pause. See
the example connections below to keep the timer timing during a pause.
Time2 returns the hours, minutes, and seconds that time2.N.start is true.
The cumulative total is displayed by the second set of pins
Sample pyVCP code to display the hours:minutes:seconds.
<pyvcp>
<hbox>
<label>
<text>"Cycle Time"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"time-hours"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
<label>
<text>":"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"time-minutes"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
<label>
<text>":"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"time-seconds"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
</hbox>
<hbox>
<label>
<text>"Total Time"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"total-time-hours"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
<label>
<text>":"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"total-time-minutes"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
<label>
<text>":"</text>
<font>("Helvetica",14)</font>
</label>
<u32>
<halpin>"total-time-seconds"</halpin>
<font>("Helvetica",14)</font>
<format>"2d"</format>
</u32>
</hbox>
<hbox>
<button>
<halpin>"reset"</halpin>
<text>"Reset Total"</text>
<font>('Fixed',16)</font>
<relief>RAISED</relief>
</button>
</hbox>
</pyvcp>
In your post-gui.hal file you might use the following to connect it up
loadrt time2
loadrt not
addf time2.0 servo-thread
addf not.0 servo-thread
net prog-running not.0.in <= halui.program.is-idle
net cycle-timer time2.0.start <= not.0.out
net cycle-seconds pyvcp.time-seconds <= time2.0.seconds
net cycle-minutes pyvcp.time-minutes <= time2.0.minutes
net cycle-hours pyvcp.time-hours <= time2.0.hours
net total-cycle-seconds pyvcp.total-time-seconds <= time2.0.totalofseconds
net total-cycle-minutes pyvcp.total-time-minutes <= time2.0.totalofminutes
net total-cycle-hours pyvcp.total-time-hours <= time2.0.totalofhours
""";
author "John Thornton (modified by ArcEye)";
license "GPL";
// Input Pins
pin in bit start "Timer On";
pin in bit reset "Reset the cumulative timer";
// Output Pins
pin out u32 seconds "Seconds";
pin out u32 minutes "Minutes";
pin out u32 hours "Hours";
pin out u32 totalofseconds "total-Seconds";
pin out u32 totalofminutes "total-Minutes";
pin out u32 totalofhours "total-Hours";
// Global Variables
variable double totalnsec;
variable int old_start;
variable int totalseconds = 0;
variable int sumtotalseconds = 0;
function _;
;;
#include "rtapi_math.h"
FUNCTION(_)
{
if(reset)
sumtotalseconds = 0;
if(start && !old_start)
{
sumtotalseconds += totalseconds;
totalnsec = 0;
}
if(start)
{
totalnsec = totalnsec + period;
totalseconds = totalnsec * 0.000000001;
seconds = totalseconds % 60;
minutes = (totalseconds / 60) % 60;
hours = (totalseconds / 3600);
totalofseconds = (totalseconds + sumtotalseconds) % 60;
totalofminutes = ((totalseconds +sumtotalseconds) / 60) % 60;
totalofhours = ((totalseconds +sumtotalseconds) / 3600);
}
old_start = start;
}
Please Log in or Create an account to join the conversation.
16 Jan 2024 08:16 #290839
by pawel77
Replied by pawel77 on topic gladeVCP timer error
Hi,
in my case after installation of 2.9.2 I can not start any configuration with gladevcp as well these included with linuxcnc.
Gladevcp is not available in synoptic manager, and do not know where to find it.
thanks beforehand for any help
in my case after installation of 2.9.2 I can not start any configuration with gladevcp as well these included with linuxcnc.
Gladevcp is not available in synoptic manager, and do not know where to find it.
thanks beforehand for any help
Please Log in or Create an account to join the conversation.
16 Jan 2024 17:12 #290881
by tommy
Replied by tommy on topic gladeVCP timer error
My gladeVCP works OK inside 2.9.2 (axis), so I think my error (type mismatch) might be related to time2 custom component, but my programming skills don't reach that far to find the source...
Please Log in or Create an account to join the conversation.
16 Jan 2024 21:23 #290909
by tommy
Replied by tommy on topic gladeVCP timer error
Could be the reason that time2 output (pin) is s32, hal_label (pin) takes float?
Please Log in or Create an account to join the conversation.
23 Jan 2024 19:16 #291449
by tommy
Replied by tommy on topic gladeVCP timer error
I tested line by line, and pins (seconds, minutes, hours) from time2 component are working and showing up correctly in gladevcp
pins (totalofseconds, totalofminutes and totalofhours) are still causing "type mismatch"
Any idea what could be wrong?
addf time2.0 servo-thread
addf not.2 servo-thread
net prog-running not.2.in <= halui.program.is-idle
net cycle-timer time2.0.start <= not.2.out
net cycle-seconds gladevcp.hal_label5 <= time2.0.seconds
net cycle-minutes gladevcp.hal_label3 <= time2.0.minutes
net cycle-hours gladevcp.hal_label1 <= time2.0.hours
pins (totalofseconds, totalofminutes and totalofhours) are still causing "type mismatch"
net total-cycle-seconds gladevcp.hal_label10 <= time2.0.totalofseconds
net total-cycle-minutes gladevcp.hal_label8 <= time2.0.totalofminutes
net total-cycle-hours gladevcp.hal_label6 <= time2.0.totalofhours
Any idea what could be wrong?
Please Log in or Create an account to join the conversation.
23 Jan 2024 19:22 #291450
by Aciera
Replied by Aciera on topic gladeVCP timer error
maybe try one of the may conversion components:
linuxcnc.org/docs/html/man/man9/conv_u32_float.9.html
linuxcnc.org/docs/html/man/man9/conv_float_u32.9.html
linuxcnc.org/docs/html/man/man9/conv_u32_float.9.html
linuxcnc.org/docs/html/man/man9/conv_float_u32.9.html
Please Log in or Create an account to join the conversation.
23 Jan 2024 19:35 #291453
by Aciera
Replied by Aciera on topic gladeVCP timer error
also note that you might need to set the data type you need in the hal_label widget:
this is from ./docs/src/gui/gladevcp.adoc:
this is from ./docs/src/gui/gladevcp.adoc:
[[gladevcp:hal-label]]
=== Label
`hal_label` is a simple widget based on GtkLabel which represents a HAL pin value in a user-defined format.
label_pin_type::
The pin's HAL type (0:s32, 1:float, 2:u32), see also the tooltip on 'General→HAL pin type' (note this is different from PyVCP which has three label widgets, one for each type).
text_template::
Determines the text displayed - a Python format string to convert the pin value to text.
Defaults to +%s+ (values are converted by the str() function) but may contain any legit as an argument to Pythons format() method. +
Example: +Distance: %.03f+ will display the text and the pin value with 3 fractional digits padded with zeros for a FLOAT pin.
Please Log in or Create an account to join the conversation.
23 Jan 2024 19:52 #291456
by tommy
Replied by tommy on topic gladeVCP timer error
From time2.comp seems that all pins are defined as u32, also checked inside Lcnc and are visible as same type.
// Output Pins
pin out u32 seconds "Seconds";
pin out u32 minutes "Minutes";
pin out u32 hours "Hours";
pin out u32 totalofseconds "total-Seconds";
pin out u32 totalofminutes "total-Minutes";
pin out u32 totalofhours "total-Hours";
Please Log in or Create an account to join the conversation.
Moderators: HansU
Time to create page: 0.100 seconds