xCore-SDK  0.5.0
xCore SDK C# API
welding_cli.hpp
1#ifndef XCORESDK_SRC_MANAGED_WELDING_CLI_HPP_
2#define XCORESDK_SRC_MANAGED_WELDING_CLI_HPP_
3
4#include <unordered_map>
5#include "data_types_cli.hpp"
6#include "exception_cli.hpp"
7
8using namespace System;
9using namespace System::Collections::Generic;
10using namespace System::Runtime::InteropServices;
11
12namespace rokae {
13 class BaseWelding;
14}
15
16namespace rokae::clr {
17
21 public value struct LaserTrackParams {
26 0.01, // vel_max
27 0.2, // acc_max
28 2.0, // jerk_max
29 5.0, // filter_window_size
30 0.2, // filter_data
31 0.2, // filter_track
32 0.06, // delay_time
33 0.05, // cycle_time
34 true, // dir_y_enable
35 0.02, // dir_y_max
36 true, // dir_z_enable
37 0.02, // dir_z_max
38 "xz" // coord_feature
39 };
40
44 Double vel_max;
48 Double acc_max;
52 Double jerk_max;
68 Double delay_time;
72 Double cycle_time;
76 Boolean dir_y_enable;
80 Double dir_y_max;
84 Boolean dir_z_enable;
88 Double dir_z_max;
97 };
98
102public enum class WeavingType {
104 ZIGZAG = 0,
106 SINE = 1,
108 CIRCULAR = 2
109 };
110
114public enum class DwellType {
116 ROBOT_STAY = 0,
118 WEAVE_STOP = 1
119 };
120
121public value struct WeaveParams {
126 WeaveParams dp;
127 dp.frequency = 0.1;
128 dp.amplitude = gcnew array<double>(2){0.0001, 0.0001};
129 dp.weaveing_type = WeavingType::ZIGZAG;
130 dp.dwell_type = DwellType::ROBOT_STAY;
131 dp.dwell_time = gcnew array<double>(3){0.0, 0.0, 0.0};
132 dp.inclination_angle = 0;
133 dp.elevation_angle = gcnew array<double>(2){0, 0};
134 dp.radius = 0.001;
135 dp.phase_invert = false;
136 return dp;
137 };
139 Double frequency;
141 array<Double> ^ amplitude;
143 WeavingType weaveing_type;
145 DwellType dwell_type;
147 array<Double> ^ dwell_time;
151 array<Double> ^ elevation_angle;
153 Double radius;
156 };
157
158 public ref class Welding {
159
160 protected:
161 rokae::BaseWelding* ptr;
162
163 public:
164
165 Welding(rokae::BaseWelding*);
166
167 virtual ~Welding();
168
177 void setWeave(bool enable, double frequency, double amplitude, array<double>^ dwell_time, [Out] ErrorCode ^ %ec);
178
185 void setSwingMotion(double acceleration, double jerk, [Out] ErrorCode^% ec);
193 void setWeaveParameters(double frequency, double amplitude, array<double>^ dwell_time, [Out] ErrorCode^% ec);
194
200 void setWeaveParameters(WeaveParams weaveParams, [Out] ErrorCode^% ec);
201
210 void calcWeldOffset(Frame^% start, Frame^ start_offs, Frame^% target, Frame^ target_offs, [Out] ErrorCode^% ec);
211
222 void calcWeldOffset(Frame^% start, Frame^ start_offs, Frame^% target, Frame^ target_offs, Frame^% aux, Frame^ aux_offs, [Out] ErrorCode^% ec);
223
232 void calcWeldOffsetCalculatedZ(Frame^% start, Frame^ start_offs, Frame^% target, Frame^ target_offs, [Out] ErrorCode^% ec);
233
244 void calcWeldOffsetCalculatedZ(Frame^% start, Frame^ start_offs, Frame^% target, Frame^ target_offs, Frame^% aux, Frame^ aux_offs, [Out] ErrorCode^% ec);
245
263 Frame^ teach_point_1, double offset_1,
264 Frame^ teach_point_2, double offset_2,
265 array<double>^% offset_start, array<double>^% offset_target,
266 [Out] ErrorCode^% ec);
267
285 List<List<Frame^>^>^ calcWeldOffset_Multi(List<Frame^>^ way_points, List<Frame^>^ teach_points, List<array<double>^>^ offsets, int% error_index, [Out] ErrorCode^% ec);
286
292 void adjustTrackOffset(array<double>^ offset, [Out] ErrorCode^% ec);
293
307 void bindWeaveDo(String^ signal,String^ action, bool value, [Out] ErrorCode^% ec);
308
314 void unbindWeaveDo(String^ signal, [Out] ErrorCode^% ec) ;
315
320 void startTracking([Out] ErrorCode^% ec);
321
326 void stopTracking([Out] ErrorCode^% ec);
327
335 void addLaserTrackOffset(double x, double z, Boolean valid, [Out] ErrorCode^% ec);
336
345 void addLaserTrackOffset(double x, double y, double z, Boolean valid, [Out] ErrorCode^% ec);
346
352 void setSensorFrame(Frame^ sensor_frame, [Out] ErrorCode^% ec);
353
360
361};
362
363}
364
365#endif //XCORESDK_SRC_MANAGED_WELDING_CLI_HPP_
xCoreSDK错误码
void startTracking([Out] ErrorCode^% ec)
开始激光跟踪
void adjustTrackOffset(array< double >^ offset, [Out] ErrorCode^% ec)
电弧跟踪偏移 - 调整焊道偏移量
void calcWeldOffsetCalculatedZ(Frame^% start, Frame^ start_offs, Frame^% target, Frame^ target_offs, [Out] ErrorCode^% ec)
多层多道偏移 - 计算直线轨迹偏移。偏移量的参考坐标系并非焊道坐标系,X,Y轴采用焊道坐标系,而Z轴由X,Y轴叉乘得到。
void bindWeaveDo(String^ signal, String^ action, bool value, [Out] ErrorCode^% ec)
设置摆动过程中DO输出规则。和设置系统IO类似,但不保存设置,重启后需要重新设置。 开始DO输出的时机为通过接口绑定DO号后,非摆动轨迹默认DO全部置0,如果开启摆动,则按照设定规则输出。
void transformOffsetByTeaching(Frame^ start, Frame^ target, Frame^ teach_point_1, double offset_1, Frame^ teach_point_2, double offset_2, array< double >^% offset_start, array< double >^% offset_target, [Out] ErrorCode^% ec)
多层多道辅助接口 - 根据指定的直线轨迹起点和终点,以及两个偏移方向,按指定的偏移距离进行坐标系转换, 使偏移量相对的坐标系与calcWeldOffsetCalculatedZ()接口中的一致
void addLaserTrackOffset(double x, double y, double z, Boolean valid, [Out] ErrorCode^% ec)
设置添加激光跟踪偏移
void unbindWeaveDo(String^ signal, [Out] ErrorCode^% ec)
取消设置摆动过程中DO输出
void setSensorFrame(Frame^ sensor_frame, [Out] ErrorCode^% ec)
设置激光器相对tcp坐标
void setSwingMotion(double acceleration, double jerk, [Out] ErrorCode^% ec)
设置摆动加速度和加加速度
void setLaserTrackParameters(LaserTrackParams params, [Out] ErrorCode^% ec)
设置激光跟踪参数。需要在开始跟踪之前调用
void calcWeldOffset(Frame^% start, Frame^ start_offs, Frame^% target, Frame^ target_offs, Frame^% aux, Frame^ aux_offs, [Out] ErrorCode^% ec)
多层多道偏移 - 计算圆弧轨迹沿焊道坐标系的偏移
List< List< Frame^>^> calcWeldOffset_Multi(List< Frame^>^ way_points, List< Frame^>^ teach_points, List< array< double >^>^ offsets, int% error_index, [Out] ErrorCode^% ec)
多层多道偏移 - 多条轨迹,适用于平角焊/平焊/横焊
void setWeave(bool enable, double frequency, double amplitude, array< double >^ dwell_time, [Out] ErrorCode ^ %ec)
开始/停止摆动。开始摆动时可设置摆动参数
void setWeaveParameters(double frequency, double amplitude, array< double >^ dwell_time, [Out] ErrorCode^% ec)
设置摆动参数,支持在摆动过程中调整
void setWeaveParameters(WeaveParams weaveParams, [Out] ErrorCode^% ec)
设置摆动参数,支持在摆动过程中调整
void addLaserTrackOffset(double x, double z, Boolean valid, [Out] ErrorCode^% ec)
设置添加激光跟踪偏移
void calcWeldOffset(Frame^% start, Frame^ start_offs, Frame^% target, Frame^ target_offs, [Out] ErrorCode^% ec)
多层多道偏移 - 计算直线轨迹沿焊道坐标系的偏移
void stopTracking([Out] ErrorCode^% ec)
结束激光跟踪
void calcWeldOffsetCalculatedZ(Frame^% start, Frame^ start_offs, Frame^% target, Frame^ target_offs, Frame^% aux, Frame^ aux_offs, [Out] ErrorCode^% ec)
多层多道偏移 - 计算圆弧轨迹偏移。偏移量的参考坐标系并非焊道坐标系,X,Y轴采用焊道坐标系,而Z轴由X,Y轴叉乘得到。
Double cycle_time
激光器数据刷新周期,与addLaserTrackOffset()调用周期保持一致,建议为激光器允许的最大刷新周期,范围[0, 0.5]s
Definition: welding_cli.hpp:72
Boolean dir_z_enable
焊道坐标系Z方向是否启用跟踪偏移
Definition: welding_cli.hpp:84
Double filter_data
激光器数据指数滑动滤波因子,范围[0, 1], 建议值: 0.2
Definition: welding_cli.hpp:60
Double jerk_max
跟踪偏移值的最大加加速度, 单位: 米/秒^3, 范围(0, +∞), 建议值: 2.0m/s^3
Definition: welding_cli.hpp:52
Boolean dir_y_enable
激光器坐标系Y方向是否启用跟踪偏移
Definition: welding_cli.hpp:76
Double delay_time
激光器数据延迟时间,用于与TCP数据对齐, 单位: 秒, 范围[0, +∞]。不同激光器延迟时间不同,明图建议值为0.06s,创想建议值为0.12s
Definition: welding_cli.hpp:68
Double filter_window_size
激光器数据中值滤波窗口大小, 范围[0, 10], 建议值: 5.0 (过大产生滤波滞后)
Definition: welding_cli.hpp:56
Double dir_y_max
焊道坐标系Y方向最大跟踪偏移值,超过该值停止跟踪和运动,范围[0, +∞]m
Definition: welding_cli.hpp:80
static LaserTrackParams Default
默认激光跟踪参数
Definition: welding_cli.hpp:25
Double acc_max
跟踪偏移值的最大加速度, 单位: 米/秒^2, 范围(0, +∞), 建议值: 0.2m/s^2
Definition: welding_cli.hpp:48
Double filter_track
跟踪偏移值指数滑动滤波因子,范围[0, 1], 建议值: 0.2
Definition: welding_cli.hpp:64
Double vel_max
跟踪偏移值的最大速度, 单位: 米/秒, 范围(0, +∞), 建议值: 0.01m/s
Definition: welding_cli.hpp:44
String coord_feature
激光器坐标系的方向特征,需要在跟踪前调用。目前支持: "xz" - 创想为XZ有效,激光器的写入有效数据为(X,0,Z) "yz" - 明图为YZ有效,激光器的写入有效数据为(0,...
Definition: welding_cli.hpp:96
Double dir_z_max
焊道坐标系Z方向最大跟踪偏移值,超过该值停止跟踪和运动,范围[0, +∞]m
Definition: welding_cli.hpp:88
Double frequency
摆动频率,单位: Hz, 范围: [0.1, 5]
WeavingType weaveing_type
摆动形状
array< Double > dwell_time
停留时间,[左, 中, 右],单位: 秒,范围: >=0
static WeaveParams Default()
默认摆动参数
DwellType dwell_type
停留类型. 圆弧摆需要设为摆动停留
Double inclination_angle
倾斜角度,单位: 弧度
Double radius
圆弧摆动半径,单位: 米
array< Double > elevation_angle
仰角,[左,右],单位: 弧度
Boolean phase_invert
波形反向.true - 向右或逆时针摆动,false - 向左或顺时针摆动
array< Double > amplitude
幅度,[左,右],单位: 米, 范围: [0.0001, 0.05]