Conversation
|
I've merged these changes into the branch I made two fixes to your code: the y and z axes were swapped in the output (should be x = pitch, y = yaw, z = roll) Could you try out the latest build on Travis to confirm this works correctly? I've done some reasonably thorough testing and it all seems to check out, but good to get someone else to check! |
|
Travis built dev version with these changes is here: https://krpc.s3.amazonaws.com/deploy/bug/rcs-torque/1370/krpc-0.4.9-132-g5b87d7f.zip |
|
It works. And you are right, the axes were switched. And without negative values I wonder how it worked for me. Oh, well. |
|
Cool! I'll merge it to master then. Thanks |
|
I was doing some more testing and was getting strange results when the thruster was placed such that it produced torque around more than one axis (for example when I tested with a single RCS thruster it was somehow able to produce both positive and negative torque around the same axis which is impossible). Looks like the original code splits up the components of the cross product (as torque = pos x force), but that isn't quite right - not sure why you did it that way? I get better results with the following: |
|
Related to #354 |
I think if I calculated the cross product I'd have to deal with calculating an angle between two vectors. And then I would still have to take a product's components individually since just summarising cross poducts for every thruster would result in a vector with a magnitude 0. Otherwise I would have to find a way to distribute vectors by their contribution to positive or negative torque. |
|
You don't need to compute angles or do any trigonometry to compute a cross product. The part I don't think was right was just the torque calculation inside the loop. I agree that we want to compute the torque vector of each thruster separately, and extract the component around the pitch, yaw, roll axes and add them to the overall positive and negative torques as appropriate. To explain the code I have merged into master:
The difference is that your code computes the following torque contributions:
Looks like you separated the cross product equations into two parts (e.g. splitting up Also, your code doesn't really make intuitive sense. If you had a single thruster, the code can produce torque values where the thruster can produce a torque around in both a positive and negative direction around a single axis. But a single thruster can only induce a torque in one direction around a given axis. |
|
Maybe best to chat on discord if this doesn't make sense? |
No description provided.