Skip to content

Commit 2317a3c

Browse files
authored
[DQ_Kinematics.h, cpp] Added a static method to compute the line-to-line-angle-residual. (#47)
1 parent 75ad8db commit 2317a3c

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

include/dqrobotics/robot_modeling/DQ_Kinematics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class DQ_Kinematics
8888
static MatrixXd plane_to_point_distance_jacobian(const MatrixXd& plane_jacobian, const DQ& workspace_point);
8989
static double plane_to_point_residual (const DQ& robot_plane, const DQ& workspace_point_derivative);
9090
static MatrixXd line_to_line_angle_jacobian (const MatrixXd& line_jacobian, const DQ& robot_line, const DQ& workspace_line);
91+
static double line_to_line_angle_residual (const DQ& robot_line, const DQ& workspace_line, const DQ& workspace_line_derivative);
9192

9293
static MatrixXd line_segment_to_line_segment_distance_jacobian(const MatrixXd& line_jacobian,
9394
const MatrixXd& robot_point_1_translation_jacobian,

src/robot_modeling/DQ_Kinematics.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,16 @@ double DQ_Kinematics::plane_to_point_residual(const DQ& robot_plane, const DQ&
550550
return static_cast<double>(result);
551551
}
552552

553+
554+
/**
555+
* @brief Given a line "lz" rigidly attached to the robot, and a workspace line "l", the distance function f(phi)=dot(lz-l, lz-l)
556+
* is useful to control the angle "phi" between both lines. line_to_line_angle_jacobian() returns the distance Jacobian Jd that
557+
* satisfy vec(f(phi)_dot) = Jd*q_dot + residual.
558+
* @param line_jacobian The line Jacobian.
559+
* @param robot_line The line rigidly attached to the robot.
560+
* @param workspace_line The workspace line. For example: i_, j_, k_.
561+
* @return The desired distance Jacobian.
562+
*/
553563
MatrixXd DQ_Kinematics::line_to_line_angle_jacobian(const MatrixXd &line_jacobian, const DQ &robot_line, const DQ &workspace_line)
554564
{
555565
if(! is_line(robot_line))
@@ -565,6 +575,29 @@ MatrixXd DQ_Kinematics::line_to_line_angle_jacobian(const MatrixXd &line_jacobia
565575
return 2.0*vec4(robot_line - workspace_line).transpose()*Jl;
566576
}
567577

578+
579+
/**
580+
* @brief line_to_line_angle_residual() returns the residual term that satisfy vec(f(phi)_dot) = Jd*q_dot + residual, where
581+
* f(phi)=dot(lz-l, lz-l) and Jd is the line-to-line-angle-jacobian.
582+
* @param robot_line The line rigidly attached to the robot.
583+
* @param workspace_line The workspace line. For example: i_, j_, k_.
584+
* @param workspace_line_derivative The time derivative of the workspace line.
585+
* @return The desired residual
586+
*/
587+
double DQ_Kinematics::line_to_line_angle_residual(const DQ& robot_line, const DQ& workspace_line, const DQ& workspace_line_derivative)
588+
{
589+
if(! is_line(robot_line))
590+
{
591+
throw std::range_error("The argument robot_line has to be a line.");
592+
}
593+
if(! is_line(workspace_line))
594+
{
595+
throw std::range_error("The argument workspace_line has to be a line.");
596+
}
597+
DQ result = 2*dot(robot_line-workspace_line, -1.0*workspace_line_derivative);
598+
return static_cast<double>(result);
599+
}
600+
568601
/**
569602
* @brief DQ_Kinematics::line_segment_to_line_segment_distance_jacobian
570603
* Obtains the squared distance Jacobian between two line segments.

0 commit comments

Comments
 (0)