Add speed acceleration and descriptive information sourced from Dan's spreadsheet.
This commit is contained in:
@ -29,10 +29,11 @@ set FAILED_MOTCFG_CNT 0
|
|||||||
# NOTE Encoder readings for the limit switch positions are required.
|
# NOTE Encoder readings for the limit switch positions are required.
|
||||||
# If the encoder "absenchome" reading is not supplied it is set equal to rev_enc_lim
|
# If the encoder "absenchome" reading is not supplied it is set equal to rev_enc_lim
|
||||||
# ENCMOT_ATTLIST: Attributes which describe an axis which has both a motor and encoder.
|
# ENCMOT_ATTLIST: Attributes which describe an axis which has both a motor and encoder.
|
||||||
|
# OPT_ATTLIST: Optional attributes which may define recommended settings as well as descriptive information.
|
||||||
# REQ_ATTLIST: List of attributes required to generate a configuration for a motor object.
|
# REQ_ATTLIST: List of attributes required to generate a configuration for a motor object.
|
||||||
# SICS_CFG_MOTATTLIST: Extra attributes required to configure a motor object in SICS.
|
# SICS_CFG_MOTATTLIST: Extra attributes required to configure a motor object in SICS.
|
||||||
# SICS_CFG_ENCMOTATTLIST: Extra attributes required to configure a motor object with an encoder in SICS.
|
# SICS_CFG_ENCMOTATTLIST: Extra attributes required to configure a motor object with an encoder in SICS.
|
||||||
# ALL_ATTRIBUTES: List of all attributes recognised by this program.
|
# ALL_ATTRIBUTES: List of all possible attributes recognised by this program.
|
||||||
#
|
#
|
||||||
# Attributes which are not in these lists are assumed to define the encoder
|
# Attributes which are not in these lists are assumed to define the encoder
|
||||||
# readings for each position on an axis which has a set of meaningful positions
|
# readings for each position on an axis which has a set of meaningful positions
|
||||||
@ -40,10 +41,27 @@ set FAILED_MOTCFG_CNT 0
|
|||||||
set MOT_ATTLIST [lsort {axis mc steps_per_x}]
|
set MOT_ATTLIST [lsort {axis mc steps_per_x}]
|
||||||
set ENC_ATTLIST [lsort {cnts_per_x fwd_enc_lim rev_enc_lim}]
|
set ENC_ATTLIST [lsort {cnts_per_x fwd_enc_lim rev_enc_lim}]
|
||||||
set ENCMOT_ATTLIST [lsort [concat $MOT_ATTLIST $ENC_ATTLIST]]
|
set ENCMOT_ATTLIST [lsort [concat $MOT_ATTLIST $ENC_ATTLIST]]
|
||||||
|
set OPT_ATTLIST [lsort {axis_number dflt_accel_steps dflt_decel_steps dflt_speed_steps description speed accel decel}]
|
||||||
set SICS_CFG_MOTATTLIST [lsort {home fwd_lim rev_lim maxspeed maxaccel maxdecel part units}]
|
set SICS_CFG_MOTATTLIST [lsort {home fwd_lim rev_lim maxspeed maxaccel maxdecel part units}]
|
||||||
set SICS_CFG_ENCMOTATTLIST [lsort [concat absenchome $SICS_CFG_MOTATTLIST]]
|
set SICS_CFG_ENCMOTATTLIST [lsort [concat absenchome $SICS_CFG_MOTATTLIST]]
|
||||||
set REQ_ATTLIST [lsort [concat $MOT_ATTLIST $SICS_CFG_MOTATTLIST]]
|
set REQ_ATTLIST [lsort [concat $MOT_ATTLIST $SICS_CFG_MOTATTLIST]]
|
||||||
set ALL_ATTRIBUTES [lsort [concat $ENCMOT_ATTLIST $SICS_CFG_ENCMOTATTLIST]]
|
set ALL_ATTRIBUTES [lsort [concat $ENCMOT_ATTLIST $SICS_CFG_ENCMOTATTLIST $OPT_ATTLIST]]
|
||||||
|
|
||||||
|
set arg0 [lindex $argv 0]
|
||||||
|
if {[string match $arg0 "help"] || [string match $arg0 "--help"] || [string match $arg0 "-h"]} {
|
||||||
|
puts "\nUsage: $argv0 file1.csv file2.csv ..."
|
||||||
|
puts "\nThe following parameters must be provided in the CSV files,"
|
||||||
|
puts " $MOT_ATTLIST"
|
||||||
|
puts "\nA motor with an encoder must also provide these parameters,"
|
||||||
|
puts " $ENC_ATTLIST"
|
||||||
|
puts "\nOptionally these parameters may also be provided"
|
||||||
|
puts " $OPT_ATTLIST"
|
||||||
|
puts "\nIf these motor parameters are not provided they will be generated,"
|
||||||
|
puts " $SICS_CFG_MOTATTLIST"
|
||||||
|
puts "\nIf an axis has an encoder these parameters will be generated,"
|
||||||
|
puts " $SICS_CFG_ENCMOTATTLIST"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
array set autogen_attarr {}
|
array set autogen_attarr {}
|
||||||
set scriptname [file tail [file rootname $argv0]]
|
set scriptname [file tail [file rootname $argv0]]
|
||||||
@ -111,7 +129,7 @@ set fhmc [open "generated_motor_configuration.tcl" "w"]
|
|||||||
# Write configuration file header and make asyncqueues
|
# Write configuration file header and make asyncqueues
|
||||||
mk_cfg_header $fhmc
|
mk_cfg_header $fhmc
|
||||||
puts $fhmc ""
|
puts $fhmc ""
|
||||||
foreach mn [lsort [array names motor_attcnt]] {
|
foreach mn [lsort -dictionary [array names motor_attcnt]] {
|
||||||
set encmot_attlist [lsort [array names ${mn}_encatts]]
|
set encmot_attlist [lsort [array names ${mn}_encatts]]
|
||||||
set mot_attlist [lsort [concat [array names ${mn}_attarr] [array names ${mn}_encatts]]]
|
set mot_attlist [lsort [concat [array names ${mn}_attarr] [array names ${mn}_encatts]]]
|
||||||
set num_encatts_defined [llength $encmot_attlist]
|
set num_encatts_defined [llength $encmot_attlist]
|
||||||
@ -191,14 +209,30 @@ foreach mn [lsort [array names motor_attcnt]] {
|
|||||||
foreach att $undef_atts {
|
foreach att $undef_atts {
|
||||||
set attval [gen_attval $mn $att]
|
set attval [gen_attval $mn $att]
|
||||||
if {$attval != "NOATT"} {
|
if {$attval != "NOATT"} {
|
||||||
|
if [string is double $attval] {
|
||||||
|
set attval [format "%.4f" $attval]
|
||||||
|
}
|
||||||
lappend autogen_attarr($mn) "${mn}_$att,$attval"
|
lappend autogen_attarr($mn) "${mn}_$att,$attval"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if {[info exists ::${mn}_attarr(dflt_speed_steps)] && ![info exists ${mn}_attarr(speed)]} {
|
||||||
|
set speed_phys_units [ expr double([set ::${mn}_attarr(dflt_speed_steps)]) / abs([set ::${mn}_attarr(steps_per_x)]) ]
|
||||||
|
lappend ::autogen_attarr($mn) "${mn}_speed,[format "%.4f" $speed_phys_units]"
|
||||||
|
}
|
||||||
|
if {[info exists ::${mn}_attarr(dflt_accel_steps)] && ![info exists ${mn}_attarr(accel)]} {
|
||||||
|
set accel_phys_units [ expr double([set ::${mn}_attarr(dflt_accel_steps)]) / abs([set ::${mn}_attarr(steps_per_x)]) ]
|
||||||
|
lappend ::autogen_attarr($mn) "${mn}_accel,[format "%.4f" $accel_phys_units]"
|
||||||
|
}
|
||||||
|
if {[info exists ::${mn}_attarr(dflt_decel_steps)] && ![info exists ${mn}_attarr(decel)]} {
|
||||||
|
set decel_phys_units [ expr double([set ::${mn}_attarr(dflt_decel_steps)]) / abs([set ::${mn}_attarr(steps_per_x)]) ]
|
||||||
|
lappend ::autogen_attarr($mn) "${mn}_decel,[format "%.4f" $decel_phys_units]"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# If there are any autogenerated attributes then write them to a file.
|
# If there are any autogenerated attributes then write them to a file.
|
||||||
|
puts ""
|
||||||
if {[array size autogen_attarr] > 0} {
|
if {[array size autogen_attarr] > 0} {
|
||||||
set fh [open "missing_attlist.csv" "w"]
|
set fh [open "missing_attlist.csv" "w"]
|
||||||
puts "The attributes with default values needed to complete the configuration of the following motors has been written to missing_attlist.csv,"
|
puts "The attributes with default values needed to complete the configuration of the following motors has been written to missing_attlist.csv,"
|
||||||
@ -209,11 +243,11 @@ if {[array size autogen_attarr] > 0} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
close $fh
|
close $fh
|
||||||
puts ""
|
puts "\n"
|
||||||
puts "Rename missing_attlist.csv and redo to generate a configuration file which also includes the motors listed above."
|
puts "Rename missing_attlist.csv and redo to generate a configuration file which also includes the motors listed above."
|
||||||
puts "Eg,"
|
puts "Eg,"
|
||||||
puts "mv missing_attlist.csv sicsmot_attlist.csv"
|
puts " mv missing_attlist.csv sicsmot_attlist.csv"
|
||||||
puts "$argv0 $argv sicsmot_attlist.csv"
|
puts ""
|
||||||
}
|
}
|
||||||
|
|
||||||
# The SICS init code calls motor_set_sobj_attributes. It can be redefined in
|
# The SICS init code calls motor_set_sobj_attributes. It can be redefined in
|
||||||
|
@ -13,7 +13,6 @@ proc parse_file {fname fhr fhe} {
|
|||||||
puts $fhr "\nPARSE '$fname'"
|
puts $fhr "\nPARSE '$fname'"
|
||||||
set lcount 0
|
set lcount 0
|
||||||
set fh [open $fname "r"]
|
set fh [open $fname "r"]
|
||||||
puts $fhr "Create a per motor attribute dictionary for each attribute in the following list of required attributes,"
|
|
||||||
while {[gets $fh line] >= 0} {
|
while {[gets $fh line] >= 0} {
|
||||||
incr lcount
|
incr lcount
|
||||||
foreach {name val} [split $line {,}] {}
|
foreach {name val} [split $line {,}] {}
|
||||||
@ -37,7 +36,8 @@ proc parse_file {fname fhr fhe} {
|
|||||||
}
|
}
|
||||||
close $fh
|
close $fh
|
||||||
puts -nonewline $fhr "CONTROLLER USAGE COUNT: "
|
puts -nonewline $fhr "CONTROLLER USAGE COUNT: "
|
||||||
foreach {cont count} [array get ::controllers] {
|
foreach {cont} [lsort -dictionary [array names ::controllers]] {
|
||||||
|
set count $::controllers($cont)
|
||||||
puts -nonewline $fhr "$cont count=$count; "
|
puts -nonewline $fhr "$cont count=$count; "
|
||||||
}
|
}
|
||||||
puts $fhr ""
|
puts $fhr ""
|
||||||
@ -91,7 +91,7 @@ if {$sim_mode == true} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
puts $fhmc "if {\$sim_mode == false} \{"
|
puts $fhmc "if {\$sim_mode == false} \{"
|
||||||
foreach cont [array names ::controllers] {
|
foreach cont [lsort -dictionary [array names ::controllers]] {
|
||||||
set index [string toupper $cont]
|
set index [string toupper $cont]
|
||||||
puts $fhmc " [subst -nocommands {MakeAsyncQueue $cont DMC2280 [dict get \$::MOTOR_HOSTPORT $index HOST] [dict get \$::MOTOR_HOSTPORT $index PORT]}]"
|
puts $fhmc " [subst -nocommands {MakeAsyncQueue $cont DMC2280 [dict get \$::MOTOR_HOSTPORT $index HOST] [dict get \$::MOTOR_HOSTPORT $index PORT]}]"
|
||||||
}
|
}
|
||||||
@ -122,9 +122,14 @@ proc mk_motconf {mot fh absEnc posnum posit_list} {
|
|||||||
set home ${mot}_home
|
set home ${mot}_home
|
||||||
set part ${mot}_part
|
set part ${mot}_part
|
||||||
set long_name $mot
|
set long_name $mot
|
||||||
set description "$mot configuration"
|
|
||||||
|
|
||||||
puts $fh "# $description"
|
puts $fh "# $mot configuration"
|
||||||
|
if [info exists ::${mot}_attarr(description)] {
|
||||||
|
puts $fh "# [set ::${mot}_attarr(description)]"
|
||||||
|
}
|
||||||
|
if [info exists ::${mot}_attarr(axis_number)] {
|
||||||
|
puts $fh "# Axis number [set ::${mot}_attarr(axis_number)]"
|
||||||
|
}
|
||||||
puts $fh "Motor $mot \$motor_driver_type \[params\\"
|
puts $fh "Motor $mot \$motor_driver_type \[params\\"
|
||||||
puts $fh " asyncqueue $mc\\"
|
puts $fh " asyncqueue $mc\\"
|
||||||
puts $fh " axis $axis\\"
|
puts $fh " axis $axis\\"
|
||||||
@ -151,6 +156,15 @@ proc mk_motconf {mot fh absEnc posnum posit_list} {
|
|||||||
puts $fh "$mot home \$$home"
|
puts $fh "$mot home \$$home"
|
||||||
puts $fh "$mot part \$$part"
|
puts $fh "$mot part \$$part"
|
||||||
puts $fh "$mot long_name $long_name"
|
puts $fh "$mot long_name $long_name"
|
||||||
|
if [info exists ::${mot}_attarr(dflt_speed_steps)] {
|
||||||
|
puts $fh "$mot speed \$${mot}_speed"
|
||||||
|
}
|
||||||
|
if [info exists ::${mot}_attarr(dflt_accel_steps)] {
|
||||||
|
puts $fh "$mot accel \$${mot}_accel"
|
||||||
|
}
|
||||||
|
if [info exists ::${mot}_attarr(dflt_decel_steps)] {
|
||||||
|
puts $fh "$mot decel \$${mot}_decel"
|
||||||
|
}
|
||||||
puts $fh ""
|
puts $fh ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user