The following function can compute the approximate kinematic model of n-section continuum robot based on the following articles
[1] jones, b. A., & walker, i. D. (2006). Kinematics for multi-section continuum robots. Ieee transactions on robotics, 22(1), 43-55.
[2] amouri, a., zaatri, a., & mahfoudi, c. (2018). Dynamic modeling of a class of continuum manipulators in a fixed orientation. Journal of intelligent & robotic systems, 91(3), 413-424.
[3] seleem, i. A., el-hussieny, h., assal, s. F., & ishii, h. (2020). Development and stability analysis of an imitation learning-based pose planning approach for multi-section continuum robot. Ieee access, 8, 99366-99379.
[4] seleem, i. A., assal, s. F., ishii, h., & el-hussieny, h. (2019). Guided pose planning and tracking for multi-section continuum robots considering robot dynamics. Ieee access, 7, 166690-166703.
The exact kinematic model of [1] suffers from singularity if the robotic arm in straight configuration. Taylor expansion series were applied to overcome the singularity. please if you will use this code, cite the aforementioned paper from [1] to [4] to keep the author rights