userspace python/HAL component not becoming ready
- tensaiteki
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
22 Jan 2012 06:24 #17011
by tensaiteki
userspace python/HAL component not becoming ready was created by tensaiteki
I am building a reprap machine where the motors are controlled by EMC2 (err.... I mean LinuxCNC) and a TB6560 board and the extruder heater and thermocouple are controlled by a standard reprap aurdrino board.
I already have a PyVCP meter set up to display the current temperature of the extruder tip.
The problem is I can't seem to get the HAL component that queries the audrino to become ready.
The component I am using came from here: github.com/brendanjerwin/emcrepstrap/blo...tion/reprap-extruder
I had to modify it slightly to work with the newer reprap firmware, here is my modified version:
When I try to run LinuxCNC with "loadusr -W /home/reprap/emc2/configs/reprap/reprap-extruder /dev/ttyUSB0" in the HAL file, after the spalsh screen, I get nothing. No error messages, no Axis, nothing.
When I run the component under halrun it will keep printing out the current extruder temperature indefinitely until I force-stop it (Ctrl-C):
If I comment out everything in the component after the .ready() function call (so the while loop never happens), I get the following under halrun:
I get the exact same message if I also comment out the c.ready() line.
However if I insert another c.ready() line anywhere else in the component, I get an error message saying that the component is already ready.
Any ideas what I am doing wrong?
System is Ubuntu 10.04 (installed from live CD) with LinuxCNC version 2.4.7 (updated via update manager).
I already have a PyVCP meter set up to display the current temperature of the extruder tip.
The problem is I can't seem to get the HAL component that queries the audrino to become ready.
The component I am using came from here: github.com/brendanjerwin/emcrepstrap/blo...tion/reprap-extruder
I had to modify it slightly to work with the newer reprap firmware, here is my modified version:
#!/usr/bin/env python
# encoding: utf-8
"""
Created by Brendan Erwin on 2008-05-21.
Copyright (c) 2008 Brendan Erwin. All rights reserved.
Slightly Modified by Tensaiteki on 2012-01-21
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
import serial
import hal
import sys
import time
PORT = "/dev/ttyUSB0"
#allow the port to be overridden
if len(sys.argv) > 1:
PORT = sys.argv[1]
#Establish serial link
ser = serial.Serial(PORT, 19200, timeout=2)
#Setup the HAL component and pins
c = hal.component("reprap-extruder")
c.newpin("temperature", hal.HAL_FLOAT, hal.HAL_IN)
c.ready()
data = ""
try:
while 1:
time.sleep(1)
ser.write("M105\n")
while ser.inWaiting():
data += ser.read()
if len(data) > 0:
#print >> sys.stdout, data
start = data.find("T:")
if start <> -1:
start += 2
end = data.index("\r",start)
print >> sys.stdout, data[start:end]
c["temperature"] = int(data[start:end])
data = ""
except KeyboardInterrupt:
raise SystemExit
When I try to run LinuxCNC with "loadusr -W /home/reprap/emc2/configs/reprap/reprap-extruder /dev/ttyUSB0" in the HAL file, after the spalsh screen, I get nothing. No error messages, no Axis, nothing.
When I run the component under halrun it will keep printing out the current extruder temperature indefinitely until I force-stop it (Ctrl-C):
halcmd: loadusr -W /home/reprap/emc2/configs/reprap/reprap-extruder /dev/ttyUSB0
Waiting for component '/home/reprap/emc2/configs/reprap/reprap-extruder' to become ready.....................23
..........23
..........23
..........23
..........23
..........23
..........23
..........23
..........23
.........23
..........23
..........23
..........23
..........23
..........^C
<stdin>:2: /home/reprap/emc2/configs/reprap/reprap-extruder exited without becoming ready
If I comment out everything in the component after the .ready() function call (so the while loop never happens), I get the following under halrun:
halcmd: loadusr -W /home/reprap/emc2/configs/reprap/reprap-extruder /dev/ttyUSB0
<stdin>:2: /home/reprap/emc2/configs/reprap/reprap-extruder exited without becoming ready
halcmd:
I get the exact same message if I also comment out the c.ready() line.
However if I insert another c.ready() line anywhere else in the component, I get an error message saying that the component is already ready.
Any ideas what I am doing wrong?
System is Ubuntu 10.04 (installed from live CD) with LinuxCNC version 2.4.7 (updated via update manager).
Please Log in or Create an account to join the conversation.
22 Jan 2012 06:44 #17012
by cmorley
Replied by cmorley on topic Re:userspace python/HAL component not becoming ready
run emc after the crash check and post dmesg
hopefully a little clue will be there.
hopefully a little clue will be there.
Please Log in or Create an account to join the conversation.
22 Jan 2012 06:48 #17013
by cmorley
Replied by cmorley on topic Re:userspace python/HAL component not becoming ready
just as a hunch try using a name without a - in it. a single word name.
Please Log in or Create an account to join the conversation.
- tensaiteki
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
22 Jan 2012 07:28 - 22 Jan 2012 07:29 #17014
by tensaiteki
Replied by tensaiteki on topic Re:userspace python/HAL component not becoming ready
Ok, if I run EMC with the reprap-extruder component in the hal file, it doesn't really crash after the splash screen. The spalsh screen just goes away and nothing happens until I try to start EMC again at which point I get a dialog box that says it is already running and asking if I want to restart EMC. If I click 'restart', then I get an error message:
(all the '23's are the output from the reprap-extruder component showing that the tip is at 23 degrees C.)
I tried renaming reprap-extruder to reprapextruder but got the exact same errors/behavior.
(all the '23's are the output from the reprap-extruder component showing that the tip is at 23 degrees C.)
Print file information:
RUN_IN_PLACE=no
EMC2_DIR=
EMC2_BIN_DIR=/usr/bin
EMC2_TCL_DIR=/usr/share/emc/tcl
EMC2_SCRIPT_DIR=
EMC2_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/emc2
EMC2_CONFIG_DIR=
EMC2_LANG_DIR=/usr/share/emc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
EMC2_EMCSH=/usr/bin/wish8.5
EMC2 - 2.4.6
Machine configuration directory is '/home/reprap/emc2/configs/reprap'
Machine configuration file is 'reprap.ini'
INIFILE=/home/reprap/emc2/configs/reprap/reprap.ini
PARAMETER_FILE=emc.var
EMCMOT=motmod
EMCIO=io
TASK=milltask
HALUI=halui
DISPLAY=axis
NML_FILE=
Starting EMC2...
Starting EMC2 server program: emcsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting EMC2 IO program: io
Starting HAL User Interface program: halui
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
Shutting down and cleaning up EMC2...
Killing task emcsvr, PID=18995
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Cleanup done
Debug file information:
Waiting for component '/home/reprap/emc2/configs/reprap/reprap-extruder' to become ready...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
custom.hal:6: /home/reprap/emc2/configs/reprap/reprap-extruder exited without becoming ready
18995
PID TTY STAT TIME COMMAND
Stopping realtime threads
RTAPI: ERROR: could not open shared memory (errno=2)
HAL: ERROR: rtapi init failed
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
Unloading hal components
RTAPI: ERROR: could not open shared memory (errno=2)
HAL: ERROR: rtapi init failed
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (errno=2)
HAL: ERROR: rtapi init failed
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (errno=2)
HAL: ERROR: rtapi init failed
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (errno=2)
HAL: ERROR: rtapi init failed
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (errno=2)
HAL: ERROR: rtapi init failed
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (errno=2)
HAL: ERROR: rtapi init failed
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
ERROR: Module hal_lib is in use by stepgen,hal_parport,probe_parport,motmod,trivkins
ERROR: Module rtapi is in use by stepgen,hal_parport,probe_parport,motmod,hal_lib
ERROR: Module rtai_math is in use by motmod
ERROR: Module rtai_sem is in use by rtapi
ERROR: Module rtai_fifos is in use by rtapi
ERROR: Module rtai_sched is in use by rtapi,rtai_sem,rtai_fifos
ERROR: Module rtai_hal is in use by rtapi,rtai_sem,rtai_fifos,rtai_sched
Kernel message information:
[188094.213601] I-pipe: Domain RTAI registered.
[188094.213620] RTAI[hal]: <3.8.1> mounted over IPIPE-NOTHREADS 2.6-03.
[188094.213627] RTAI[hal]: compiled with gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) .
[188094.213750] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[188094.213756] PIPELINE layers:
[188094.213763] fba20e20 9ac15d93 RTAI 200
[188094.213769] c085cb20 0 Linux 100
[188094.261086] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[188094.261778] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: <with RTAI OWN KTASKs>, kstacks pool size = 524288 bytes.
[188094.261790] RTAI[sched]: hard timer type/freq = APIC/12500388(Hz); default timing: periodic; linear timed lists.
[188094.261797] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 1799590000 hz.
[188094.261803] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
[188094.261932] RTAI[usi]: enabled.
[188094.354084] RTAI[math]: loaded.
[188094.484852] config string '0x378 out '
I tried renaming reprap-extruder to reprapextruder but got the exact same errors/behavior.
Last edit: 22 Jan 2012 07:29 by tensaiteki.
Please Log in or Create an account to join the conversation.
22 Jan 2012 09:06 #17015
by cmorley
Replied by cmorley on topic Re:userspace python/HAL component not becoming ready
ok another guess. -W tells HAL to wait for the component named as the next argument after -W.
your component has a path so I'm thinking the path is screwing it up. HAL thinks the components name is the complete path name.
add the component in your $PATH and then drop the path from the loadusr command
your component has a path so I'm thinking the path is screwing it up. HAL thinks the components name is the complete path name.
add the component in your $PATH and then drop the path from the loadusr command
Please Log in or Create an account to join the conversation.
22 Jan 2012 09:08 #17016
by cmorley
Replied by cmorley on topic Re:userspace python/HAL component not becoming ready
lol now that I really read the error message :
<stdin>:2: /home/reprap/emc2/configs/reprap/reprap-extruder exited without becoming ready
for sure that is the problem.
<stdin>:2: /home/reprap/emc2/configs/reprap/reprap-extruder exited without becoming ready
for sure that is the problem.
Please Log in or Create an account to join the conversation.
- tensaiteki
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
22 Jan 2012 15:25 #17017
by tensaiteki
Replied by tensaiteki on topic Re:userspace python/HAL component not becoming ready
Sorry to sound like a n00b but how do I find out where $Path is?
I used the full path for the component because I couldn't figure out where HAL was looking for it otherwise.
I tried using the path for nc_files specified in the ini, but that didn't work.
I just re-read the HAL user manual and it makes one reference to $PATH but doesn't say where it is.
I used the full path for the component because I couldn't figure out where HAL was looking for it otherwise.
I tried using the path for nc_files specified in the ini, but that didn't work.
I just re-read the HAL user manual and it makes one reference to $PATH but doesn't say where it is.
Please Log in or Create an account to join the conversation.
22 Jan 2012 16:31 - 22 Jan 2012 16:33 #17019
by ArcEye
Replied by ArcEye on topic Re:userspace python/HAL component not becoming ready
Hi
Its a linux thing rather than HAL.
echo $PATH will display the current PATH settings
PATH=$PATH:/usr/new/path/added/
export PATH
will append a new path to the PATH environment variable
If you want this to be permanent for all your logins, then add the required paths to the PATH line in ~/.bashrc
regards
Its a linux thing rather than HAL.
echo $PATH will display the current PATH settings
PATH=$PATH:/usr/new/path/added/
export PATH
will append a new path to the PATH environment variable
If you want this to be permanent for all your logins, then add the required paths to the PATH line in ~/.bashrc
regards
Last edit: 22 Jan 2012 16:33 by ArcEye.
Please Log in or Create an account to join the conversation.
22 Jan 2012 16:38 #17020
by dab77
Replied by dab77 on topic Re:userspace python/HAL component not becoming ready
Try to put a copy of your reprap.py into ../emc2-dev/bin but without the .py extension, and give that permission to execute.
Then if you like you can put the halcmd inside your .hal file, like:
loadusr -W reprap
Davide.
Then if you like you can put the halcmd inside your .hal file, like:
loadusr -W reprap
Davide.
Please Log in or Create an account to join the conversation.
22 Jan 2012 23:33 - 22 Jan 2012 23:34 #17027
by cmorley
Replied by cmorley on topic Re:userspace python/HAL component not becoming ready
We should probably add this to the manual in the python HAL section ...
Last edit: 22 Jan 2012 23:34 by cmorley.
Please Log in or Create an account to join the conversation.
Time to create page: 0.083 seconds