Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Setting exact cable lengths and getting cable forces
#1
Hello,

I have 3 questions I would like to get clarified.


   



1 - Setting exact cable lengths


In one of my earlier questions you mentioned that,



"The actual -calculated- length of a rope always strives to be its rest length, so this is the intended result: in your case, c2_len will strive to be as close as possible to restLength.



Imagine you have a rope that's 5 meters long at rest (under no forces). Then you hang a heavy object from it, and the rope stretches to be 5.2 meters long. Its restLength is still 5, but CalculatedLength() would return 5.2.



If you now call cursor.ChangeLength(6), the rope's restLength is set to 6, but due to the force applied by the object hanging from it its CalculatedLength() might be 6.2 (or 6.5, 7, 8.2... depending on how many substeps are used and how compliant the rope is).





This is usually useful to calculate strain (deformation due to forces), which is the ratio between the calculated length and the rest length."



If I have a load attached to 4 cables as shown in the scene.
And If i give control inputs to the cables as [28, 28, 28, 28] where the inutial cable lengths at the start  are [25, 25, 25, 25].
I would like to have the cable lengths to be exactly [28, 28, 28, 28] but at the moment I get something like [27.830832 27.834806 27.824314 27.820284]
And If i change the cable lengths again to  [25, 25, 30, 30] the results induced more offset from the applied control input and I get [25.510212 25.506298 29.991457 29.995811].

Currently I have 100 substeps for the solver.

Would it be logical to set cable lengths until the rest lengths attain the applied control , because at the moment I am applying the control until the current length reaches the applied control

Code:
public Action SetCable1(float length, float control_ip, float velocity)
    {
        float c1_control_ip = control_ip;
        float c1_len = length;
        float c1_vel = velocity;

        return () =>
        {
            if (c1_len > c1_control_ip + cable_threshold)
            {
                cursor1.ChangeLength(c1_len - c1_vel * time_dt);
            }
            else if (c1_len < c1_control_ip - cable_threshold)
            {
                cursor1.ChangeLength(c1_len + c1_vel * time_dt);
            }
            else if (c1_len == c1_control_ip - cable_threshold)
            {
                Debug.Log("Current Length and Control input are the same for Cable 1");
                return;
            }
        };
    }


I just want to know if there is a way to set the exact cable lengths I give as control inputs.

2 - Getting Cable Forces
Also I would like to know if there is a way in Obi rope to get cable forces at the points where the cables are attached to the load object (or ideally at different points of the cables)?


3 - Controlling the attached load object
Is it possible in Obi rope to moved the attached load and the cables just extend according to the load position?
Like inverse kinematics.

Any suggestions/ advice or clarifications are greatly appreciated.


Thank You.
Reply
#2
Hi!

(26-06-2023, 05:57 AM)rohit_dhak Wrote: If I have a load attached to 4 cables as shown in the scene.
And If i give control inputs to the cables as [28, 28, 28, 28] where the inutial cable lengths at the start  are [25, 25, 25, 25].
I would like to have the cable lengths to be exactly [28, 28, 28, 28] but at the moment I get something like [27.830832 27.834806 27.824314 27.820284]
And If i change the cable lengths again to  [25, 25, 30, 30] the results induced more offset from the applied control input and I get [25.510212 25.506298 29.991457 29.995811].

That's impossible to do. To achieve an exact length of 28 given a control input of 28 you'd have to have both perfect convergence - which means the engine would have to run for an infinite amount of time - and no floating point error. You must assume there's always going to be some error between your real measure (in this case, the simulation) and your desired/target values. Same is true in the real world: for a system to match your input you'd have to have perfect sensors to measure its state and perfect actuators to modify it, but neither exist.

(26-06-2023, 05:57 AM)rohit_dhak Wrote: I just want to know if there is a way to set the exact cable lengths I give as control inputs.

Nope, that's the point of having a controller in the first place. Think of your basic PID controller: the proportional term "P" assumes there's an offset between the actual measure and the control input, and its job is to compensate for it.

If you could directly map the desired state of a system to some control input, your controller would just consist of assignment ("=") operators and we could just wipe control theory off the face of the earth Guiño.

(26-06-2023, 05:57 AM)rohit_dhak Wrote: Also I would like to know if there is a way in Obi rope to get cable forces at the points where the cables are attached to the load object (or ideally at different points of the cables)?

Yes, but I don't think this will help in your case. You can access the "lambdas" array in the constraint batches, these contain lagrange multipliers for each constraint. See:
http://obi.virtualmethodstudio.com/manua...aints.html

Also, you can take a look at the rope's ApplyTearing() method as reference/example. It checks the force at all constraints in the rope and tears it where they exceed a threshold.

(26-06-2023, 05:57 AM)rohit_dhak Wrote: Is it possible in Obi rope to moved the attached load and the cables just extend according to the load position?
Like inverse kinematics.[b]
No, as that would entirely ignore physics (momentum).

let me know if you need further help,

kind regards
Reply