In robotics, we have
$v=J\dot q$ ---------------- (1)
to calculate the velocity ($v$) in cartesian space. So, we get.
$\dot q={J^-}^1 v $ ---------------- (2)
where, $v = [v_x, v_y, v_z, \omega_x, \omega_y, \omega_z]$.
If I assume the robot only has 5 independent joints. Its jacobian is a 6x5 matrix. In cartesian space, we always have $\omega_z = 0$. So, the $v$ changes to $[v_x, v_y, v_z, \omega_x, \omega_y, 0]$.
When calculating the inverse kinematics, can we change equation (2) to
$\dot q = {J(1:5, :)^-}^1 v(1:5)$ ----------(3)
The result of (2) and (3) is different. It seems the difference comes from J^-1 and J(1:5, :)^-1. Does anyone know why?
Note: I just take the -1 as the pseudo inverse.
For example. we have one joint arm as
0-----------------------
In general, it's jacobian $J$ is a 6x1 matrix, and its velocity in cartesian space will be $[v_x, v_y, 0, 0, 0, \omega_z]$. So, we clearly know some elements are always 0. If an arbitrary cartesian trajectory $[v_x, v_y, v_z, \omega_x, \omega_y, \omega_z]$ is injected in Eqn. (2).
Is that possible to eliminate the impossible 0 elements in advance, then go to inverse kinematics?
In Eqn. (3), is that possible to select the corresponding row of jacobian and velocity directly?
be careful about the notation: $v=J\dot{q}$ (or $dx=Jdq$). Assuming $J$ be invertible you have: $\dot{q}=J^{-1}v$. When you mention "degrees-of-freedom" in robotics, you need to specify whether you refer to "joint space" or "task space" degrees. For example, 5 DoFs at the joint space level, means that your robot has 5 (independent) joints, therefore $q$ would have 5 components. Vice-versa, if you refer to 5 DoFs at the task-space level, which I assume here,then your end-effector just has 5 (controllable) DoFs. As such, it is not true that $wz=0$, because $wz$ is just undefined, namely $v$ has 5 components without $w_z$.
Now, to answer your question. Let your task-space velocity vector be $v=[v_x,v_y,v_z,w_x,w_y]$. In this case, if you still have 6 joints, then your robot is redundantly-actuated. Notice that the Jacobian, $J(1:5,:)$, becomes rectangular and not invertible! Therefore, you have multiple solutions to find $\dot{q}$. You may just type in your code $\dot{q}=pinv(J(1:5,:))v$, where pinv() is the pseudo-inverse of $J$. otherwise, for more elegant solutions you may have a look on some Optimisation problems with null-space explorations, see e.g. https://link.springer.com/book/10.1007/978-1-84628-642-1 or https://books.google.com.hk/books/about/Introduction_to_Robotics.html?id=MqMeAQAAIAAJ&redir_esc=y