@@ -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+ */
553563MatrixXd 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