Re: Testing and utility scripts
Fred
I made a script out of the code below and it seems to work. My opinion
is that we could make a second tcl directory in the release and call it
emc/tcl/testing that could hold a lot of scripts like this.
I would think that we could modify the settings menu just a bit and get
any file in the testing directory available under that like we have done
for the scripts menu. We could even move the calibration, logging, and
diagnostics files to that location and separate their code from the tkemc
proper. If we did this all of the testing and diagnostic stuff would appear there
and we could add, delete, edit these kinds of things without having to
work with the tkemc file at all.
An added benefit would be that these testing and calibration files could
carry different levels of security so that some operators might not have
access to them while maintenence folk would.
I'd be happy to work on this change if you think that it would be frutiful.
Ray
On Fri, 22 Sep 2000, you wrote:
> EMC folks,
>
> One of the reasons we wrote a Tcl/Tk-based EMC shell (emcsh) was so that
> we could write testing scripts. I envisioned a directory full of scripts
> that I'd run each time we built a new release, which would test things
> like incremental jogs working at the right speed, programs running
> properly and finishing at about the right time and at the right end
> position, etc. I also expected to write some utility scripts that you
> could pull up from a scripts menu in the GUI, that would do things like
> take the machine out of estop, turn servos on, home the axes, and put it
> in auto mode with one click.
>
> I wrote a script here for testing that I wanted to show as an example of
> what can be done. It puts the machine in
> estop-off/machine-on/manual-mode, and incrementally jogs the X, Y, and Z
> axes, printing errors if any of them are greater than some delta from
> the desired end position. It's appended here. You can use any of the
> "emc_XXX" commands listed in emc/src/emctask/emcsh.cc, which are
> peppered throughout the tkemc.tcl GUI script in the same directory.
>
> --Fred
>
> #!/bin/sh
> # the next line restarts using emcsh \
> exec plat/nonrealtime/bin/emcsh "$0" "$-at-"
>
> # set the handshaking so that commands return when EMC finishes them,
> # using 'done', rather than return when EMC gets them, using 'received'
> emc_wait done
>
> # take out of estop, if necessary
> if {[emc_estop] != "off"} {
> emc_estop off
> }
>
> # turn on, if necessary
> if {[emc_machine] != "on"} {
> emc_machine on
> }
>
> # put in manual mode, if necessary
> if {[emc_mode] != "manual"} {
> emc_mode manual
> }
>
> # set jog speed, increment for incremental jog tests
> set jogspeed 60.0
> set jogincr 0.1
>
> # set error delta for acceptable increment
> set jogdelta 0.005
>
> # define an absolute value function
> proc abs {val} {
> if {$val < 0} {
> return [expr - $val]
> }
> return $val
> }
>
> # incrementally jog each axis, record start and end pos, and print
> # error if it's more than jogdelta from target end position
> foreach axis {0 1 2} {
> # record start position
> set startpos [emc_abs_act_pos $axis]
> # do the jog
> emc_jog_incr $axis $jogspeed $jogincr
> # it's done, record end position
> set endpos [emc_abs_act_pos $axis]
> # compute error from end position
> set delta [abs [expr $endpos - $startpos - $jogincr]]
> # flag error, if necessary
> if {$delta > $jogdelta} {
> puts stdout "***error: position error of $delta for axis $axis"
> }
> }
>
> exit
Date Index |
Thread Index |
Back to archive index |
Back to Mailing List Page
Problems or questions? Contact