1596 lines
57 KiB
C#
1596 lines
57 KiB
C#
using CoreUnit.Common;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace CoreUnit.Scanner.UserControl.ScannerCanvas
|
|
{
|
|
|
|
public class ScannerParam
|
|
{
|
|
#region 1.속도 설정
|
|
double m_markSpeed;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Speed")]
|
|
[DisplayName("Mark Speed(mm/s)")]
|
|
[Description("defines the marking speed for the subsequent vector and arc commands")]
|
|
[XmlSerializable]
|
|
public double MarkSpeed {
|
|
get { return m_markSpeed; }
|
|
set { m_markSpeed = value; }
|
|
}
|
|
|
|
double m_jumpSpeed;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Speed")]
|
|
[DisplayName("Jump Speed(mm/s)")]
|
|
[Description("defines the jump speed for the following vector commands")]
|
|
[XmlSerializable]
|
|
public double JumpSpeed {
|
|
get { return m_jumpSpeed; }
|
|
set { m_jumpSpeed = value; }
|
|
}
|
|
double m_spotShotTime;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Speed")]
|
|
[DisplayName("Spot Shot Time (msec)")]
|
|
[Description("defines the spot shot time for the spot shot")]
|
|
[XmlSerializable]
|
|
public double SpotShotTime {
|
|
get { return m_spotShotTime; }
|
|
set { m_spotShotTime = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region 2.Delay 설정
|
|
int m_laserOnDelay;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Laser Delay")]
|
|
[DisplayName("Laser On Delay(㎲)")]
|
|
[Description("When the scan board turns on the laser, laser on delay defines the moment")]
|
|
[XmlSerializable]
|
|
public int LaserOnDelay {
|
|
get { return m_laserOnDelay; }
|
|
set { m_laserOnDelay = value; }
|
|
}
|
|
|
|
uint m_laserOffDelay;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Laser Delay")]
|
|
[DisplayName("Laser Off Delay(㎲)")]
|
|
[Description("When the scan board turns off the laser, laser off delay defines the moment")]
|
|
[XmlSerializable]
|
|
public uint LaserOffDelay {
|
|
get { return m_laserOffDelay; }
|
|
set { m_laserOffDelay = value; }
|
|
}
|
|
|
|
uint m_jumpDelay;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Scanner Delay")]
|
|
[DisplayName("Jump Delay(㎲)")]
|
|
[Description("To allow for the setting time and for the lag, Jump delay is inserted")]
|
|
[XmlSerializable]
|
|
public uint JumpDelay {
|
|
get { return m_jumpDelay; }
|
|
set { m_jumpDelay = value; }
|
|
}
|
|
|
|
uint m_markDelay;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Scanner Delay")]
|
|
[DisplayName("Mark Delay(㎲)")]
|
|
[Description("To allow for the setting time and for the lag, Mark delay is inserted")]
|
|
[XmlSerializable]
|
|
public uint MarkDelay {
|
|
get { return m_markDelay; }
|
|
set { m_markDelay = value; }
|
|
}
|
|
|
|
uint m_polygonDelay;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Scanner Delay")]
|
|
[DisplayName("Polygon Delay(㎲)")]
|
|
[Description("To allow for the setting time and for the lag, Polygon delay is inserted")]
|
|
[XmlSerializable]
|
|
public uint PolygonDelay {
|
|
get { return m_polygonDelay; }
|
|
set { m_polygonDelay = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region 3.레이저 파워 설정
|
|
uint m_laserPower1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Laser")]
|
|
[DisplayName("Laser Power(%)")]
|
|
[Description("Laser power value(Max:100, Min:0, Unit: %)")]
|
|
[XmlSerializable]
|
|
public uint LaserPower1 {
|
|
get { return m_laserPower1; }
|
|
set { m_laserPower1 = value; }
|
|
}
|
|
uint m_laserPower2;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Laser")]
|
|
[DisplayName("Laser Power(%)")]
|
|
[Description("Laser power value(Max:100, Min:0, Unit: %)")]
|
|
[XmlSerializable]
|
|
public uint LaserPower2 {
|
|
get { return m_laserPower2; }
|
|
set { m_laserPower2 = value; }
|
|
}
|
|
double m_laserFrequency;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Laser")]
|
|
[DisplayName("Laser Frequency(kHz)")]
|
|
[Description("Laser Frequency Value(Max:5, Min:0.2, Unit: kHz)")]
|
|
[XmlSerializable]
|
|
public double LaserFrequency {
|
|
get { return m_laserFrequency; }
|
|
set { m_laserFrequency = value; }
|
|
}
|
|
uint m_laserDuty;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Laser")]
|
|
[DisplayName("Laser Duty(%)")]
|
|
[Description("Laser Duty Value(Max:100, Min:0, Unit: %)")]
|
|
[XmlSerializable]
|
|
public uint LaserDuty {
|
|
get { return m_laserDuty; }
|
|
set { m_laserDuty = value; }
|
|
}
|
|
double m_laserPulseDuration;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Laser")]
|
|
[DisplayName("Laser Pulse Duration(ms)")]
|
|
[Description("Laser Pulse Duration(ms)")]
|
|
[XmlSerializable]
|
|
public double LaserPulseDuration {
|
|
get { return m_laserPulseDuration; }
|
|
set { m_laserPulseDuration = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region 4.Wobbel 설정
|
|
bool m_wobbelEnable;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Wobbel")]
|
|
[DisplayName("Use Wobbel")]
|
|
[Description("Use Wobbel(True : Use, False : NoUse)")]
|
|
[XmlSerializable]
|
|
public bool WobbelEnable {
|
|
get { return m_wobbelEnable; }
|
|
set { m_wobbelEnable = value; }
|
|
}
|
|
double m_wobbelFrequency;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Wobbel")]
|
|
[DisplayName("Wobbel Frequency")]
|
|
[Description("Wobbel Frequency(Max:300, Min:0, Unit: Hz)")]
|
|
[XmlSerializable]
|
|
public double WobbelFrequency {
|
|
get { return m_wobbelFrequency; }
|
|
set { m_wobbelFrequency = value; }
|
|
}
|
|
|
|
double m_wobbelTransversal = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Wobbel")]
|
|
[DisplayName("Transversal(mm)")]
|
|
[Description("진행방향과 수직방향 진폭(Longitudinal과 같을 경우 Circular Wobbel)(Max:10, Min:0.01, Unit: mm)")]
|
|
[XmlSerializable]
|
|
public double WobbelTransversal {
|
|
get { return m_wobbelTransversal; }
|
|
set { m_wobbelTransversal = value; }
|
|
}
|
|
|
|
double m_wobbelLongditudinal = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Wobbel")]
|
|
[DisplayName("Longditudinal(mm)")]
|
|
[Description("진행방향과 수평방향 진폭(0 일 경우 sine 파형)(Max:10, Min:0.01, Unit: mm)")]
|
|
[XmlSerializable]
|
|
public double WobbelLongditudinal {
|
|
get { return m_wobbelLongditudinal; }
|
|
set { m_wobbelLongditudinal = value; }
|
|
}
|
|
|
|
public enum eWobbelShape
|
|
{
|
|
VERTICAL8 = -1, // < 0
|
|
ELLIPSE = 0, // = 0
|
|
HORIZONTAL8 = 1,// = 1
|
|
};
|
|
|
|
eWobbelShape m_wobbelShape = eWobbelShape.ELLIPSE;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("4. Wobbel")]
|
|
[DisplayName("Wobbel Shape")]
|
|
[Description("5. Wobbel Shape(Ellipse, Vertical8, Horizontal8)")]
|
|
[XmlSerializable]
|
|
public eWobbelShape WobbelShape {
|
|
get { return m_wobbelShape; }
|
|
set { m_wobbelShape = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 5.Ramping 설정
|
|
uint m_rampingStartPower1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Ramping")]
|
|
[DisplayName("Start Power(%)")]
|
|
[Description("Start Power(Max:100, Min:0, Unit: %)")]
|
|
[XmlSerializable]
|
|
public uint RampingStartPower1 {
|
|
get { return m_rampingStartPower1; }
|
|
set { m_rampingStartPower1 = value; }
|
|
}
|
|
|
|
uint m_rampingStartPower2;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Ramping")]
|
|
[DisplayName("Start Power(%)")]
|
|
[Description("Start Power(Max:100, Min:0, Unit: %)")]
|
|
[XmlSerializable]
|
|
public uint RampingStartPower2 {
|
|
get { return m_rampingStartPower2; }
|
|
set { m_rampingStartPower2 = value; }
|
|
}
|
|
|
|
//bool m_rampingStartSlopeMode;
|
|
//[Browsable(true)]
|
|
//[ReadOnly(false)]
|
|
//[Category("Ramping")]
|
|
//[DisplayName("Start Slope Mode")]
|
|
//[Description("Start Slope Mode")]
|
|
//[XmlSerializable]
|
|
//public bool RampingStartSlopeMode {
|
|
// get { return m_rampingStartSlopeMode; }
|
|
// set { m_rampingStartSlopeMode = value; }
|
|
//}
|
|
|
|
double m_rampingStartDist;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Ramping")]
|
|
[DisplayName("Start Distance(mm)")]
|
|
[Description("Start Distance(Max:1000, Min:0, Unit: mm)")]
|
|
[XmlSerializable]
|
|
public double RampingStartDist {
|
|
get { return m_rampingStartDist; }
|
|
set { m_rampingStartDist = value; }
|
|
}
|
|
uint m_rampingEndPower1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Ramping")]
|
|
[DisplayName("End Power(%)")]
|
|
[Description("End Power(Max:100, Min:0, Unit: %)")]
|
|
[XmlSerializable]
|
|
public uint RampingEndPower1 {
|
|
get { return m_rampingEndPower1; }
|
|
set { m_rampingEndPower1 = value; }
|
|
}
|
|
|
|
uint m_rampingEndPower2;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Ramping")]
|
|
[DisplayName("End Power(%)")]
|
|
[Description("End Power(Max:100, Min:0, Unit: %)")]
|
|
[XmlSerializable]
|
|
public uint RampingEndPower2 {
|
|
get { return m_rampingEndPower2; }
|
|
set { m_rampingEndPower2 = value; }
|
|
}
|
|
|
|
//bool m_rampingEndSlopeMode;
|
|
//[Browsable(true)]
|
|
//[ReadOnly(false)]
|
|
//[Category("Ramping")]
|
|
//[DisplayName("End Slope Mode")]
|
|
//[Description("End Slope Mode")]
|
|
//[XmlSerializable]
|
|
//public bool RampingEndSlopeMode {
|
|
// get { return m_rampingEndSlopeMode; }
|
|
// set { m_rampingEndSlopeMode = value; }
|
|
//}
|
|
|
|
double m_rampingEndDist;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Ramping")]
|
|
[DisplayName("End Distance(mm)")]
|
|
[Description("End Distance(Max:1000, Min:0, Unit: mm)")]
|
|
[XmlSerializable]
|
|
public double RampingEndDist {
|
|
get { return m_rampingEndDist; }
|
|
set { m_rampingEndDist = value; }
|
|
}
|
|
|
|
double m_RampingInterval;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Ramping")]
|
|
[DisplayName("Ramping Interval(mm)")]
|
|
[Description("Ramping Interval(Default Length(Recommended Length) : 0.1mm)")]
|
|
[XmlSerializable]
|
|
public double RampingInterval {
|
|
get { return m_RampingInterval; }
|
|
set { m_RampingInterval = value; }
|
|
}
|
|
|
|
//bool m_usePowerProfile;
|
|
//[Browsable(true)]
|
|
//[ReadOnly(false)]
|
|
//[Category("Ramping")]
|
|
//[DisplayName("Use Power Profile")]
|
|
//[Description("Use Power Profile")]
|
|
//[XmlSerializable]
|
|
//public bool UsePowerProfile {
|
|
// get { return m_usePowerProfile; }
|
|
// set { m_usePowerProfile = value; }
|
|
//}
|
|
|
|
//int m_powerProfileID;
|
|
//[Browsable(true)]
|
|
//[ReadOnly(false)]
|
|
//[Category("Ramping")]
|
|
//[DisplayName("Power Profile ID")]
|
|
//[Description("Power Profile ID")]
|
|
//[XmlSerializable]
|
|
//public int PowerProfileID {
|
|
// get { return m_powerProfileID; }
|
|
// set { m_powerProfileID = value; }
|
|
//}
|
|
#endregion
|
|
|
|
#region 6. SnowMan 설정
|
|
bool m_snowManEnable;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("SnowMan")]
|
|
[DisplayName("Use SnowMan")]
|
|
[Description("Use SnowMan(True : Use, False : NoUse)")]
|
|
[XmlSerializable]
|
|
public bool SnowManEnable {
|
|
get { return m_snowManEnable; }
|
|
set { m_snowManEnable = value; }
|
|
}
|
|
int m_tiltingAngle = 0;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("01.Angle(degree)")]
|
|
[Description("Tilting Angle of SnowMan by degree")]
|
|
[XmlSerializable]
|
|
public int TiltingAngle {
|
|
get { return m_tiltingAngle; }
|
|
set { m_tiltingAngle = value; }
|
|
}
|
|
double m_horizontalRadiusOfHead = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("02.HorizontalRadiusOfHead(mm)")]
|
|
[Description("Horizontal Radius of Head Ellipse(0.1mm ~ 10mm)")]
|
|
[XmlSerializable]
|
|
public double HorizontalRadiusOfHead {
|
|
get { return m_horizontalRadiusOfHead; }
|
|
set {
|
|
m_horizontalRadiusOfHead = value;
|
|
}
|
|
}
|
|
double m_verticalRadiusOfHead = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("03.VerticalRadiusOfHead(mm)")]
|
|
[Description("Vertical Radius of Head Ellipse(0.1mm ~ 10mm)")]
|
|
[XmlSerializable]
|
|
public double VerticalRadiusOfHead {
|
|
get { return m_verticalRadiusOfHead; }
|
|
set {
|
|
m_verticalRadiusOfHead = value;
|
|
}
|
|
}
|
|
double m_horizontalRadiusOfBody = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("04.HorizontalRadiusOfBody(mm)")]
|
|
[Description("Horizontal Radius of Body Ellipse(0.1mm ~ 10mm)")]
|
|
[XmlSerializable]
|
|
public double HorizontalRadiusOfBody {
|
|
get { return m_horizontalRadiusOfBody; }
|
|
set {
|
|
m_horizontalRadiusOfBody = value;
|
|
}
|
|
}
|
|
double m_verticalRadiusOfBody = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("05.VerticalRadiusOfBody(mm)")]
|
|
[Description("Vertical Radius of Body Ellipse(0.1mm ~ 10mm)")]
|
|
[XmlSerializable]
|
|
public double VerticalRadiusOfBody {
|
|
get { return m_verticalRadiusOfBody; }
|
|
set {
|
|
m_verticalRadiusOfBody = value;
|
|
}
|
|
}
|
|
double m_velocityOfHead = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("06.Head Speed")]
|
|
[Description("Angular Speed Control : deg/s\nLine Speed Control : mm/s")]
|
|
[XmlSerializable]
|
|
public double HeadVelocity {
|
|
get { return m_velocityOfHead; }
|
|
set {
|
|
m_velocityOfHead = value;
|
|
}
|
|
}
|
|
double m_velocityOfBody = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("07.Body Speed")]
|
|
[Description("Angular Speed Control : deg/s\nLine Speed Control : mm/s")]
|
|
[XmlSerializable]
|
|
public double BodyVelocity {
|
|
get { return m_velocityOfBody; }
|
|
set {
|
|
m_velocityOfBody = value;
|
|
}
|
|
}
|
|
|
|
public enum eControlType
|
|
{
|
|
AngularSpeedControl = 1,
|
|
LineSpeedControl = 2
|
|
}
|
|
eControlType m_controlType = eControlType.AngularSpeedControl;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("08.Control Type")]
|
|
[Description("Control Type(Angular or Line)")]
|
|
[XmlSerializable]
|
|
public eControlType ControlType {
|
|
get { return m_controlType; }
|
|
set {
|
|
m_controlType = value;
|
|
}
|
|
}
|
|
public enum eDrawWay
|
|
{
|
|
Left = 1,
|
|
Right = 2
|
|
}
|
|
eDrawWay m_drawWay = eDrawWay.Left;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("09.Draw Way")]
|
|
[Description("Draw Way(Left or Right)")]
|
|
[XmlSerializable]
|
|
public eDrawWay DrawWay {
|
|
get { return m_drawWay; }
|
|
set {
|
|
m_drawWay = value;
|
|
}
|
|
}
|
|
double m_circumferenceHead = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("10.Ch")]
|
|
[Description("Circumference length of Head")]
|
|
[JsonIgnore]
|
|
public double CircumferenceHead {
|
|
get {
|
|
return m_circumferenceHead;
|
|
}
|
|
set {
|
|
m_circumferenceHead = value;
|
|
}
|
|
|
|
}
|
|
double m_circumferenceBody = 1;
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("11.Cb")]
|
|
[Description("Circumference length of Body")]
|
|
[JsonIgnore]
|
|
public double CircumferenceBody {
|
|
get {
|
|
return m_circumferenceBody;
|
|
}
|
|
set {
|
|
m_circumferenceBody = value;
|
|
}
|
|
}
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("13.Cycle Time of Head")]
|
|
[Description("Cycle Time of Head")]
|
|
[JsonIgnore]
|
|
public double HeadCycleTime {
|
|
get {
|
|
if (ControlType == eControlType.AngularSpeedControl) {
|
|
return 360 / HeadVelocity;
|
|
} else {
|
|
return m_circumferenceHead / HeadVelocity;
|
|
}
|
|
|
|
}
|
|
}
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("14.Cycle Time of Body")]
|
|
[Description("Cycle Time of Body")]
|
|
[JsonIgnore]
|
|
public double BodyCycleTime {
|
|
get {
|
|
if (ControlType == eControlType.AngularSpeedControl) {
|
|
return 360 / BodyVelocity;
|
|
} else {
|
|
return m_circumferenceBody / BodyVelocity;
|
|
}
|
|
}
|
|
|
|
}
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("15.Cycle Time of SnowMan")]
|
|
[Description("Cycle Time of SnowMan")]
|
|
[JsonIgnore]
|
|
public double SnowManCycleTime {
|
|
get { return HeadCycleTime + BodyCycleTime; }
|
|
}
|
|
int m_vectorCount = 200;
|
|
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("3. SnowMan")]
|
|
[DisplayName("16.Vector Count")]
|
|
[Description("Head And Body can have Upto 256 Count")]
|
|
[XmlSerializable]
|
|
|
|
public int VectorCount {
|
|
get { return m_vectorCount; }
|
|
set {
|
|
m_vectorCount = value;
|
|
}
|
|
}
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("4. Head Wobbel Vector")]
|
|
[DisplayName("1.Period")]
|
|
[Description("period per Vector")]
|
|
[JsonIgnore]
|
|
public double HeadPeriod {
|
|
get { return (HeadCycleTime / (int)VectorCount) * 100 * 1000; }
|
|
}
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("4. Head Wobbel Vector")]
|
|
[DisplayName("2.Vector Angle")]
|
|
[Description("Vector Angle")]
|
|
[JsonIgnore]
|
|
public double HeadVectorAngle {
|
|
get { return 2 * Math.PI / (int)VectorCount; }
|
|
}
|
|
protected List<PointF> m_headPoint = new List<PointF>();
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("4. Head Wobbel Vector")]
|
|
[DisplayName("3.Head Point")]
|
|
[Description("X : dTrans, Y: dLong")]
|
|
[JsonIgnore]
|
|
public List<PointF> HeadPoint {
|
|
get { return m_headPoint; }
|
|
set { m_headPoint = value; }
|
|
}
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("5. Body Wobbel Vector")]
|
|
[DisplayName("1.Period")]
|
|
[Description("period per Vector")]
|
|
[JsonIgnore]
|
|
public double BodyPeriod {
|
|
get { return (BodyCycleTime / (int)VectorCount) * 100 * 1000; }
|
|
}
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("5. Body Wobbel Vector")]
|
|
[DisplayName("2.Vector Angle")]
|
|
[Description("Vector Angle")]
|
|
[JsonIgnore]
|
|
public double BodyVectorAngle {
|
|
get { return 2 * Math.PI / (int)VectorCount; }
|
|
}
|
|
protected List<PointF> m_bodyPoint = new List<PointF>();
|
|
[Browsable(true)]
|
|
[ReadOnly(true)]
|
|
[Category("5. Body Wobbel Vector")]
|
|
[DisplayName("3.Body Point")]
|
|
[Description("X : dTrans, Y: dLong")]
|
|
[JsonIgnore]
|
|
public List<PointF> BodyPoint {
|
|
get { return m_bodyPoint; }
|
|
set { m_bodyPoint = value; }
|
|
}
|
|
private double CalculateCircumference(double a, double b)
|
|
{
|
|
|
|
//타원의 둘레 길이 구하기
|
|
//타원의 적분은 일반적으로 할 수 없고, 근사값으로 구함
|
|
int iterationCount = 100000;
|
|
double dx = a / iterationCount;
|
|
double sum = 0;
|
|
for (int i = 0; i < iterationCount - 1; i++) {
|
|
double x = (i + 1) * dx;
|
|
sum += dx * Math.Sqrt(1 + Math.Pow(b / a, 2) * Math.Pow(x, 2) / (Math.Pow(a, 2) - Math.Pow(x, 2)));
|
|
}
|
|
|
|
return 4 * sum;
|
|
}
|
|
//수치해석용 변수
|
|
double xLower = 0;
|
|
double xUpper = 0;
|
|
private void CreateWobbelVectorForSnowmanPointList()
|
|
{
|
|
m_headPoint.Clear();
|
|
m_bodyPoint.Clear();
|
|
|
|
double xPoint = 0;
|
|
double yPoint = 0;
|
|
|
|
double radius = 0;
|
|
|
|
CircumferenceHead = CalculateCircumference(m_horizontalRadiusOfHead, m_verticalRadiusOfHead);
|
|
CircumferenceBody = CalculateCircumference(m_horizontalRadiusOfHead, m_verticalRadiusOfHead);
|
|
|
|
|
|
double circumferenceHead = CircumferenceHead;
|
|
double circumferenceBody = CircumferenceBody;
|
|
|
|
//각속도 제어
|
|
if (ControlType == eControlType.AngularSpeedControl) {
|
|
m_headPoint.Add(new PointF(0, 0));
|
|
m_bodyPoint.Add(new PointF(0, 0));
|
|
|
|
//Head Wobbel vector 설정
|
|
for (int i = 0; i < (int)VectorCount; i++) {
|
|
double term1 = (Math.Pow(Math.Cos((i + 1) * HeadVectorAngle), 2)) / (Math.Pow(HorizontalRadiusOfHead, 2));
|
|
double term2 = (Math.Pow(Math.Sin((i + 1) * HeadVectorAngle), 2)) / (Math.Pow(VerticalRadiusOfHead, 2));
|
|
|
|
radius = Math.Sqrt(1 / (term1 + term2));
|
|
|
|
|
|
if (DrawWay == eDrawWay.Left) {
|
|
xPoint = radius * Math.Cos((i + 1) * HeadVectorAngle) - HorizontalRadiusOfHead;
|
|
yPoint = radius * Math.Sin((i + 1) * HeadVectorAngle);
|
|
} else {
|
|
xPoint = radius * Math.Cos(Math.PI - (i + 1) * HeadVectorAngle) + HorizontalRadiusOfHead;
|
|
yPoint = radius * Math.Sin(Math.PI - (i + 1) * HeadVectorAngle);
|
|
}
|
|
|
|
|
|
m_headPoint.Add(new PointF((float)xPoint, (float)yPoint));
|
|
|
|
}
|
|
|
|
//body Wobbel vector 설정
|
|
for (int i = 0; i < (int)VectorCount; i++) {
|
|
double term1 = (Math.Pow(Math.Cos((i + 1) * BodyVectorAngle), 2)) / (Math.Pow(HorizontalRadiusOfBody, 2));
|
|
double term2 = (Math.Pow(Math.Sin((i + 1) * BodyVectorAngle), 2)) / (Math.Pow(VerticalRadiusOfBody, 2));
|
|
|
|
radius = Math.Sqrt(1 / (term1 + term2));
|
|
|
|
if (DrawWay == eDrawWay.Left) {
|
|
xPoint = radius * Math.Cos(Math.PI - (i + 1) * BodyVectorAngle) + HorizontalRadiusOfBody;
|
|
yPoint = radius * Math.Sin(Math.PI - (i + 1) * BodyVectorAngle);
|
|
} else {
|
|
xPoint = radius * Math.Cos((i + 1) * BodyVectorAngle) - HorizontalRadiusOfBody;
|
|
yPoint = radius * Math.Sin((i + 1) * BodyVectorAngle);
|
|
|
|
}
|
|
|
|
|
|
m_bodyPoint.Add(new PointF((float)xPoint, (float)yPoint));
|
|
}
|
|
} else {
|
|
if (DrawWay == eDrawWay.Left) {
|
|
//Head
|
|
m_headPoint.Add(new PointF(0, 0));
|
|
|
|
xLower = -2 * HorizontalRadiusOfHead;
|
|
xUpper = 0;
|
|
|
|
int quadrant = 2;
|
|
|
|
for (int i = 0; i < (int)VectorCount / 2 - 1; i++) {
|
|
|
|
double x2, y2;
|
|
x2 = FindX2(m_headPoint[i].X, m_headPoint[i].Y, HorizontalRadiusOfHead, VerticalRadiusOfHead, circumferenceHead / (int)VectorCount, quadrant);
|
|
|
|
y2 = FindY2(x2, quadrant, HorizontalRadiusOfHead, VerticalRadiusOfHead);
|
|
m_headPoint.Add(new PointF((float)x2, (float)y2));
|
|
|
|
}
|
|
|
|
|
|
m_headPoint.Add(new PointF((float)(-2 * HorizontalRadiusOfHead), 0));
|
|
|
|
xLower = -2 * HorizontalRadiusOfHead;
|
|
xUpper = 0;
|
|
|
|
quadrant = 3;
|
|
|
|
for (int i = (int)VectorCount / 2; i < (int)VectorCount; i++) {
|
|
double x2, y2;
|
|
x2 = FindX2(m_headPoint[i].X, m_headPoint[i].Y, HorizontalRadiusOfHead, VerticalRadiusOfHead, circumferenceHead / (int)VectorCount, quadrant);
|
|
y2 = FindY2(x2, quadrant, HorizontalRadiusOfHead, VerticalRadiusOfHead);
|
|
m_headPoint.Add(new PointF((float)x2, (float)y2));
|
|
}
|
|
|
|
|
|
|
|
// Body
|
|
m_bodyPoint.Add(new PointF(0, 0));
|
|
|
|
xLower = 0;
|
|
xUpper = 2 * HorizontalRadiusOfBody;
|
|
|
|
quadrant = 1;
|
|
|
|
for (int i = 0; i < (int)VectorCount / 2 - 1; i++) {
|
|
double x2, y2;
|
|
x2 = FindX2(m_bodyPoint[i].X, m_bodyPoint[i].Y, HorizontalRadiusOfBody, VerticalRadiusOfBody, circumferenceBody / (int)VectorCount, quadrant);
|
|
y2 = FindY2(x2, quadrant, HorizontalRadiusOfBody, VerticalRadiusOfBody);
|
|
m_bodyPoint.Add(new PointF((float)x2, (float)y2));
|
|
}
|
|
|
|
m_bodyPoint.Add(new PointF((float)(2 * HorizontalRadiusOfBody), 0));
|
|
|
|
xLower = 0;
|
|
xUpper = 2 * HorizontalRadiusOfBody;
|
|
|
|
quadrant = 4;
|
|
|
|
for (int i = (int)VectorCount / 2; i < (int)VectorCount; i++) {
|
|
double x2, y2;
|
|
x2 = FindX2(m_bodyPoint[i].X, m_bodyPoint[i].Y, HorizontalRadiusOfBody, VerticalRadiusOfBody, circumferenceBody / (int)VectorCount, quadrant);
|
|
y2 = FindY2(x2, quadrant, HorizontalRadiusOfBody, VerticalRadiusOfBody);
|
|
m_bodyPoint.Add(new PointF((float)x2, (float)y2));
|
|
}
|
|
} else {
|
|
//Head
|
|
m_headPoint.Add(new PointF(0, 0));
|
|
|
|
xLower = 0;
|
|
xUpper = 2 * HorizontalRadiusOfHead;
|
|
|
|
int quadrant = 1;
|
|
|
|
for (int i = 0; i < (int)VectorCount / 2 - 1; i++) {
|
|
double x2, y2;
|
|
x2 = FindX2(m_headPoint[i].X, m_headPoint[i].Y, HorizontalRadiusOfHead, VerticalRadiusOfHead, circumferenceHead / (int)VectorCount, quadrant);
|
|
y2 = FindY2(x2, quadrant, HorizontalRadiusOfHead, VerticalRadiusOfHead);
|
|
m_headPoint.Add(new PointF((float)x2, (float)y2));
|
|
|
|
}
|
|
|
|
m_headPoint.Add(new PointF((float)(2 * HorizontalRadiusOfHead), 0));
|
|
|
|
xLower = 0;
|
|
xUpper = 2 * HorizontalRadiusOfHead;
|
|
|
|
quadrant = 4;
|
|
|
|
for (int i = (int)VectorCount / 2; i < (int)VectorCount; i++) {
|
|
double x2, y2;
|
|
x2 = FindX2(m_headPoint[i].X, m_headPoint[i].Y, HorizontalRadiusOfHead, VerticalRadiusOfHead, circumferenceHead / (int)VectorCount, quadrant);
|
|
y2 = FindY2(x2, quadrant, HorizontalRadiusOfHead, VerticalRadiusOfHead);
|
|
m_headPoint.Add(new PointF((float)x2, (float)y2));
|
|
}
|
|
|
|
// Body
|
|
m_bodyPoint.Add(new PointF(0, 0));
|
|
|
|
xLower = -2 * HorizontalRadiusOfBody;
|
|
xUpper = 0;
|
|
|
|
quadrant = 2;
|
|
|
|
for (int i = 0; i < (int)VectorCount / 2 - 1; i++) {
|
|
double x2, y2;
|
|
x2 = FindX2(m_bodyPoint[i].X, m_bodyPoint[i].Y, HorizontalRadiusOfBody, VerticalRadiusOfBody, circumferenceBody / (int)VectorCount, quadrant);
|
|
y2 = FindY2(x2, quadrant, HorizontalRadiusOfBody, VerticalRadiusOfBody);
|
|
m_bodyPoint.Add(new PointF((float)x2, (float)y2));
|
|
}
|
|
|
|
m_bodyPoint.Add(new PointF((float)(-2 * HorizontalRadiusOfBody), 0));
|
|
|
|
xLower = -2 * HorizontalRadiusOfBody;
|
|
xUpper = 0;
|
|
|
|
quadrant = 3;
|
|
|
|
for (int i = (int)VectorCount / 2; i < (int)VectorCount; i++) {
|
|
double x2, y2;
|
|
x2 = FindX2(m_bodyPoint[i].X, m_bodyPoint[i].Y, HorizontalRadiusOfBody, VerticalRadiusOfBody, circumferenceBody / (int)VectorCount, quadrant);
|
|
y2 = FindY2(x2, quadrant, HorizontalRadiusOfBody, VerticalRadiusOfBody);
|
|
m_bodyPoint.Add(new PointF((float)x2, (float)y2));
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
private double FindX2(double x1, double y1, double A, double B, double L, int quadrant)
|
|
{
|
|
|
|
int i = 1;
|
|
double xReal = xLower;//첫시작
|
|
double xRold;
|
|
double error = 0;
|
|
|
|
while (true) {
|
|
double test = Function2(x1, y1, xLower, L, quadrant, A, B) * Function2(x1, y1, xUpper, L, quadrant, A, B);
|
|
if (test > 0) {
|
|
break;
|
|
} else {
|
|
xRold = xReal;
|
|
|
|
xReal = (xLower + xUpper) / 2; //이분법에서 해는 구간 양끝의 중점
|
|
error = (xReal - xRold) / xReal; //근사오차
|
|
|
|
double test2 = Function2(x1, y1, xReal, L, quadrant, A, B) * Function2(x1, y1, xLower, L, quadrant, A, B);
|
|
|
|
if (test2 < 0) {
|
|
xUpper = xReal;
|
|
} else {
|
|
xLower = xReal;
|
|
}
|
|
|
|
string Check = string.Format("xLower = {0:f3}, xUpper = {1:f3}, xReal = {2:f3}, error = {3:f3}", xLower, xUpper, xReal, error);
|
|
|
|
i = i + 1;
|
|
}
|
|
|
|
if ((i > 1000) || Math.Abs(error) < 0.00001)//iteration 최대치에 도달하거나 Error 가 허용오차보다 작은 경우 루프 탈출
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
switch (quadrant) {
|
|
case 1:
|
|
xUpper = 2 * A;
|
|
xLower = xReal;
|
|
break;
|
|
case 2:
|
|
xUpper = xReal;
|
|
xLower = -2 * A;
|
|
break;
|
|
case 3:
|
|
xUpper = 0;
|
|
xLower = xReal;
|
|
break;
|
|
case 4:
|
|
xUpper = xReal;
|
|
xLower = 0;
|
|
break;
|
|
}
|
|
|
|
return xReal;
|
|
|
|
}
|
|
|
|
private double Function2(double x1, double y1, double x2, double length, int quadrant, double a, double b)
|
|
{
|
|
double y2 = 0;
|
|
double f = 0;
|
|
|
|
//사분면 정의
|
|
// |
|
|
// 2 | 1
|
|
// |
|
|
//---------------
|
|
// |
|
|
// 3 | 4
|
|
// |
|
|
|
|
switch (quadrant) {
|
|
case 1:
|
|
y2 = b * Math.Sqrt(1 - Math.Pow((x2 - a) / a, 2));
|
|
break;
|
|
case 2:
|
|
y2 = b * Math.Sqrt(1 - Math.Pow((x2 + a) / a, 2));
|
|
break;
|
|
case 3:
|
|
y2 = -b * Math.Sqrt(1 - Math.Pow((x2 + a) / a, 2));
|
|
break;
|
|
case 4:
|
|
y2 = -b * Math.Sqrt(1 - Math.Pow((x2 - a) / a, 2));
|
|
break;
|
|
|
|
}
|
|
|
|
f = Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2)) - length;
|
|
return f;
|
|
}
|
|
|
|
|
|
private double FindY2(double x2, int quadrant, double a, double b)
|
|
{
|
|
double y2 = 0;
|
|
|
|
switch (quadrant) {
|
|
case 1:
|
|
y2 = b * Math.Sqrt(1 - Math.Pow((x2 - a) / a, 2));
|
|
break;
|
|
case 2:
|
|
y2 = b * Math.Sqrt(1 - Math.Pow((x2 + a) / a, 2));
|
|
break;
|
|
case 3:
|
|
y2 = -b * Math.Sqrt(1 - Math.Pow((x2 + a) / a, 2));
|
|
break;
|
|
case 4:
|
|
y2 = -b * Math.Sqrt(1 - Math.Pow((x2 - a) / a, 2));
|
|
break;
|
|
|
|
}
|
|
return y2;
|
|
}
|
|
public void LoadWobbelVectorForHead(out List<double> dTrans, out List<double> dLong, int KFactor)
|
|
{
|
|
CreateWobbelVectorForSnowmanPointList();
|
|
dTrans = new List<double>();
|
|
dLong = new List<double>();
|
|
|
|
for (int i = 0; i < m_headPoint.Count - 1; i++) {
|
|
dTrans.Add((m_headPoint[i + 1].X - m_headPoint[i].X) * KFactor / HeadPeriod);//dTrans = dx *kFactor /period
|
|
dLong.Add((m_headPoint[i + 1].Y - m_headPoint[i].Y) * KFactor / HeadPeriod);//dTrans = dx *kFactor /period
|
|
}
|
|
}
|
|
public void LoadWobbelVectorForBody(out List<double> dTrans, out List<double> dLong, int KFactor)
|
|
{
|
|
CreateWobbelVectorForSnowmanPointList();
|
|
dTrans = new List<double>();
|
|
dLong = new List<double>();
|
|
|
|
for (int i = 0; i < m_bodyPoint.Count - 1; i++) {
|
|
dTrans.Add((m_bodyPoint[i + 1].X - m_bodyPoint[i].X) * KFactor / BodyPeriod);//dTrans = dx *kFactor /period
|
|
dLong.Add((m_bodyPoint[i + 1].Y - m_bodyPoint[i].Y) * KFactor / BodyPeriod);//dTrans = dx *kFactor /period
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 7. Zigzag Wobbel 설정
|
|
bool m_zigzagWobbelEnable = false;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Zigzag")]
|
|
[DisplayName("Use Zigzag")]
|
|
[Description("Use Zigzag(True : Use, False : NoUse)")]
|
|
[XmlSerializable]
|
|
public bool ZigzagWobbelEnable {
|
|
get { return m_zigzagWobbelEnable; }
|
|
set { m_zigzagWobbelEnable = value; }
|
|
}
|
|
double m_zigzagWobbelAmplitude = 0.8;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Zigzag")]
|
|
[DisplayName("Zigzag Wobbel Amplitude")]
|
|
[Description("Zigzag Wobbel Amplitude")]
|
|
[XmlSerializable]
|
|
public double ZigzagWobbelAmplitude {
|
|
get { return m_zigzagWobbelAmplitude; }
|
|
set { m_zigzagWobbelAmplitude = value; }
|
|
}
|
|
double m_zigzagWobbelPitch = 0.8;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Zigzag")]
|
|
[DisplayName("Zigzag Wobbel Pitch")]
|
|
[Description("Zigzag Wobbel Pitch")]
|
|
[XmlSerializable]
|
|
public double ZigzagWobbelPitch {
|
|
get { return m_zigzagWobbelPitch; }
|
|
set { m_zigzagWobbelPitch = value; }
|
|
}
|
|
|
|
double m_zigzagWobbelRadius = 0.1;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Zigzag")]
|
|
[DisplayName("Zigzag Wobbel Radius")]
|
|
[Description("Zigzag Wobbel Radius")]
|
|
[XmlSerializable]
|
|
public double ZigzagWobbelRadius {
|
|
get { return m_zigzagWobbelRadius; }
|
|
set { m_zigzagWobbelRadius = value; }
|
|
}
|
|
|
|
double m_zigzagWobbelLinearVelocity = 500;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Zigzag")]
|
|
[DisplayName("Zigzag Wobbel Linear Velocity")]
|
|
[Description("Zigzag Wobbel Linear Velocity")]
|
|
[XmlSerializable]
|
|
public double ZigzagWobbelLinearVelocity {
|
|
get { return m_zigzagWobbelLinearVelocity; }
|
|
set { m_zigzagWobbelLinearVelocity = value; }
|
|
}
|
|
PointF m_zigzagRegion1Start = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion1Start {
|
|
get { return m_zigzagRegion1Start; }
|
|
set { m_zigzagRegion1Start = value; }
|
|
}
|
|
PointF m_zigzagRegion1End = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion1End {
|
|
get { return m_zigzagRegion1End; }
|
|
set { m_zigzagRegion1End = value; }
|
|
}
|
|
|
|
PointF m_zigzagRegion2Start = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion2Start {
|
|
get { return m_zigzagRegion2Start; }
|
|
set { m_zigzagRegion2Start = value; }
|
|
}
|
|
PointF m_zigzagRegion2End = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion2End {
|
|
get { return m_zigzagRegion2End; }
|
|
set { m_zigzagRegion2End = value; }
|
|
}
|
|
|
|
PointF m_zigzagRegion3Start = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion3Start {
|
|
get { return m_zigzagRegion3Start; }
|
|
set { m_zigzagRegion3Start = value; }
|
|
}
|
|
PointF m_zigzagRegion3End = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion3End {
|
|
get { return m_zigzagRegion3End; }
|
|
set { m_zigzagRegion3End = value; }
|
|
}
|
|
|
|
PointF m_zigzagRegion4Start = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion4Start {
|
|
get { return m_zigzagRegion4Start; }
|
|
set { m_zigzagRegion4Start = value; }
|
|
}
|
|
PointF m_zigzagRegion4End = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion4End {
|
|
get { return m_zigzagRegion4End; }
|
|
set { m_zigzagRegion4End = value; }
|
|
}
|
|
|
|
PointF m_zigzagRegion5Start = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion5Start {
|
|
get { return m_zigzagRegion5Start; }
|
|
set { m_zigzagRegion5Start = value; }
|
|
}
|
|
PointF m_zigzagRegion5End = new PointF(0, 0);
|
|
[JsonIgnore]
|
|
public PointF ZigzagRegion5End {
|
|
get { return m_zigzagRegion5End; }
|
|
set { m_zigzagRegion5End = value; }
|
|
}
|
|
|
|
protected List<PointF> m_zigzagRealPoint = new List<PointF>();
|
|
protected List<double> m_zigzagTotalX = new List<double>();
|
|
public List<uint> m_zigzagPeriod = new List<uint>();
|
|
|
|
public double region1Length = 0;
|
|
public double region2Length = 0;
|
|
public double region3Length = 0;
|
|
public double region4Length = 0;
|
|
public double region5Length = 0;
|
|
|
|
public uint region1Period = 0;
|
|
public uint region2Period = 0;
|
|
public uint region3Period = 0;
|
|
public uint region4Period = 0;
|
|
public uint region5Period = 0;
|
|
|
|
public double zigzagCycleLength = 0;
|
|
public double zigzagCycleTime = 0;
|
|
public double zigzagTotalSpeed = 0;
|
|
public int zigzagUnitPeriod = 0;
|
|
public int zigzagVectorCount = 0;
|
|
|
|
|
|
public void CreateWobbelVectorForZigzagPointList()
|
|
{
|
|
m_zigzagRealPoint.Clear();
|
|
m_zigzagTotalX.Clear();
|
|
m_zigzagPeriod.Clear();
|
|
|
|
|
|
#region 구간#1 시작점, 끝점, 길이
|
|
double vertexAngle = Math.Atan(m_zigzagWobbelPitch / m_zigzagWobbelAmplitude / 2);
|
|
double region1StartX = 0;
|
|
double region1StartY = 0;
|
|
double region1EndX = m_zigzagWobbelPitch / 4 - m_zigzagWobbelRadius * Math.Cos(vertexAngle);
|
|
double region1EndY = m_zigzagWobbelAmplitude / 2 - m_zigzagWobbelRadius / Math.Sin(vertexAngle) + m_zigzagWobbelRadius * Math.Sin(vertexAngle);
|
|
//구간 #1 시작점
|
|
m_zigzagRegion1Start = new PointF((float)region1StartX, (float)region1StartY);
|
|
m_zigzagRegion1End = new PointF((float)region1EndX, (float)region1EndY);
|
|
region1Length = Math.Sqrt((region1StartX - region1EndX) * (region1StartX - region1EndX) + (region1StartY - region1EndY) * (region1StartY - region1EndY));
|
|
|
|
region1Period = (uint)(region1Length / m_zigzagWobbelLinearVelocity * 1000 * 1000 / 10);
|
|
|
|
|
|
#endregion
|
|
|
|
#region 구간#2 시작점, 끝점, 길이, 중심점
|
|
|
|
double region2StartX = region1EndX;
|
|
double region2StartY = region1EndY;
|
|
double region2EndX = region2StartX + 2 * m_zigzagWobbelRadius * Math.Cos(vertexAngle);
|
|
double region2EndY = region2StartY;
|
|
double region2CenterX = m_zigzagWobbelPitch / 4;
|
|
double region2CenterY = m_zigzagWobbelAmplitude / 2 - m_zigzagWobbelRadius / Math.Sin(vertexAngle);
|
|
|
|
m_zigzagRegion2Start = new PointF((float)region2StartX, (float)region2StartY);
|
|
m_zigzagRegion2End = new PointF((float)region2EndX, (float)region2EndY);
|
|
region2Length = m_zigzagWobbelRadius * (Math.PI - vertexAngle * 2);
|
|
|
|
region2Period = (uint)(region2Length / m_zigzagWobbelLinearVelocity * 1000 * 1000 / 10);
|
|
uint unitPeriod = (uint)Math.Ceiling(region2Period / 100f);
|
|
double theta = unitPeriod * m_zigzagWobbelLinearVelocity * 10 / 1000 / 1000 / m_zigzagWobbelRadius;
|
|
|
|
#endregion
|
|
|
|
#region 구간#3 시작점, 끝점, 길이
|
|
double region3StartX = region2EndX;
|
|
double region3StartY = region2EndY;
|
|
double region3EndX = region3StartX + m_zigzagWobbelPitch / 2 - m_zigzagWobbelRadius * Math.Cos(vertexAngle) * 2;
|
|
double region3EndY = (-1) * m_zigzagWobbelAmplitude / 2 + m_zigzagWobbelRadius / Math.Sin(vertexAngle) - m_zigzagWobbelRadius * Math.Sin(vertexAngle);
|
|
|
|
m_zigzagRegion3Start = new PointF((float)region3StartX, (float)region3StartY);
|
|
m_zigzagRegion3End = new PointF((float)region3EndX, (float)region3EndY);
|
|
region3Length = Math.Sqrt((region3StartX - region3EndX) * (region3StartX - region3EndX) + (region3StartY - region3EndY) * (region3StartY - region3EndY));
|
|
region3Period = (uint)(region3Length / m_zigzagWobbelLinearVelocity * 1000 * 1000 / 10);
|
|
|
|
#endregion
|
|
|
|
#region 구간#4 시작점, 끝점, 길이, 중심점
|
|
double region4StartX = region3EndX;
|
|
double region4StartY = region3EndY;
|
|
double region4EndX = region4StartX + 2 * m_zigzagWobbelRadius * Math.Cos(vertexAngle);
|
|
double region4EndY = region4StartY;
|
|
double region4CenterX = region2CenterX * 3;
|
|
double region4CenterY = region2CenterY * (-1);
|
|
|
|
|
|
m_zigzagRegion4Start = new PointF((float)region4StartX, (float)region4StartY);
|
|
m_zigzagRegion4End = new PointF((float)region4EndX, (float)region4EndY);
|
|
region4Length = m_zigzagWobbelRadius * (Math.PI - vertexAngle * 2);
|
|
region4Period = (uint)(region4Length / m_zigzagWobbelLinearVelocity * 1000 * 1000 / 10);
|
|
|
|
int region4UnitPeriod = (int)Math.Ceiling(region4Period / 100f);
|
|
#endregion
|
|
|
|
#region 구간#5 시작점, 끝점, 길이
|
|
|
|
double region5StartX = region4EndX;
|
|
double region5StartY = region4EndY;
|
|
double region5EndX = region5StartX + m_zigzagWobbelPitch / 4 - m_zigzagWobbelRadius * Math.Cos(vertexAngle);
|
|
double region5EndY = 0;
|
|
|
|
m_zigzagRegion5Start = new PointF((float)region5StartX, (float)region5StartY);
|
|
m_zigzagRegion5End = new PointF((float)region5EndX, (float)region5EndY);
|
|
region5Length = Math.Sqrt((region5StartX - region5EndX) * (region5StartX - region5EndX) + (region5StartY - region5EndY) * (region5StartY - region5EndY));
|
|
region5Period = (uint)(region5Length / m_zigzagWobbelLinearVelocity * 1000 * 1000 / 10);
|
|
|
|
|
|
#endregion
|
|
|
|
#region 보상된 지그재그 전체 이동 속도 구하기
|
|
uint totalCycle = region1Period + region2Period + region3Period + region4Period + region5Period;
|
|
double movingVelocity = m_zigzagWobbelPitch / totalCycle * 1000 * 1000 / 10;
|
|
double totalLength = region1Length + region2Length + region3Length + region4Length + region5Length;
|
|
zigzagTotalSpeed = movingVelocity;
|
|
#endregion
|
|
|
|
|
|
m_zigzagRealPoint.Add(new PointF(0, 0));
|
|
m_zigzagPeriod.Add(0);
|
|
m_zigzagTotalX.Add(0);
|
|
|
|
double posX = 0;
|
|
double posY = 0;
|
|
double lastX = 0;
|
|
double lastY = 0;
|
|
double totalPeriod = 0;
|
|
|
|
#region 구간 #1 Point
|
|
|
|
posX = region1EndX;
|
|
posY = region1EndY;
|
|
|
|
m_zigzagRealPoint.Add(new PointF((float)posX, (float)posY));
|
|
lastX = posX;
|
|
lastY = posY;
|
|
|
|
m_zigzagPeriod.Add(region1Period);
|
|
totalPeriod += region1Period;
|
|
|
|
m_zigzagTotalX.Add(movingVelocity * totalPeriod / 1000 / 1000 * 10);
|
|
|
|
#endregion
|
|
#region 구간 #2 Point
|
|
int vectorCount = (int)(region2Period / unitPeriod);
|
|
|
|
for (int i = 0; i < vectorCount; i++) {
|
|
posY = (lastX - region2CenterX) * Math.Sin(theta * (-1)) + (lastY - region2CenterY) * Math.Cos(theta * (-1)) + region2CenterY;
|
|
posX = (lastX - region2CenterX) * Math.Cos(theta * (-1)) - (lastY - region2CenterY) * Math.Sin(theta * (-1)) + region2CenterX;
|
|
|
|
|
|
m_zigzagPeriod.Add(unitPeriod);
|
|
|
|
totalPeriod += unitPeriod;
|
|
m_zigzagTotalX.Add(totalPeriod * movingVelocity / 1000 / 1000 * 10);
|
|
|
|
m_zigzagRealPoint.Add(new PointF((float)posX, (float)posY));
|
|
lastX = posX;
|
|
lastY = posY;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 구간 #3 Point
|
|
|
|
posX = region3EndX;
|
|
posY = region3EndY;
|
|
|
|
m_zigzagRealPoint.Add(new PointF((float)posX, (float)posY));
|
|
|
|
lastX = posX;
|
|
lastY = posY;
|
|
|
|
m_zigzagPeriod.Add(region3Period);
|
|
totalPeriod += region3Period;
|
|
|
|
m_zigzagTotalX.Add(totalPeriod * movingVelocity / 1000 / 1000 * 10);
|
|
|
|
#endregion
|
|
|
|
#region 구간 #4 Point
|
|
for (int i = 0; i < vectorCount; i++) {
|
|
posY = (lastX - region4CenterX) * Math.Sin(theta) + (lastY - region4CenterY) * Math.Cos(theta) + region4CenterY;
|
|
posX = (lastX - region4CenterX) * Math.Cos(theta) - (lastY - region4CenterY) * Math.Sin(theta) + region4CenterX;
|
|
|
|
|
|
m_zigzagPeriod.Add(unitPeriod);
|
|
|
|
totalPeriod += unitPeriod;
|
|
m_zigzagTotalX.Add(totalPeriod * movingVelocity / 1000 / 1000 * 10);
|
|
|
|
m_zigzagRealPoint.Add(new PointF((float)posX, (float)posY));
|
|
lastX = posX;
|
|
lastY = posY;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 구간 #5 Point
|
|
|
|
posX = region5EndX;
|
|
posY = region5EndY;
|
|
|
|
m_zigzagRealPoint.Add(new PointF((float)posX, (float)posY));
|
|
|
|
lastX = posX;
|
|
lastY = posY;
|
|
|
|
m_zigzagPeriod.Add(region5Period);
|
|
totalPeriod += region5Period;
|
|
|
|
m_zigzagTotalX.Add(totalPeriod * movingVelocity / 1000 / 1000 * 10);
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
public bool CalculateLineSpeed(double amplitude, double pitch, double radius, double linearVelocity, out double lineSpeed)
|
|
{
|
|
lineSpeed = 100;
|
|
try {
|
|
#region 구간#1 시작점, 끝점, 길이
|
|
double vertexAngle = Math.Atan(pitch / amplitude / 2);
|
|
double region1StartX = 0;
|
|
double region1StartY = 0;
|
|
double region1EndX = pitch / 4 - radius * Math.Cos(vertexAngle);
|
|
double region1EndY = amplitude / 2 - radius / Math.Sin(vertexAngle) + radius * Math.Sin(vertexAngle);
|
|
//구간 #1 시작점
|
|
region1Length = Math.Sqrt((region1StartX - region1EndX) * (region1StartX - region1EndX) + (region1StartY - region1EndY) * (region1StartY - region1EndY));
|
|
region1Period = (uint)(region1Length / linearVelocity * 1000 * 1000 / 10);
|
|
#endregion
|
|
|
|
#region 구간#2 시작점, 끝점, 길이, 중심점
|
|
|
|
double region2StartX = region1EndX;
|
|
double region2StartY = region1EndY;
|
|
double region2EndX = region2StartX + 2 * radius * Math.Cos(vertexAngle);
|
|
double region2EndY = region2StartY;
|
|
double region2CenterX = pitch / 4;
|
|
double region2CenterY = amplitude / 2 - radius / Math.Sin(vertexAngle);
|
|
|
|
region2Length = radius * (Math.PI - vertexAngle * 2);
|
|
|
|
region2Period = (uint)(region2Length / linearVelocity * 1000 * 1000 / 10);
|
|
uint unitPeriod = (uint)Math.Ceiling(region2Period / 100f);
|
|
double theta = unitPeriod * linearVelocity * 10 / 1000 / 1000 / radius;
|
|
|
|
#endregion;
|
|
|
|
#region 보상된 지그재그 전체 이동 속도 구하기
|
|
uint totalCycle = region1Period * 4 + region2Period * 2;
|
|
lineSpeed = pitch / totalCycle * 1000 * 1000 / 10;
|
|
|
|
#endregion
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
public void LoadZigZagWobbelVector(out List<double> dTrans, out List<double> dLong, int KFactor)
|
|
{
|
|
CreateWobbelVectorForZigzagPointList();
|
|
|
|
dTrans = new List<double>();
|
|
|
|
dLong = new List<double>();
|
|
|
|
for (int i = 0; i < m_zigzagRealPoint.Count - 1; i++) {
|
|
double deltaX = (m_zigzagRealPoint[i + 1].X - m_zigzagTotalX[i + 1]) - (m_zigzagRealPoint[i].X - m_zigzagTotalX[i]);
|
|
|
|
dLong.Add(deltaX * KFactor / m_zigzagPeriod[i + 1]);//dTrans = dx *kFactor /period
|
|
dTrans.Add((m_zigzagRealPoint[i + 1].Y - m_zigzagRealPoint[i].Y) * KFactor / m_zigzagPeriod[i + 1]);//dTrans = dx *kFactor /period
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 6.기타
|
|
string m_description;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Object")]
|
|
[DisplayName("Description")]
|
|
[Description("Descrption for marking drawing object")]
|
|
[XmlSerializable]
|
|
public string Description {
|
|
get { return m_description; }
|
|
set { m_description = value; }
|
|
}
|
|
|
|
int m_no;
|
|
[Browsable(false)]
|
|
[JsonIgnore]
|
|
public int No {
|
|
get { return m_no; }
|
|
set { m_no = value; }
|
|
}
|
|
|
|
|
|
Color m_color;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Object")]
|
|
[DisplayName("Color")]
|
|
[Description("Color for marking drawing object")]
|
|
[XmlSerializable]
|
|
[JsonIgnore]
|
|
public Color Color {
|
|
get {
|
|
//if (No < Enum.GetNames(typeof(WeldingParameterIDEditor.eWeldingColor)).Length)
|
|
//{
|
|
// string name = ((WeldingParameterIDEditor.eWeldingColor)(No) + 1).ToString();
|
|
// return Color.FromName(name);
|
|
//}
|
|
//else
|
|
//{
|
|
// return Color.Black;
|
|
//}
|
|
|
|
//return WeldingParameterIDEditor.weldingColorList[No];
|
|
return m_color;
|
|
}
|
|
set { m_color = value; }
|
|
}
|
|
|
|
uint m_numberOfCount;
|
|
[Browsable(true)]
|
|
[ReadOnly(false)]
|
|
[Category("Welding")]
|
|
[DisplayName("Number Of Count")]
|
|
[Description("Number Of Count")]
|
|
[XmlSerializable]
|
|
public uint NumberOfCount {
|
|
get { return m_numberOfCount; }
|
|
set { m_numberOfCount = value; }
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
public ScannerParam()//각 변수에 대한 초기값 설정
|
|
{
|
|
//라인
|
|
m_markSpeed = 100;
|
|
m_jumpSpeed = 1000;
|
|
m_laserOnDelay = 0;
|
|
m_laserOffDelay = 0;
|
|
m_jumpDelay = 100;
|
|
m_markDelay = 100;
|
|
m_polygonDelay = 100;
|
|
m_laserPower1 = 0;
|
|
m_laserPower2 = 0;
|
|
m_laserFrequency = 100;
|
|
m_laserDuty = 100;
|
|
m_laserPulseDuration = 1;
|
|
|
|
//기타
|
|
m_description = "NO DEFINE";
|
|
m_color = Color.White;
|
|
m_numberOfCount = 1;
|
|
|
|
//와블
|
|
m_wobbelLongditudinal = 1;
|
|
m_wobbelTransversal = 1;
|
|
m_wobbelShape = eWobbelShape.ELLIPSE;
|
|
m_wobbelFrequency = 100;
|
|
m_wobbelEnable = false;
|
|
|
|
//램핑
|
|
m_rampingStartDist = 0;
|
|
m_rampingStartPower1 = 0;
|
|
m_rampingStartPower2 = 0;
|
|
m_rampingEndPower1 = 0;
|
|
m_rampingEndPower2 = 0;
|
|
m_rampingEndDist = 0;
|
|
m_RampingInterval = 0;
|
|
//m_rampingStartSlopeMode = false;
|
|
//m_rampingEndSlopeMode = false;
|
|
|
|
//SnowMan
|
|
m_snowManEnable = false;
|
|
TiltingAngle = 0;
|
|
m_horizontalRadiusOfHead = 1;
|
|
m_verticalRadiusOfHead = 1;
|
|
m_horizontalRadiusOfBody = 1;
|
|
m_verticalRadiusOfBody = 1;
|
|
m_velocityOfHead = 1;
|
|
m_velocityOfBody = 1;
|
|
m_controlType = eControlType.AngularSpeedControl;
|
|
m_drawWay = eDrawWay.Left;
|
|
m_vectorCount = 200;
|
|
|
|
m_zigzagWobbelAmplitude = 0.8;
|
|
m_zigzagWobbelPitch = 0.8;
|
|
m_zigzagWobbelEnable = false;
|
|
m_zigzagWobbelRadius = 0.1;
|
|
m_zigzagWobbelLinearVelocity = 500;
|
|
|
|
}
|
|
|
|
public ScannerParam Clone()
|
|
{
|
|
ScannerParam param = new ScannerParam();
|
|
|
|
param.m_markSpeed = this.m_markSpeed;
|
|
param.m_jumpSpeed = this.m_jumpSpeed;
|
|
param.m_laserOnDelay = this.m_laserOnDelay;
|
|
param.m_laserOffDelay = this.m_laserOffDelay;
|
|
param.m_jumpDelay = this.m_jumpDelay;
|
|
param.m_markDelay = this.m_markDelay;
|
|
param.m_polygonDelay = this.m_polygonDelay;
|
|
param.m_laserPower1 = this.m_laserPower1;
|
|
param.m_laserPower2 = this.m_laserPower2;
|
|
param.m_laserFrequency = this.m_laserFrequency;
|
|
param.m_laserDuty = this.m_laserDuty;
|
|
param.m_laserPulseDuration = this.m_laserPulseDuration;
|
|
|
|
param.m_description = this.m_description;
|
|
param.m_color = this.m_color;
|
|
param.No = this.No;
|
|
param.m_numberOfCount = this.m_numberOfCount;
|
|
|
|
param.m_wobbelEnable = this.m_wobbelEnable;
|
|
param.m_wobbelTransversal = this.m_wobbelTransversal;
|
|
param.m_wobbelLongditudinal = this.m_wobbelLongditudinal;
|
|
param.m_wobbelShape = this.m_wobbelShape;
|
|
param.m_wobbelFrequency = this.m_wobbelFrequency;
|
|
|
|
param.m_rampingStartPower1 = this.m_rampingStartPower1;
|
|
param.m_rampingStartPower2 = this.m_rampingStartPower2;
|
|
param.m_rampingStartDist = this.m_rampingStartDist;
|
|
param.m_rampingEndPower1 = this.m_rampingEndPower1;
|
|
param.m_rampingEndPower2 = this.m_rampingEndPower2;
|
|
param.m_rampingEndDist = this.m_rampingEndDist;
|
|
//param.m_rampingStartSlopeMode = this.m_rampingStartSlopeMode;
|
|
//param.m_rampingEndSlopeMode = this.m_rampingEndSlopeMode;
|
|
param.m_RampingInterval = this.m_RampingInterval;
|
|
|
|
//param.m_usePowerProfile = this.m_usePowerProfile;
|
|
//param.m_powerProfileID = this.m_powerProfileID;
|
|
|
|
param.m_snowManEnable = this.m_snowManEnable;
|
|
param.TiltingAngle = this.TiltingAngle;
|
|
param.m_horizontalRadiusOfHead = this.HorizontalRadiusOfHead;
|
|
param.m_verticalRadiusOfHead = this.VerticalRadiusOfHead;
|
|
param.m_horizontalRadiusOfBody = this.HorizontalRadiusOfBody;
|
|
param.m_verticalRadiusOfBody = this.VerticalRadiusOfBody;
|
|
param.m_velocityOfHead = this.HeadVelocity;
|
|
param.m_velocityOfBody = this.BodyVelocity;
|
|
param.m_controlType = this.ControlType;
|
|
param.m_drawWay = this.DrawWay;
|
|
param.m_vectorCount = this.VectorCount;
|
|
param.m_spotShotTime = this.SpotShotTime;
|
|
|
|
param.m_zigzagWobbelAmplitude = this.ZigzagWobbelAmplitude;
|
|
param.m_zigzagWobbelPitch = this.ZigzagWobbelPitch;
|
|
param.m_zigzagWobbelEnable = this.ZigzagWobbelEnable;
|
|
param.m_zigzagWobbelRadius = this.ZigzagWobbelRadius;
|
|
param.m_zigzagWobbelLinearVelocity = this.ZigzagWobbelLinearVelocity;
|
|
|
|
return param;
|
|
}
|
|
}
|
|
}
|