@@ -175,6 +175,38 @@ MatrixXd DQ_Kinematics::distance_jacobian(const MatrixXd &pose_jacobian, const D
175175 return Jd;
176176}
177177
178+ /* *
179+ * @brief distance_jacobian_derivative() returns the time derivative of Jd,
180+ * where Jd is the Jacobian that satisfies the relation
181+ * dot(d^2) = Jd * q_dot, where dot(d^2) is the time derivative of
182+ * the square of the distance between the origin of the frame
183+ * represented by pose and the origin of the reference frame.
184+ * @param pose_jacobian The MatrixXd representing the pose Jacobian.
185+ * @param pose_jacobian_derivative The MatrixXd representing the pose Jacobian derivative.
186+ * @param pose The DQ representing the pose related to the pose Jacobian, as obtained from
187+ * fkm().
188+ * @param q_dot The VectorXd representing the robot configuration velocities.
189+ * @return The MatrixXd representing the desired Jacobian derivative.
190+ */
191+ MatrixXd DQ_Kinematics::distance_jacobian_derivative (const MatrixXd& pose_jacobian,
192+ const MatrixXd& pose_jacobian_derivative,
193+ const DQ& pose,
194+ const VectorXd &q_dot)
195+ {
196+ // /Translation
197+ const DQ t = translation (pose);
198+
199+ // /Translation Jacobian
200+ const MatrixXd Jt = translation_jacobian (pose_jacobian, pose);
201+
202+ // /Translation Jacobian derivative
203+ const MatrixXd Jt_dot = translation_jacobian_derivative (pose_jacobian, pose_jacobian_derivative, pose, q_dot);
204+
205+ // /Translation derivative
206+ const DQ t_dot = DQ (Jt*q_dot);
207+ return 2 *vec4 (t_dot).transpose ()*Jt + 2 *vec4 (t).transpose ()*Jt_dot;
208+ }
209+
178210/* *
179211 * @brief Given the Jacobian pose_jacobian and the corresponding unit dual
180212 * quaternion pose that satisfy vec8(pose_dot) = J *
@@ -194,6 +226,38 @@ MatrixXd DQ_Kinematics::translation_jacobian(const MatrixXd &pose_jacobian, cons
194226 2.0 *hamiplus4 (D (pose))*C4 ()*DQ_Kinematics::rotation_jacobian (pose_jacobian);
195227}
196228
229+ /* *
230+ * @brief translation_jacobian_derivative() returns the time derivative of Jt,
231+ * where Jt is the translation Jacobian that satisfies vec4(t_dot) = Jt * q_dot,
232+ * t_dot is the time derivative of the translation quaternion, and q_dot
233+ * is the time derivative of the configuration vector.
234+ * @param pose_jacobian The MatrixXd representing the pose Jacobian, as obtained from
235+ * pose_jacobian().
236+ * @param pose_jacobian_derivative The MatrixXd representing the pose Jacobian derivative.
237+ * @param pose The DQ representing the pose related to the pose Jacobian, as obtained from
238+ * fkm().
239+ * @param q_dot The VectorXd representing the robot configuration velocities.
240+ * @return the MatrixXd representing the desired Jacobian derivative.
241+ */
242+ MatrixXd DQ_Kinematics::translation_jacobian_derivative (const MatrixXd& pose_jacobian,
243+ const MatrixXd& pose_jacobian_derivative,
244+ const DQ& pose,
245+ const VectorXd &q_dot)
246+ {
247+ // / Aliases
248+ const DQ& x = pose;
249+
250+ // / Requirements
251+ const MatrixXd Jprim = rotation_jacobian (pose_jacobian);
252+ const MatrixXd Jprim_dot = rotation_jacobian_derivative (pose_jacobian_derivative);
253+
254+ const MatrixXd Jdual = pose_jacobian.block (4 ,0 ,4 ,pose_jacobian.cols ());
255+ const MatrixXd Jdual_dot = pose_jacobian_derivative.block (4 ,0 ,4 ,pose_jacobian_derivative.cols ());
256+ return 2 *haminus4 (DQ (C4 ()*Jprim*q_dot))*Jdual + 2 *haminus4 (x.P ().conj ())*Jdual_dot +
257+ 2 *hamiplus4 (DQ (Jdual*q_dot))*C4 ()*Jprim + 2 *hamiplus4 (x.D ())*C4 ()*Jprim_dot;
258+ }
259+
260+
197261/* *
198262 * @brief Given the pose_jacobian and the corresponding unit dual
199263 * quaternion pose that satisfy vec8(pose_dot) = J *
@@ -211,6 +275,17 @@ MatrixXd DQ_Kinematics::rotation_jacobian(const MatrixXd &pose_jacobian)
211275 return pose_jacobian.block (0 ,0 ,4 ,pose_jacobian.cols ());
212276}
213277
278+ /* *
279+ * @brief rotation_jacobian_derivative() returns the time derivative of the rotation
280+ * Jacobian.
281+ * @param pose_jacobian_derivative The MatrixXd representing the pose Jacobian derivative.
282+ * @return the MatrixXd representing the desired Jacobian derivative.
283+ */
284+ MatrixXd DQ_Kinematics::rotation_jacobian_derivative (const MatrixXd& pose_jacobian_derivative)
285+ {
286+ return pose_jacobian_derivative.block (0 ,0 ,4 ,pose_jacobian_derivative.cols ());
287+ }
288+
214289/* *
215290 * @brief The line Jacobian given the rotation_jacobian, the translation_jacobian, the pose, and a line_direction.
216291 * @param rotation_jacobian the current rotation Jacobian.
@@ -247,6 +322,62 @@ MatrixXd DQ_Kinematics::line_jacobian(const MatrixXd& pose_jacobian, const DQ& p
247322 return Jlx;
248323}
249324
325+
326+ /* *
327+ * @brief line_jacobian_derivative returns the time derivative of the line jacobian.
328+ * @param pose_jacobian The pose Jacobian as obtained from pose_jacobian().
329+ * @param pose_jacobian_derivative The MatrixXd representing the pose Jacobian derivative.
330+ * @param pose The pose obtained from fkm() corresponding to pose_jacobian().
331+ * @param line_direction the line direction w.r.t. the pose reference frame. For example using i_, j_, and k_
332+ * @param q_dot The VectorXd representing the robot configuration velocities.
333+ * @return the MatrixXd representing the desired Jacobian derivative.
334+ */
335+ MatrixXd DQ_Kinematics::line_jacobian_derivative (const MatrixXd& pose_jacobian,
336+ const MatrixXd& pose_jacobian_derivative,
337+ const DQ& pose,
338+ const DQ& line_direction,
339+ const VectorXd &q_dot)
340+ {
341+ // /Rotation
342+ const DQ r = rotation (pose);
343+
344+ // /Translation
345+ const DQ t = translation (pose);
346+
347+ // /Line direction w.r.t. base
348+ const DQ l = r*(line_direction)*conj (r);
349+
350+ // / Requirements
351+ const MatrixXd Jt = translation_jacobian (pose_jacobian,pose);
352+ const MatrixXd Jr = rotation_jacobian (pose_jacobian);
353+ const MatrixXd Jr_dot = rotation_jacobian_derivative (pose_jacobian_derivative);
354+ const MatrixXd Jt_dot = translation_jacobian_derivative (pose_jacobian, pose_jacobian_derivative, pose, q_dot);
355+ const MatrixXd Jline = line_jacobian (pose_jacobian, pose, line_direction);
356+
357+ // /Rotation derivative
358+ const DQ r_dot = DQ (Jr*q_dot);
359+
360+ // /Translation derivative
361+ const DQ t_dot = DQ (Jt*q_dot);
362+
363+ // /Line direction derivative
364+ const DQ l_dot = r_dot*(line_direction)*conj (r) + r*(line_direction)*conj (r_dot);
365+
366+ // / Line direction Jacobian
367+ const MatrixXd Jrx = Jline.block (0 ,0 ,4 ,Jline.cols ());
368+
369+ // /Line direction Jacobian derivative
370+ const MatrixXd Jrx_dot = (haminus4 (line_direction*conj (r_dot)) + hamiplus4 (r_dot*line_direction)*C4 ())*Jr +
371+ (haminus4 (line_direction*conj (r)) + hamiplus4 (r*line_direction)*C4 ())*Jr_dot;
372+
373+ // /Line moment Jacobian derivative
374+ const MatrixXd Jmx_dot = crossmatrix4 (l_dot).transpose ()*Jt + crossmatrix4 (l).transpose ()*Jt_dot +
375+ crossmatrix4 (t_dot)*Jrx + crossmatrix4 (t)*Jrx_dot;
376+ MatrixXd Jline_dot = MatrixXd::Zero (8 , Jline.cols ());
377+ Jline_dot << Jrx_dot, Jmx_dot;
378+ return Jline_dot;
379+ }
380+
250381/* *
251382 * @brief The plane Jacobian given the pose_jacobian, the pose, and a plane_normal.
252383 * @param pose_jacobian The pose Jacobian as obtained from pose_jacobian().
@@ -280,6 +411,65 @@ MatrixXd DQ_Kinematics::plane_jacobian(const MatrixXd& pose_jacobian, const DQ&
280411 return JPI;
281412}
282413
414+
415+ /* *
416+ * @brief plane_jacobian_derivative() returns the time derivative of the plane jacobian.
417+ * @param pose_jacobian The pose Jacobian as obtained from pose_jacobian().
418+ * @param pose_jacobian_derivative The MatrixXd representing the pose Jacobian derivative.
419+ * @param pose The pose obtained from fkm() corresponding to pose_jacobian().
420+ * @param plane_normal the plane normal w.r.t. the pose reference frame. For example using i_, j_, and k_
421+ * @param q_dot The VectorXd representing the robot configuration velocities.
422+ * @return the MatrixXd representing the desired Jacobian derivative.
423+ */
424+ MatrixXd DQ_Kinematics::plane_jacobian_derivative (const MatrixXd& pose_jacobian,
425+ const MatrixXd& pose_jacobian_derivative,
426+ const DQ& pose,
427+ const DQ& plane_normal,
428+ const VectorXd &q_dot)
429+ {
430+ // /Rotation
431+ const DQ r = rotation (pose);
432+
433+ // /Translation
434+ const DQ t = translation (pose);
435+
436+ // /Requirements
437+ const MatrixXd JPI = plane_jacobian (pose_jacobian, pose, plane_normal);
438+ const MatrixXd Jr = rotation_jacobian (pose_jacobian);
439+ const MatrixXd Jt = translation_jacobian (pose_jacobian,pose);
440+ const MatrixXd Jr_dot = rotation_jacobian_derivative (pose_jacobian_derivative);
441+ const MatrixXd Jt_dot = translation_jacobian_derivative (pose_jacobian, pose_jacobian_derivative, pose, q_dot);
442+
443+ // /Rotation derivative
444+ const DQ r_dot = DQ (Jr*q_dot);
445+
446+ // /Translation derivative
447+ const DQ t_dot = DQ (Jt*q_dot);
448+
449+ // /Plane normal Jacobian
450+ const MatrixXd Jnz = JPI.block (0 ,0 ,4 ,JPI.cols ());
451+
452+ // /Plane normal Jacobian derivative
453+ const MatrixXd Jnz_dot = (haminus4 (plane_normal*conj (r_dot)) + hamiplus4 (r_dot*plane_normal)*C4 ())*Jr +
454+ (haminus4 (plane_normal*conj (r)) + hamiplus4 (r*plane_normal)*C4 ())*Jr_dot;
455+
456+ // /Plane normal w.r.t base
457+ const DQ nz = r*(plane_normal)*conj (r);
458+
459+ // /Plane normal (w.r.t base) derivative
460+ const DQ nz_dot = DQ ( Jnz*q_dot );
461+
462+ // /Plane distance Jacobian derivative
463+ const MatrixXd Jdz_dot = (vec4 (nz_dot).transpose ()*Jt + vec4 (nz).transpose ()*Jt_dot +
464+ vec4 (t_dot).transpose ()*Jnz + vec4 (t).transpose ()*Jnz_dot);
465+
466+
467+ MatrixXd JPI_dot = MatrixXd::Zero (8 ,JPI.cols ());
468+ JPI_dot << Jnz_dot, Jdz_dot, MatrixXd::Zero (3 , JPI_dot.cols ());
469+ return JPI_dot;
470+
471+ }
472+
283473MatrixXd DQ_Kinematics::point_to_point_distance_jacobian (const MatrixXd& translation_jacobian, const DQ& robot_point, const DQ& workspace_point)
284474{
285475 if (! is_pure_quaternion (robot_point))
0 commit comments