Machine.arcYZ()

[Motion86]

説明

Use clockwise arcs or counterclockwise arcs to draw a circle. The direction is viewed from the positive direction of the X-axis where the circular motion occurs.

This method uses two different ways to control the arc path depending on the input parameters:

  1. Center mode – i.e., the center of the circle is given with the end point position to calculate the path of the arc.
  2. Radius mode – i.e., the radius and the end position are given to calculate the path of the arc.

Note that either arc motion method may result in the target not being on the circle due to parameter setting error, which will cause the machine to have unintended motion.

For more information about the various motion methods, please refer to the Motion Method Explanation page.

Syntax

machine.arcYZ(r, dstY, dstZ);
machine.arcYZ(r, dstY, dstZ, revDir);
machine.arcYZ(r, dstY, dstZ, revDir, feedrate);
machine.arcYZ(cY, cZ, dstY, dstZ);
machine.arcYZ(cY, cZ, dstY, dstZ, revDir);
machine.arcYZ(cY, cZ, dstY, dstZ, revDir, feedrate);

Parameters

  • machine: Machine object.
  • r: The radius of the circle in radius mode.
  • cY: The center Y coordinate of the circle in center mode.
  • cZ: the center Z coordinate of the circle in center mode.
  • dstY: The target Y coordinate.
  • dstZ: target Z coordinate.
  • revDir: reversing direction, use true when counterclockwise, use false when clockwise, default is clockwise.
  • feedrate: Feedrate, the last recorded feedrate will be used when no parameter is passed.

Returns

bool.

  • true: The machine exists and was created successfully.
  • false: The machine does not exist or failed to be created.

Example

Set the basic parameters of the machine and use each of the two modes for the arc motion in the YZ plane.

#include "Motion86.h"
 
// Generate machine objects, up to machine 0~2 three machines, each machine has three axes. 
Machine machine(0);
 
// Stepper motor enable pin.
int EnablePin = 4;
 
void setup() {
  while (!Serial);
  pinMode(EnablePin, OUTPUT);
 
  // If necessary, the motion direction of the motion axis can be reversed.
  // In this example, the direction of x-axis and y-axis should be reversed.
  machine.config_ReverseDirection(AXIS_X);
  machine.config_ReverseDirection(AXIS_Y);
 
  // PPU (pulse per unit) is a virtual length unit, depending on different requirements.
  // In this example, the unit length of x-axis is set to 80 pulses, which corresponds to 1 mm in real application.
  machine.config_PPU(AXIS_X, 80.0);
  machine.config_PPU(AXIS_Y, 80.0);
  machine.config_PPU(AXIS_Z, 1600.0);
 
  // The machine must be started before control.
  machine.machineOn();
  machine.setDefaultFeedrate(400);
 
  // Start the stepper motor.
  digitalWrite(EnablePin, LOW);
}
 
void loop() {
  // Move clockwise with radius 10 to (0, 10, 10).
  machine.arcYZ(10, 10, 10, true);
 
  // Move counterclockwise to (0, 0, 0) with radius 10.
  machine.arcYZ(10, 0, 0, false);
 
  // Move clockwise to (0, 10, 10) with the center of the circle (0, 0, 10).
  machine.arcYZ(0, 10, 10, 10, true);
 
  // Move counterclockwise to (0, 0, 0) with the center of the circle (0, 0, 10).
  machine.arcYZ(0, 10, 0, 0, 0, false);
   
  // Wait until the planned movement is completed.
  while (machine.isMoving());
}

See also


Libraries Reference Home

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

コメントする

上部へスクロール