29-03-2023, 09:36 AM
So I have a scene as shown below:
I am sending control to change cable lengths of all 4 cables at once (action = [25.23, 26.18, 35, 33.67]).
However it looks like the cable lengths are overshooting while setting and because of that
These above 2 conditions are counteracting to each other and I am getting an oscillating behavior of the system as shown in the following video.
Oscillation behavior
I am sending control to change cable lengths of all 4 cables at once (action = [25.23, 26.18, 35, 33.67]).
Code:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//|Method to control cables individually
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Method to perform control actions for cable 1
public void set_c1()
{
if (c1_len > c1_control_ip)
{
cursor_1.ChangeLength(rope_1.restLength - c1_control_ip * time_dt/10);
}
else if(c1_len < c1_control_ip)
{
cursor_1.ChangeLength(rope_1.restLength + c1_control_ip * time_dt/10);
}
else
{
Debug.Log("Current Length and Control input are the same");
}
}
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
// Method to perform control actions for cable 2
public void set_c2()
{
if (c2_len > c2_control_ip)
{
cursor_2.ChangeLength(rope_2.restLength - c2_control_ip * time_dt/10);
}
else if(c2_len < c2_control_ip)
{
cursor_2.ChangeLength(rope_2.restLength + c2_control_ip * time_dt/10);
}
else
{
Debug.Log("Current Length and Control input are the same");
}
}
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
// Method to perform control actions for cable 3
public void set_c3()
{
if (c3_len > c1_control_ip)
{
cursor_3.ChangeLength(rope_3.restLength - c3_control_ip * time_dt/10);
}
else if(c3_len < c3_control_ip)
{
cursor_3.ChangeLength(rope_3.restLength + c3_control_ip * time_dt/10);
}
else
{
Debug.Log("Current Length and Control input are the same");
}
}
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
// Method to perform control actions for cable 4
public void set_c4()
{
if (c4_len > c4_control_ip)
{
cursor_4.ChangeLength(rope_4.restLength - c4_control_ip * time_dt/10);
}
else if(c4_len < c4_control_ip)
{
cursor_4.ChangeLength(rope_4.restLength + c4_control_ip * time_dt/10);
}
else
{
Debug.Log("Current Length and Control input are the same");
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//|Method to control all cables parallely
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void set_control()
{
Parallel.Invoke(set_c1, set_c2, set_c3, set_c4);
}
However it looks like the cable lengths are overshooting while setting and because of that
Code:
if (c2_len > c2_control_ip)
{
cursor_2.ChangeLength(rope_2.restLength - c2_control_ip * time_dt/10);
}
else if(c2_len < c2_control_ip)
{
cursor_2.ChangeLength(rope_2.restLength + c2_control_ip * time_dt/10);
}
These above 2 conditions are counteracting to each other and I am getting an oscillating behavior of the system as shown in the following video.
Oscillation behavior