# Kinematic solver for holonomic drive in moveit2

I am working on a robot having a robotic arm mounted on a mobile base. The mobile base is based on holonomic drive, using 4 mecanum wheels. According to Moveit2, we need to have an kinematic solver for mobile base depending on the type of drive of the mobile base.
An example for mobile base using differential drive is available here.

I am looking for kinematic solver for mecanum wheel robot, but unable to find one. Is there any kinematic solver available for mecanum wheel(holonomic drive) on MoveIt2?
If not what other options do I have?

UPDATE:

double w_front_left_vel =
(velocity_in_center_frame_linear_x_ - velocity_in_center_frame_linear_y_ -
params_.kinematics.sum_of_robot_center_projection_on_X_Y_axis *
velocity_in_center_frame_angular_z_);

double w_back_left_vel =
(velocity_in_center_frame_linear_x_ + velocity_in_center_frame_linear_y_ -
params_.kinematics.sum_of_robot_center_projection_on_X_Y_axis *
velocity_in_center_frame_angular_z_);

double w_back_right_vel =
(velocity_in_center_frame_linear_x_ - velocity_in_center_frame_linear_y_ +
params_.kinematics.sum_of_robot_center_projection_on_X_Y_axis *
velocity_in_center_frame_angular_z_);

double w_front_right_vel =
(velocity_in_center_frame_linear_x_ + velocity_in_center_frame_linear_y_ +
params_.kinematics.sum_of_robot_center_projection_on_X_Y_axis *
velocity_in_center_frame_angular_z_);

$$$$


EDIT:

Let me try and explain with greater details. Dynamics is the questions on how things move with force.

Simple Dynamic example:

A box sliding on ground with a force applied to it. Its acceleration is $$\frac{\partial x^2}{\partial^2 t} = \ddot{x}$$, its velocity is $$\frac{\partial x}{\partial t} = \dot{x}$$ and its position is $$x$$ and the force applied to it is $$F$$. Let's also assume there is friction linear $$f$$ to velocity and its mass is $$m$$. The differential equation describing this movement is:

$$m\ddot{x} = -f\dot{x} + F$$

which is an Ordinary Differential Equation (ODE). Since this equation is linear in all its components, there exists an algebraic (read analytical) solution. But that's not true for non-linear ODEs, e.g.:

$$\ddot{x} = sin(\dot{x})$$

which can only be "solved" by an approximate solver like Runge Kutta (see below).

Kinematics is the questions on how things move without considering force, but considering Kinematics will also result in a (non-linear) ODE.

Simple Kinematic example:

A 2-Dimensional "car" with a driven wheel. The wheel with radius $$r$$ turns at rotational velocity $$\dot{\phi}$$ without slipping and the body of the car therefore moves forward. Then the car's velocity $$\dot{x}$$ will be

$$\dot{x} = 2\pi r\dot{\phi}$$

as you can see we did not consider any force (and therefore not acceleration), but the resulting equation is still an ODE. For more complex systems, also Kinematics become non-linear ODEs. Example is the kinematics of a 2D-arm. which again need to be solved using an approximate ODE-solver like the ones I suggested in my old answer.

Have you looked into Ascent which implements ODE-solvers via Runge-Kutta

e.g. by Agilex Robotics see Agilex Github Header file

Another popular choice is to implement Runge-Kutta yourself using open-source tool for nonlinear optimization and algorithmic differentiation: Casadi like in this example, see this code snippet:

dt = T/N; % length of a control interval
for k=1:N % loop over control intervals
% Runge-Kutta 4 integration
k1 = f(X(:,k),         U(:,k));
k2 = f(X(:,k)+dt/2*k1, U(:,k));
k3 = f(X(:,k)+dt/2*k2, U(:,k));
k4 = f(X(:,k)+dt*k3,   U(:,k));
x_next = X(:,k) + dt/6*(k1+2*k2+2*k3+k4);
opti.subject_to(X(:,k+1)==x_next); % close the gaps
end
`

where essentially you "only" need to know the differential equations for your kinematics.

• I do not have much experience with kinematics but what i know is the are 2 types of kinematic solvers, numerical(solves automatically) and analytical(we need to derive its equations, fast as compared to numerical). Now in your answer, I am unable to understand what does differential equations has to do with kinematics? Commented Jun 12 at 1:41
• Will edit my answer accordingly. Commented Jun 12 at 5:50
• @Pratham please consider the edited answer. Commented Jun 12 at 9:39
• Can't we have an Analytical solution instead of a numerical one? I have found some on the internet. Have updated the question with those equations under update section. These are most likely inverse kinematics equation for a 4 wheel holonomic drive(mecanum wheel). Commented Jun 13 at 4:32
• Yes, as I said: for linear ODEs you can have an analytical solution. Your ODE is linear in it's components. This is probably due to linearization of the "true" ODE describing your system. Please read any lecture/book on ODEs and solving them: there is a math.stackexchange.com book recommendation Your question exceeds what can be answered well within this context. Commented Jun 13 at 7:32