Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DQ_Kinematics::point_to_line_segment / line_segment_to_point #45

Open
chewheel opened this issue Sep 12, 2022 · 0 comments
Open

DQ_Kinematics::point_to_line_segment / line_segment_to_point #45

chewheel opened this issue Sep 12, 2022 · 0 comments
Assignees
Labels
question Further information is requested

Comments

@chewheel
Copy link

chewheel commented Sep 12, 2022

Murilo sensei, I think having these jacobians can make many problems simpler. I wish these methods could be added if you have any time and are pleased to do so. :>

static MatrixXd point_to_line_segment_squared_distance_jacobian(const MatrixXd& robot_point_jacobian,
    const DQ& robot_point,
    const DQ& workspace_line,
    const DQ& workspace_point_1,
    const DQ& workspace_point_2)
{
    DQ projection_point = workspace_point_1 + P(workspace_line) * dot(P(workspace_line), (robot_point - workspace_point_1));
    double d_projection_point_to_line_point1 = norm(vec3(projection_point - workspace_point_1));
    double d_projection_point_to_line_point2 = norm(vec3(projection_point - workspace_point_2));
    double line_segment_length = norm(vec3(workspace_point_1 - workspace_point_2));
    if (d_projection_point_to_line_point1 <= line_segment_length && d_projection_point_to_line_point2 <= line_segment_length)
        // line_state = body
        return DQ_Kinematics::point_to_line_distance_jacobian(robot_point_jacobian, robot_point, workspace_line);
    else if (d_projection_point_to_line_point1 < d_projection_point_to_line_point2)
        // point 1 
        return DQ_Kinematics::point_to_point_distance_jacobian(robot_point_jacobian, robot_point, workspace_point_1);
    else
        // point 2
        return DQ_Kinematics::point_to_point_distance_jacobian(robot_point_jacobian, robot_point, workspace_point_2);
}
static MatrixXd line_segement_to_point_squared_distance_jacobian(const MatrixXd& robot_line_jacobian,
    const MatrixXd& robot_point_1_translation_jacobian,
    const MatrixXd& robot_point_2_translation_jacobian,
    const DQ& robot_line,
    const DQ& robot_point_1,
    const DQ& robot_point_2,
    const DQ& workspace_point)
{
    DQ projection_point = robot_point_1 + P(robot_line) * dot(P(robot_line), (workspace_point - robot_point_1));
    double d_projection_point_to_line_point1 = norm(vec3(projection_point - robot_point_1));
    double d_projection_point_to_line_point2 = norm(vec3(projection_point - robot_point_2));
    double line_segment_length = norm(vec3(robot_point_1 - robot_point_2));
    if (d_projection_point_to_line_point1 <= line_segment_length && d_projection_point_to_line_point2 <= line_segment_length)
        // line_state = body
        return DQ_Kinematics::line_to_point_distance_jacobian(robot_line_jacobian, robot_line, workspace_point);
    else if (d_projection_point_to_line_point1 < d_projection_point_to_line_point2)
        // point 1 
        return DQ_Kinematics::point_to_point_distance_jacobian(robot_point_1_translation_jacobian, robot_point_1, workspace_point);
    else
        // point 2
        return DQ_Kinematics::point_to_point_distance_jacobian(robot_point_2_translation_jacobian, robot_point_2, workspace_point);
}
@chewheel chewheel added the question Further information is requested label Sep 12, 2022
@mmmarinho mmmarinho self-assigned this Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants