本文整理汇总了Python中Path.Path.set_axes方法的典型用法代码示例。如果您正苦于以下问题:Python Path.set_axes方法的具体用法?Python Path.set_axes怎么用?Python Path.set_axes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path.Path
的用法示例。
在下文中一共展示了Path.set_axes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import set_axes [as 别名]
def __init__(self):
""" Init """
logging.info("Redeem initializing " + version)
printer = Printer()
self.printer = printer
# check for config files
if not os.path.exists("/etc/redeem/default.cfg"):
logging.error("/etc/redeem/default.cfg does not exist, this file is required for operation")
sys.exit() # maybe use something more graceful?
# Parse the config files.
printer.config = CascadingConfigParser(
['/etc/redeem/default.cfg', '/etc/redeem/printer.cfg',
'/etc/redeem/local.cfg'])
# Find out which capes are connected
self.printer.config.parse_capes()
self.revision = self.printer.config.replicape_revision
if self.revision:
logging.info("Found Replicape rev. " + self.revision)
Path.set_axes(5)
else:
logging.warning("Oh no! No Replicape present!")
self.revision = "0A4A"
# We set it to 5 axis by default
Path.set_axes(5)
if self.printer.config.reach_revision:
Path.set_axes(8)
logging.info("Found Reach rev. "+self.printer.config.reach_revision)
# Get the revision and loglevel from the Config file
level = self.printer.config.getint('System', 'loglevel')
if level > 0:
logging.getLogger().setLevel(level)
if self.revision in ["00A4", "0A4A", "00A3"]:
PWM.set_frequency(100)
elif self.revision in ["00B1"]:
PWM.set_frequency(1000)
# Init the Paths
Path.axis_config = printer.config.getint('Geometry', 'axis_config')
# Init the end stops
EndStop.callback = self.end_stop_hit
EndStop.inputdev = self.printer.config.get("Endstops", "inputdev")
for es in ["X1", "X2", "Y1", "Y2", "Z1", "Z2"]:
pin = self.printer.config.get("Endstops", "pin_"+es)
keycode = self.printer.config.getint("Endstops", "keycode_"+es)
invert = self.printer.config.getboolean("Endstops", "invert_"+es)
self.printer.end_stops[es] = EndStop(pin, keycode, es, invert)
# Backwards compatibility with A3
if self.revision == "00A3":
# Init the 5 Stepper motors (step, dir, fault, DAC channel, name)
printer.steppers["X"] = Stepper_00A3("GPIO0_27", "GPIO1_29", "GPIO2_4" , 0, "X", 0, 0)
printer.steppers["Y"] = Stepper_00A3("GPIO1_12", "GPIO0_22", "GPIO2_5" , 1, "Y", 1, 1)
printer.steppers["Z"] = Stepper_00A3("GPIO0_23", "GPIO0_26", "GPIO0_15", 2, "Z", 2, 2)
printer.steppers["E"] = Stepper_00A3("GPIO1_28", "GPIO1_15", "GPIO2_1" , 3, "E", 3, 3)
printer.steppers["H"] = Stepper_00A3("GPIO1_13", "GPIO1_14", "GPIO2_3" , 4, "H", 4, 4)
elif self.revision == "00B1":
# Init the 5 Stepper motors (step, dir, fault, DAC channel, name)
printer.steppers["X"] = Stepper_00B1("GPIO0_27", "GPIO1_29", "GPIO2_4" , 11, 0, "X", 0, 0)
printer.steppers["Y"] = Stepper_00B1("GPIO1_12", "GPIO0_22", "GPIO2_5" , 12, 1, "Y", 1, 1)
printer.steppers["Z"] = Stepper_00B1("GPIO0_23", "GPIO0_26", "GPIO0_15", 13, 2, "Z", 2, 2)
printer.steppers["E"] = Stepper_00B1("GPIO1_28", "GPIO1_15", "GPIO2_1" , 14, 3, "E", 3, 3)
printer.steppers["H"] = Stepper_00B1("GPIO1_13", "GPIO1_14", "GPIO2_3" , 15, 4, "H", 4, 4)
else:
# Init the 5 Stepper motors (step, dir, fault, DAC channel, name)
printer.steppers["X"] = Stepper_00A4("GPIO0_27", "GPIO1_29", "GPIO2_4" , 0, 0, "X", 0, 0)
printer.steppers["Y"] = Stepper_00A4("GPIO1_12", "GPIO0_22", "GPIO2_5" , 1, 1, "Y", 1, 1)
printer.steppers["Z"] = Stepper_00A4("GPIO0_23", "GPIO0_26", "GPIO0_15", 2, 2, "Z", 2, 2)
printer.steppers["E"] = Stepper_00A4("GPIO1_28", "GPIO1_15", "GPIO2_1" , 3, 3, "E", 3, 3)
printer.steppers["H"] = Stepper_00A4("GPIO1_13", "GPIO1_14", "GPIO2_3" , 4, 4, "H", 4, 4)
if printer.config.reach_revision:
printer.steppers["A"] = Stepper_00A4("GPIO2_2" , "GPIO1_18", "GPIO0_14", 5, 5, "A", 5, 5)
printer.steppers["B"] = Stepper_00A4("GPIO1_14", "GPIO0_5" , "GPIO0_14", 6, 6, "B", 6, 6)
printer.steppers["C"] = Stepper_00A4("GPIO0_3" , "GPIO3_19", "GPIO0_14", 7, 7, "C", 7, 7)
# Enable the steppers and set the current, steps pr mm and
# microstepping
for name, stepper in self.printer.steppers.iteritems():
stepper.in_use = printer.config.getboolean('Steppers', 'in_use_' + name)
stepper.direction = printer.config.getint('Steppers', 'direction_' + name)
stepper.has_endstop = printer.config.getboolean('Endstops', 'has_' + name)
stepper.set_current_value(printer.config.getfloat('Steppers', 'current_' + name))
stepper.set_steps_pr_mm(printer.config.getfloat('Steppers', 'steps_pr_mm_' + name))
stepper.set_microstepping(printer.config.getint('Steppers', 'microstepping_' + name))
stepper.set_decay(printer.config.getboolean("Steppers", "slow_decay_" + name))
# Add soft end stops
Path.soft_min[Path.axis_to_index(name)] = printer.config.getfloat('Endstops', 'soft_end_stop_min_' + name)
Path.soft_max[Path.axis_to_index(name)] = printer.config.getfloat('Endstops', 'soft_end_stop_max_' + name)
# Commit changes for the Steppers
#Stepper.commit()
#.........这里部分代码省略.........
示例2: Printer
# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import set_axes [as 别名]
steppers["H"].set_steps_pr_mm(5.0)
printer = Printer()
printer.steppers = steppers
# Parse the config
printer.config = CascadingConfigParser(
['configs/default.cfg'])
# Get the revision from the Config file
printer.config.parse_capes()
revision = printer.config.replicape_revision
dirname = os.path.dirname(os.path.realpath(__file__))
Path.set_axes(5)
path_planner = PathPlanner(printer, None)
speed = 3000 / 60000.0
path_planner.add_path(AbsolutePath(
{
"X": 0.01
}, speed))
path_planner.add_path(AbsolutePath(
{
"X": 0.0
}, speed))