## How to make a flexible cable?

Typically: "How do I... ", "How can I... " questions
squiq
Posts: 9
Joined: 18 Dec 2014, 15:22

### How to make a flexible cable?

Hello everyone,

I recently started working with V-REP and I have to say it is really an amazing program!

Im trying to make a simulation of picking up the end of a cable that is attached to the ground. I want it first to be loose, and then pick it up with a gripper and pull it tight.
In one of the demo videos I saw a flexible cable which was simulated with the use of inverse kinematics endpoint contstraints and a “desire of straightness” constraint. So I think this should be possible.

Does anyone know how I can accomplish this?

Is this a correct approach?
1. Make a cuboid with a long cylinder attached to it.
2. Adding dummies to the tip of the cylinder and link them with the IK tip-target type and select the cuboid as base.
3. Make the material flexible.

I already followed the inverse kinematics tutorial, so the first 2 steps are no problem. I’m however not sure how I should make the material flexible.

squiq

coppelia
Posts: 7388
Joined: 14 Dec 2012, 00:25

### Re: How to make a flexible cable?

Hello squiq,

the big question is whether you want your cable to be able to interact with the environment (e.g. not intersect with the floor, and obstacle, or itself, or fall to the ground (i.e. feel the effect of gravity)).

If you want interaction with the environment, which I suspect you do, then you cannot use IK.

The procedure is as follows:

What you should do is create a cable using dynamic link elements (non-static and collidable). Consecutive links should have a different collidable mask, otherwise you'll create additional constraints.

For your cable do something like:

body --> revoluteJoint --> body --> revoluteJoint --> body --> revoluteJoint --> body --> etc.

Depending on what you need, you can alternate the orientation of the revolute joints in order to achieve a bending in 2 directions. You can apply a spring behaviour to your revolute joints.

If your cable doesn't need a spring behaviour, but should more act as a rope, then use spherical joints instead of revolute joints: then you will automatically have 3 degrees of freedom between each body element. Here is an example.

Cheers

squiq
Posts: 9
Joined: 18 Dec 2014, 15:22

### Re: How to make a flexible cable?

Hello coppela,

Thanks a lot for your answer! Indeed I want my cable to interact with the environment like a rope.
I will use the spherical joints. Very helpfull!

cheers,

squiq

khagesh_bhardwaj
Posts: 2
Joined: 09 Jan 2019, 09:29
Location: Trivandrum, India

### Re: How to make a flexible cable?

Hello,
I'm working on a project related to cables, though this wasn't much related to the work, I just downloaded the file to see what it's all about. I run the simulation, it worked but once when I changed the joint motion to torque/force mode, it stopped working. So I again changed the mode to Motion mode (DEPRECATED) but it stopped working. What did I do wrong there, I didn't get that. Please help me out with that.
Thank you.

coppelia
Posts: 7388
Joined: 14 Dec 2012, 00:25

### Re: How to make a flexible cable?

This scene comes from an old version of V-REP.
To actuate the joint again, simply set it to passive mode, and then attach a non-threaded child script to that joint with following code:

Code: Select all

function sysCall_init()
h=sim.getObjectAssociatedWithScript(sim.handle_self)
da=50*math.pi/180 -- rot velocity
end

function sysCall_actuation()
local a=sim.getJointPosition(h)
a=a+da*sim.getSimulationTimeStep()
sim.setJointPosition(h,a)
end
Cheers