How to write script about Spring?

Typically: "How do I... ", "How can I... " questions
Post Reply
Elin
Posts: 8
Joined: 23 Dec 2019, 08:34

How to write script about Spring?

Post by Elin »

Hello,

I want to make a simulation like this: There is a spring standing on the floor, an object falls down on the spring, the spring shorten and the object's height reduce. Then the spring oscillations and object follows it. Because I don't know how to make the simulation of a spring's motion. So could you offer some tutorials or learning materials ?

Thanks.

fferri
Posts: 1216
Joined: 09 Sep 2013, 19:28

Re: How to write script about Spring?

Post by fferri »

If the question is about how to make a spring:
coppelia wrote: 14 Feb 2014, 10:44 For a spring, you have Hook's law: \(F=k x\)

where \(F\) is the force of a spring, \(k\) its constant, and \(x\) its displacement (or stretch/compression).

In CoppeliaSim, set your joint (let's suppose it's a prismatic joint) into torque/force mode, the motor enabled, the Control loop enabled, Position control (PID) selected, and Regulate torque/force selected. You can do all this in the joint dynamics properties.

With above settings, your joint will exert a force: \(F=F_{max} \left[x P + e I + (x-x_{previous}) D\right]\)

where \(F_{max}\) is the max. torque/force item, and \(e\) the integrated errors

Post Reply