完善五轴 RTCP 仿真与验证资料
This commit is contained in:
@@ -23,10 +23,27 @@ static std::vector<std::string> g_canon_events;
|
||||
static double g_external_feed_rate = 0.0;
|
||||
static int g_external_axis_mask = Interp::AXIS_MASK_X | Interp::AXIS_MASK_Y | Interp::AXIS_MASK_Z;
|
||||
static std::string g_parameter_file_name;
|
||||
static CANON_PLANE g_external_plane = CANON_PLANE::XY;
|
||||
|
||||
struct ExternalPosition {
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
double z = 0.0;
|
||||
double a = 0.0;
|
||||
double b = 0.0;
|
||||
double c = 0.0;
|
||||
double u = 0.0;
|
||||
double v = 0.0;
|
||||
double w = 0.0;
|
||||
};
|
||||
|
||||
static ExternalPosition g_external_position;
|
||||
|
||||
void reset_canon_events()
|
||||
{
|
||||
g_canon_events.clear();
|
||||
g_external_position = ExternalPosition{};
|
||||
g_external_plane = CANON_PLANE::XY;
|
||||
}
|
||||
|
||||
void push_canon_event(const std::string &event)
|
||||
@@ -56,6 +73,65 @@ int external_axis_mask()
|
||||
return g_external_axis_mask;
|
||||
}
|
||||
|
||||
void set_external_position(double x, double y, double z,
|
||||
double a, double b, double c,
|
||||
double u, double v, double w)
|
||||
{
|
||||
g_external_position.x = x;
|
||||
g_external_position.y = y;
|
||||
g_external_position.z = z;
|
||||
g_external_position.a = a;
|
||||
g_external_position.b = b;
|
||||
g_external_position.c = c;
|
||||
g_external_position.u = u;
|
||||
g_external_position.v = v;
|
||||
g_external_position.w = w;
|
||||
}
|
||||
|
||||
void set_external_arc_position(double first_end, double second_end,
|
||||
double axis_end_point,
|
||||
double a, double b, double c,
|
||||
double u, double v, double w)
|
||||
{
|
||||
ExternalPosition next = g_external_position;
|
||||
switch (g_external_plane) {
|
||||
case CANON_PLANE::XY:
|
||||
next.x = first_end;
|
||||
next.y = second_end;
|
||||
next.z = axis_end_point;
|
||||
break;
|
||||
case CANON_PLANE::YZ:
|
||||
next.x = axis_end_point;
|
||||
next.y = first_end;
|
||||
next.z = second_end;
|
||||
break;
|
||||
case CANON_PLANE::XZ:
|
||||
next.x = second_end;
|
||||
next.y = axis_end_point;
|
||||
next.z = first_end;
|
||||
break;
|
||||
case CANON_PLANE::UV:
|
||||
next.u = first_end;
|
||||
next.v = second_end;
|
||||
next.w = axis_end_point;
|
||||
break;
|
||||
case CANON_PLANE::VW:
|
||||
next.u = axis_end_point;
|
||||
next.v = first_end;
|
||||
next.w = second_end;
|
||||
break;
|
||||
case CANON_PLANE::UW:
|
||||
next.u = second_end;
|
||||
next.v = axis_end_point;
|
||||
next.w = first_end;
|
||||
break;
|
||||
}
|
||||
next.a = a;
|
||||
next.b = b;
|
||||
next.c = c;
|
||||
g_external_position = next;
|
||||
}
|
||||
|
||||
void reset_parameter_file_name()
|
||||
{
|
||||
g_parameter_file_name.clear();
|
||||
@@ -138,6 +214,7 @@ void CANON_UPDATE_END_POINT(double x, double y, double z,
|
||||
double a, double b, double c,
|
||||
double u, double v, double w)
|
||||
{
|
||||
standalone::set_external_position(x, y, z, a, b, c, u, v, w);
|
||||
std::ostringstream oss;
|
||||
oss << "CANON_UPDATE_END_POINT"
|
||||
<< " x=" << x
|
||||
@@ -159,6 +236,7 @@ void USE_LENGTH_UNITS(CANON_UNITS units)
|
||||
}
|
||||
void SELECT_PLANE(CANON_PLANE plane)
|
||||
{
|
||||
standalone::g_external_plane = plane;
|
||||
std::ostringstream oss;
|
||||
oss << "SELECT_PLANE plane=" << static_cast<int>(plane);
|
||||
standalone::push_canon_event(oss.str());
|
||||
@@ -515,16 +593,16 @@ void SET_PARAMETER_FILE_NAME(const char *filename)
|
||||
{
|
||||
standalone::set_parameter_file_name(filename);
|
||||
}
|
||||
CANON_PLANE GET_EXTERNAL_PLANE() { return CANON_PLANE::XY; }
|
||||
double GET_EXTERNAL_POSITION_A() { return 0.0; }
|
||||
double GET_EXTERNAL_POSITION_B() { return 0.0; }
|
||||
double GET_EXTERNAL_POSITION_C() { return 0.0; }
|
||||
double GET_EXTERNAL_POSITION_X() { return 0.0; }
|
||||
double GET_EXTERNAL_POSITION_Y() { return 0.0; }
|
||||
double GET_EXTERNAL_POSITION_Z() { return 0.0; }
|
||||
double GET_EXTERNAL_POSITION_U() { return 0.0; }
|
||||
double GET_EXTERNAL_POSITION_V() { return 0.0; }
|
||||
double GET_EXTERNAL_POSITION_W() { return 0.0; }
|
||||
CANON_PLANE GET_EXTERNAL_PLANE() { return standalone::g_external_plane; }
|
||||
double GET_EXTERNAL_POSITION_A() { return standalone::g_external_position.a; }
|
||||
double GET_EXTERNAL_POSITION_B() { return standalone::g_external_position.b; }
|
||||
double GET_EXTERNAL_POSITION_C() { return standalone::g_external_position.c; }
|
||||
double GET_EXTERNAL_POSITION_X() { return standalone::g_external_position.x; }
|
||||
double GET_EXTERNAL_POSITION_Y() { return standalone::g_external_position.y; }
|
||||
double GET_EXTERNAL_POSITION_Z() { return standalone::g_external_position.z; }
|
||||
double GET_EXTERNAL_POSITION_U() { return standalone::g_external_position.u; }
|
||||
double GET_EXTERNAL_POSITION_V() { return standalone::g_external_position.v; }
|
||||
double GET_EXTERNAL_POSITION_W() { return standalone::g_external_position.w; }
|
||||
double GET_EXTERNAL_PROBE_POSITION_A() { return 0.0; }
|
||||
double GET_EXTERNAL_PROBE_POSITION_B() { return 0.0; }
|
||||
double GET_EXTERNAL_PROBE_POSITION_C() { return 0.0; }
|
||||
@@ -629,6 +707,7 @@ void STRAIGHT_TRAVERSE(int lineno,
|
||||
double a, double b, double c,
|
||||
double u, double v, double w)
|
||||
{
|
||||
standalone::set_external_position(x, y, z, a, b, c, u, v, w);
|
||||
std::ostringstream oss;
|
||||
oss << "STRAIGHT_TRAVERSE line=" << lineno
|
||||
<< " x=" << x
|
||||
@@ -648,6 +727,7 @@ void STRAIGHT_FEED(int lineno,
|
||||
double a, double b, double c,
|
||||
double u, double v, double w)
|
||||
{
|
||||
standalone::set_external_position(x, y, z, a, b, c, u, v, w);
|
||||
std::ostringstream oss;
|
||||
oss << "STRAIGHT_FEED line=" << lineno
|
||||
<< " x=" << x
|
||||
@@ -669,6 +749,8 @@ void ARC_FEED(int lineno,
|
||||
double a, double b, double c,
|
||||
double u, double v, double w)
|
||||
{
|
||||
standalone::set_external_arc_position(first_end, second_end, axis_end_point,
|
||||
a, b, c, u, v, w);
|
||||
std::ostringstream oss;
|
||||
oss << "ARC_FEED line=" << lineno
|
||||
<< " first_end=" << first_end
|
||||
|
||||
@@ -870,6 +870,7 @@ char *lcinterp_run_fiveaxis_remap_file(const char *path, const char *ini_path)
|
||||
ok &= file_execute_count < max_file_steps;
|
||||
ok &= hal_rc == INTERP_OK && hal_status == 1;
|
||||
|
||||
append_events_and_state(output, interp);
|
||||
output << "fiveaxis_linuxcnc_remap_file_execute=" << (ok ? 1 : 0) << "\n";
|
||||
unsetenv("INI_FILE_NAME");
|
||||
return copy_result(output.str());
|
||||
|
||||
Reference in New Issue
Block a user