In this project, it is intended to develop adeep neural network model for solving the inverse kinematics problem for the planar robotic manipulator with two revolute joints presented in Fig. 1. To train the neural network, a large dataset of joint angles and their corresponding end effector position and orientation will be needed. We will utilize the forward kinematic equations in (1) of the tackled robotic manipulator to generate this data set. Afterwards, we will train a deep network on the generated data and validate its performance on an unseen test data.
The challenge or difficulty in training a neural network to solve the inverse kinematics problem is the fact that the same end effector position (input of the neural network) can be achieved via several sets of joints variables (neural network output). In other words, the mapping between the neural network’s inputs and outputs is not one to one. This can be seen in Fig. 2 where the two-link robotic manipulator is capableof catching the same red ball, i.e., arriving at the same position, via two different joint configurations. To solve this issue, we should preprocess the data (or even change the format of the input and output data) to ensure that the function the neural network is trying to learn is one to one. One way to solve this redundacny problem is to pass the manipulator’s shape at the previous time instant as an input to the neural network. This additional input should guide the manipulator to the desired shape given that the manipulator’s motion is smooth (no sudden jumps).
We start by assuming that the range of motion of the systems’ joints is limited to
Up until now, we generated the end-effector positions
Accordingly, we now have a dataset of
The dataset is displayed in Fig. 3. The blue points in Fig. 3a represent the generated sample points in the shape space of the manipulator. These sample points map to the end-effector position space as shown in Fig. 3b. We can see from Fig. 3 that the generated dataset spans the entire shape space and motion space of the robot. For each data sample (blue point) in Fig.3a, the
The generated dataset is saved into the “output.csv” file.
We will use a fully-connected network of the following architecture:
- An input layer having
$4$ neurons. - Two hidden layers each having
$50$ neurons with Relu activation functions. - An output layer having
$2$ neurons with a linear activation.
The cost functionto be minimized is the mean square error between the predicted manipulator’s shape and the shape mapping to the end-effector’s position at the consideredtime instant. We are using Adam as an optimizer with a constant learning rate set to
The generated dataset is divided randomly into
Given a desired trajectory
Trajectory 1:
Trajectory 2:
The given trajectories are discretized over the specified time domain with a constant time step of
After predicting the manipulator’s shape for all time instants, the motion of the robot is simulated. This is implemented in the “test arm model.py” file. Snapshots of the manipulator’s motion for “Trajectory 1” and “Trajectory 2” are shown in Fig. 4 and Fig. 5, respectively.