Meant to be Seenhttps://www.mtbs3d.com/phpbb/ Select Curve with a Joystick Axishttps://www.mtbs3d.com/phpbb/viewtopic.php?f=139&t=22804 Page 1 of 1

 Author: Billhelm [ Fri Apr 27, 2018 5:11 pm ] Post subject: Select Curve with a Joystick Axis Hello,I'm trying to use a joystick slider/axis as a curve select. I've tried the following and got a syntax error:Code:if joystick.sliders in range (0, 204.8):   x = Cyclic.1.getY(joystick.x)   y = Cyclic.1.getY(joystick.y)   z = Rudder.1.getY(joystick.zRotation)if joystick.sliders in range (204.9, 409.6):   x = Cyclic.2.getY(joystick.x)   y = Cyclic.2.getY(joystick.y)   z = Rudder.2.getY(joystick.zRotation)if joystick.sliders in range (409.7, 614.4):   x = Cyclic.3.getY(joystick.x)   y = Cyclic.3.getY(joystick.y)   z = Rudder.3.getY(joystick.zRotation)if joystick.sliders in range (614.5, 819.2):   x = Cyclic.4.getY(joystick.x)   y = Cyclic.4.getY(joystick.y)   z = Rudder.4.getY(joystick.zRotation)if joystick.sliders in range (819.3, 1024):   x = Cyclic.5.getY(joystick.x)   y = Cyclic.5.getY(joystick.y)   z = Rudder.5.getY(joystick.zRotation)if joystick.sliders in range (1024.1, 1228.8):   x = Cyclic.6.getY(joystick.x)   y = Cyclic.6.getY(joystick.y)   z = Rudder.6.getY(joystick.zRotation)if joystick.sliders in range (1228.9, 1433.6):   x = Cyclic.7.getY(joystick.x)   y = Cyclic.7.getY(joystick.y)   z = Rudder.7.getY(joystick.zRotation)if joystick.sliders in range (1433.7, 1638.4):   x = Cyclic.8.getY(joystick.x)   y = Cyclic.8.getY(joystick.y)   z = Rudder.8.getY(joystick.zRotation)if joystick.sliders in range (1638.5, 1843.2):   x = Cyclic.9.getY(joystick.x)   y = Cyclic.9.getY(joystick.y)   z = Rudder.9.getY(joystick.zRotation)if joystick.sliders in range (1843.3, 2048):   x = Cyclic.getY(joystick.x)   y = Cyclic.getY(joystick.y)   z = Rudder.getY(joystick.zRotation)I have 10 curves and I'm trying to divide the slider into 10 positions. In this case the 0-204.8 range would be the least aggressive curve, and 1843.3-2048 would be the most aggressive curve, with each curve becoming progressively more aggressive. I feel like I'm almost barking up the right tree, but my syntax is definitely wrong. Does anyone have any suggestions?

 Author: Jabberwock [ Sat Apr 28, 2018 9:27 am ] Post subject: Re: Select Curve with a Joystick Axis Is 'Cyclic.1' a valid curve name? Maybe that is what causes the syntax error?

 Author: FrenchyKiel [ Sat Apr 28, 2018 2:33 pm ] Post subject: Re: Select Curve with a Joystick Axis maybe range function is not right herei dont write thisif joystick.sliders in range (0, 204.8):butCode:value = joystick.slidersif  0 <= value < 204.9):   x = Cyclic.1.getY(joystick.x)   y = Cyclic.1.getY(joystick.y)   z = Rudder.1.getY(joystick.zRotation)if  204.9 <= value < 409.6):   x = Cyclic.2.getY(joystick.x)   y = Cyclic.2.getY(joystick.y)   z = Rudder.2.getY(joystick.zRotation)and so on

 Author: Billhelm [ Sun Apr 29, 2018 12:27 pm ] Post subject: Re: Select Curve with a Joystick Axis Thanks for the suggestions. Having dots in the names of the curves was a problem, and so was the way that I was trying to define ranges. Here is my current code, which is now working as expected.Code:slider = joystick.slidersif  (0 <= slider <= 204.8):   x = Cyclic100.getY(joystick.x)   y = Cyclic100.getY(joystick.y)   z = Rudder100.getY(joystick.zRotation)if (204.9 <= slider <= 409.6):   x = Cyclic90.getY(joystick.x)   y = Cyclic90.getY(joystick.y)   z = Rudder90.getY(joystick.zRotation)if (409.7 <= slider <= 614.4):   x = Cyclic80.getY(joystick.x)   y = Cyclic80.getY(joystick.y)   z = Rudder80.getY(joystick.zRotation)if (614.5 <= slider <= 819.2):   x = Cyclic70.getY(joystick.x)   y = Cyclic70.getY(joystick.y)   z = Rudder70.getY(joystick.zRotation)if (819.3 <= slider <= 1024):   x = Cyclic60.getY(joystick.x)   y = Cyclic60.getY(joystick.y)   z = Rudder60.getY(joystick.zRotation)if (1024.1 <= slider <= 1228.8):   x = Cyclic50.getY(joystick.x)   y = Cyclic50.getY(joystick.y)   z = Rudder50.getY(joystick.zRotation)if (1228.9 <= slider <= 1433.6):   x = Cyclic40.getY(joystick.x)   y = Cyclic40.getY(joystick.y)   z = Rudder40.getY(joystick.zRotation)if (1433.7 <= slider <= 1638.4):   x = Cyclic30.getY(joystick.x)   y = Cyclic30.getY(joystick.y)   z = Rudder30.getY(joystick.zRotation)if (1638.5 <= slider <= 1843.2):   x = Cyclic20.getY(joystick.x)   y = Cyclic20.getY(joystick.y)   z = Rudder20.getY(joystick.zRotation)if (1843.3 <= slider <= 2048):   x = Cyclic10.getY(joystick.x)   y = Cyclic10.getY(joystick.y)   z = Rudder10.getY(joystick.zRotation)I'm making progress, but the behavior is still not quite right. The problem seems to be with the curves themselves. I've defined a series of curves to limit output when given maximum input. As an example, here's my least aggressive cyclic curve.Code:          Cyclic10                        0          921.6                          42.5          937.8                          98.3          952.7                          167.4          966.3                          249.9          978.5                          345.6          989.4                          454.7          999                          577          1007.3                          712.7          1014.2                          861.7          1019.8                          1024          1024                          1186.3          1028.2                          1335.3          1033.8                          1471          1040.7                          1593.3          1049                          1702.4          1058.6                          1798.1          1069.5                          1880.6          1081.7                          1949.7          1095.3                          2005.5          1110.2                          2048          1126.4                    true    Despite the first point being defined as 0,921.6, it seems to behave as if the first point is 0,0. As a result, moving the stick full right or full down limits the output range, but moving the stick full left or full up does not. The curve is limiting the output range effectively until full deflection, at which point it abruptly transitions from limited output to full. I've tried a few hacks at limiting the range, but none of my efforts have succeeded. Any ideas?

 Author: CyberVillain [ Mon Jun 11, 2018 3:52 am ] Post subject: Re: Select Curve with a Joystick Axis There was a bug with the curve math, its fixed in this commithttps://github.com/AndersMalmgren/FreeP ... 569d02a155

 Page 1 of 1 All times are UTC - 6 hours Powered by phpBB® Forum Software © phpBB Grouphttp://www.phpbb.com/