Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Assets APE - DeepMotion Avatar Physics Engine for Robust Joints and Powerful Motors

Discussion in 'Works In Progress' started by DeepMotionPhysics, Jul 31, 2014.

  1. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Joints to the Physics Engine are like Shaders to the Rendering Engine. They are the fundamental building blocks to construct advanced physics models for games including cars, tanks, robots, mechs, powered ragdolls, construction vehicles, monster trucks, heavy weight machinery, ropes, bridges, virtual creatures, ..., etc. The default Unity physics engine, PhysX, unfortunately works very poorly with articulated multi-rigid body models consisted of multiple joints. The joints simulated by PhysX are springy and unstable under big mass ratio configuration. And it becomes even worse when the joints are powered by motors under huge torques. Things just go crazy when you stack too many joints in one model with PhysX. The lack of high fidelity articulated physics support often manifest as the following problems:
    • Two rigidly joined rigid bodies can be pulled apart under huge force
    • Mass ratio between two joined rigid bodies is limited to less than 1:10 in order to maintain joint stability
    • Heavy weight at the end of a long rope makes the rope springy, jumpy and unstable
    • Motors are soft and cannot deliver enough power to drive multi-level articulated robotics
    • Doors, hands, wheels wobble around their joint axis under heavy load
    • Simulation step size (time interval) has to be reduced to too small to provide the needed accuracy which kills the performance
    I'm working on a brand new APE : Advanced Physics Engine for Robust Joints to solve all these problems from their root - robust joint simulation. Here are a few video clips of early prototype. Sorry for the poor rendering quality and rough edges in the models. I barely had any time polishing the demos yet.

    1. Motorized Arm - PhysX vs Articulated Physics

    All the segments of the arms are assembled with actuated hinge (revolute) joints. The motor max force of the PhysX assembly is set to the maximum. The motor max force of the Articulated Physics assembly is set to 100. The mass ratio between the parts are proportional to their volumes. As we can see PhysX motors couldn't output enough power and drive the multi joints arm stably while APE drove the motors smoothly with no problem. Under the disturbance of an external spring force exerted by the author interactively PhysX model behaves like a rubber band while APE holds the hinge joints rigidly even under extreme stress.



    2. Monster Truck - PhysX vs Articulated Physics

    All the 3 monster trucks were modeled with identical topology. The right-most truck was simulated by articulated physics with mass ratio of 1: 15: 40 between struct, wheel and torso. The left-most truck was simulated by PhysX of Unity 4.5.2 with mass ratio 1: 15: 40 and it entirely collapsed to the ground even though the springs on the struts were configured to the maximum limit. The middle truck was simulated by PhysX with a reduced mass ratio at 1: 15: 1 to lessen the pressure on the joints at a cost of less torso stability. Also the hinge motors on the middle car were set to the maximum to propel truck onto the stairs. Even so it crawled extremely slow and couldn't climb up the stairs. The right-most truck simulated by Articulated Physics engine climbed up and down the stairs at ease. There was zero joint wobbling and the motors output tremendous amount of torque with great stability.



    3. Monster Truck Prototype - Articulated Physics

    It is a monster truck chassis prototype of 4 independent suspension structs, decoupled front-wheel steering and 4WD. This is realtime physics simulation of the actual rubber-on-the-ground wheel collision, mechanical suspension and steering. No ray-casting, key-frame animation or special force accumulation scripts were used. Compared to the canned typical raycast vehicle model (aka wheel collider) this simple model simulate the real physics of the interaction of monster truck suspension, wheels and the complex terrain. It's very hard if not impossible to fake such interaction with a single rigid body plus 4 ray-cast "wheels".



    4. Articulated Spider
    Besides mechanical machines APE can model and simulate articulated creatures too. The following is a quick demo of an articulated spider simulated by APE.



    The spider has 8 ball socket joints at its shoulders and 8 hinge joints at its knees and 2 ball joints at its eye balls and 1 ball joint between the butt and the torso. All together it has 8 * 3 + 8 + 2 + 1 = 35 DOF (degree of freedom). The 24 DOF at the shoulders and knees are powered by APE velocity controlled position motors.

    The simulation was fully dynamics and done in Unity editor in real-time. No key frame animations or kinematic motion. Occasionally I dragged the spider around with a dynamic spring force applied between the spider and the mouse cursor to spice things up a little bit.

    Currently only a trivial 4-phase walk controller was implemented in C#. We can easily extend the script to teach the spider more gaits such as jump and turn. The topology of the spider needs some work too to balance the butt with the torso better and reduce the yaw during walk. What's cool about APE editor is that you can generate the physics based motion controller using ID (Inverse Dynamics).

    5. Multi-Rope Crane
    This multi-rope crane model is very challenging to simulate because :
    1) There are five ropes in the mechanism that form 4 loops in the topology which means error accumulation can go extremely fast if a tiny inaccuracy in the joints surfaces.
    2) The cargo box is extremely heavy compared to the rope. The mass ratio between the cargo box and a rope segment is 500:1.
    3) This is a heavily articulated mechanism. The ropes are simulated with 64 rigid bodies in capsule shapes interconnected with 64 ball joints.
    It was said it's impossible to simulate such mechanism with the built-in physics engine.



    What do you think ? What's your experience modeling challenging articulated multi-body mechanisms with the default PhysX engine ? Will APE be of interest to you ?

    Thanks
    A. P.
     
    Last edited: May 7, 2015
    Alverik, Bryarey, Jovssen and 3 others like this.
  2. Sven-Frankson

    Sven-Frankson

    Joined:
    May 29, 2014
    Posts:
    27
    shaderop likes this.
  3. chrisso

    chrisso

    Joined:
    Sep 4, 2012
    Posts:
    139
    Looks good! I think it's very interesting and would be handy in many situations. I would consider using something like this if it's performance is equal to or better than PhysX, and if it can physically cooperate with PhysX.

    Regardless, I would still like to know how you've implemented this. :)
     
  4. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Hi Sven

    Thank you for the link which is the official guide line to advise against mass ratio smaller than 0.1 or larger than 10 because otherwise it makes the default physics engine unstable.

    This is the exact limitation I'm trying to break. When you model real world mechanisms you don't have a constraint of mass ratio and you actually have no control on the mass in an object. In games, yes, we can fake the mass to be 1.0 everywhere to make the engine happier but that means unrealistic simulation and it can look bad. I will post a simple video to demonstrate this point later.

    A.P.

     
    Nanako likes this.
  5. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    The demo videos were made with PhysX and Articulated Physics running in the same scene. So yes, they can co-exist. You can even make the same object simulated by both engines if you mark it as "kinematic" in one engine and "dynamic" in the other. You don't want
    to simulated the same object as dynamic rigid body because they will fight to change its transform by definition.

    The engine is written in native C++ code and optimized for mobile performance. For articulated multi-body simulation it will out perform the default engine and deliver the joint accuracy that the latter cannot. For huge pile of boxes scenes it will run at the similar speed as the built in engine because it's not optimized for that. If all your need is to drop a huge pile of single rigid bodies on the floor with no joints to constrain the body-body motion you don't need Articulated Physics.

    Joints to physics engine are like shaders to graphics engine. IMO it's the joints that bring life to an other wise boring discrete rigid body world.
     
  6. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,112
    Nice, can this be used to correlate mass ratio to realworld measurements?
     
  7. chrisso

    chrisso

    Joined:
    Sep 4, 2012
    Posts:
    139
    Thanks for the response. It's clear that both systems can exist the in the same scene. I'm curious if an Articulated Physics object can interact (collide and apply force) to default rigidbody, and vice versa. And if, for instance, you metered the computational load (performance) of each of the motorized arms in your second demonstration, which system would perform faster?
     
  8. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    You bet! You can pick a unit system, for example, meter/kilogram/second, and feed in real-world measurement data to your physical models built with the articulated physics engine and see how it simulates it out. The problem of hacking mass of all parts in the virtual model to be 1.0 or similar scale is that their center of mass and moment of inertia will be fake and unrealistic which can look weird sometime. For example you may feel that vehicles in game are floaty and not turn and suspend with enough weight on it.
     
    Nanako and John-G like this.
  9. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    It's unclear to me whether you asked the CPU load of the default physics simulation vs the articulated physics simulation or the amount of torque exerted at the joints by both physical engines. Assuming it's the latter here is more details:

    For the "motorized arm" demo the mechanisms simulated by both engines are setup with the exactly same masses and joint coordinates. The maximum motor force set into the PhysX simulated model is 1e+20. Apparently PhysX internally capped the max torque and it has no effect once you set the max motor force to something higher than 1e+5 or so. I think the reason of the internal cap of maximum motor force by PhysX is to ensure simulation stability cause it's more challenging to stabilize an articulated system under the stress of larger forces/torques. The maximum motor force set to the ArticulatedPhysics model is only 1000 and as you can see it's enough to drive the arm stably. There is still a big header room to the max torque of the articulated physics mechanism which means you can make the arm much longer and still expect the Articulated Physics engine to exert enough power to drive the load without crazy wobbling.
     
    Last edited: Jul 31, 2014
  10. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    A new demo video of a simple monster truck articulated physics model simulated with Articulated Physics Engine. Sorry for the blank textures and rough models. I sketched it in a couple of hours just to test basic prismatic suspension joints and steering motors of the Articulated Physics Engine.



    It is a monster truck chassis prototype of 4 independent suspension struts, decoupled front-wheel steering and 4WD. This is realtime physics simulation of the actual rubber-on-the-ground wheel collision, mechanical suspension and steering. No ray-casting, key-frame animation or special force accumulation scripts were used. Compared to the canned typical raycast vehicle model (aka wheel collider) this simple model simulate the real physics of the interaction of monster truck suspension, wheels and the complex terrain. It's very hard if not impossible to fake such interaction with a single rigid body plus 4 ray-cast "wheels".
     
    Last edited: Aug 2, 2014
    John-G likes this.
  11. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,112
    Impressive. Any estimate on release?
     
  12. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    No estimate yet. Definitely will use it in some games.
     
  13. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    A new demo video comparing the monster truck articulated model simulated by PhysX vs Articulated Physics:



    All the 3 monster trucks were modeled with identical topology. The right-most truck was simulated by articulated physics with mass ratio of 1: 15: 40 between struct, wheel and torso. The left-most truck was simulated by PhysX of Unity 4.5.2 with mass ratio 1: 15: 40 and it entirely collapsed to the ground even though the springs on the struts were configured to the maximum limit. The middle truck was simulated by PhysX with a reduced mass ratio at 1: 15: 1 to lessen the pressure on the joints at a cost of less torso stability. Also the hinge motors on the middle car were set to the maximum to propel truck onto the stairs. Even so it crawled extremely slow and couldn't climb up the stairs. The right-most truck simulated by Articulated Physics engine climbed up and down the stairs at ease. There was zero joint wobbling and the motors output tremendous amount of torque with great stability.
     
    John-G likes this.
  14. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,563
    Why not a web demo? Not like these are shaders or anything. :)
     
  15. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    418
    Hey, I'm interested to use it on a Crane Game. Do you think it will be possible?
     
  16. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    More than possible since Crane is a like a nickname of an articulated physical machine :) Are there particular simulation challenges in the crane model you envisioned ? Did you try the built-in physics already and find it insufficient in your use case ? I think it will be challenging to build a long crane arm with multi level of joints (both revolute and prismatic) enduring huge torques with the built-in physics engine. I should probably build a crane model to validate that.
     
  17. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    418
    I want to create this kind of thing, with another cables on the cargo. Take a look on the picture. I tried with the built-in physics without success. Please tell me if this is possible ( I hope yes ).

     
  18. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Sounds a good idea. Will give it a try.
     
  19. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Hi Emergki,

    Here is a video of the multi-rope crane model you described simulated by Articulated Physics Engine captured in realtime.


    This mechanism is very challenging to simulate because:
    1) There are five ropes in the mechanism that form four loops in the topology which means error accumulation can go extremely fast if a tiny inaccuracy in the joints surfaces.
    2) The cargo box is extremely heavy compared to the rope. The mass ratio between the cargo box and a rope segment is 500:1. I was told such
    3) This is a heavily articulated mechanism. The ropes are simulated with 64 rigid bodies in capsule shapes interconnected with 64 ball joints.

    Have fun,
    A.P.
     
    Last edited: Aug 8, 2014
    emergki likes this.
  20. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    418
    Hey my friend, thank you for the video and your work on this.
    I have some another questions:

    The middle cable just needs to be conected to the another 4 cables, not with the cargo box, this is possible or not?
    Do you think that is possible to make the rope more "firm"?
    Is possible to increase/decrease the size of the rope?
     
    Last edited: Aug 8, 2014
  21. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Sure, I can build a model without the middle cable connected to the box and see how it goes. Do you want to change the volume of the collision shape of the rope segments or you just want to make the rope longer / shorter ? I'm not sure I understand the second question. Are you concerned that if the rope is longer/shorter/thinner/thicker the simulation will become unstable ? If you have a specific size you want to test I can give it a try.
     
  22. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Hi Emergki

    Rebuilt a model simulated by the Articulated Physics Engine as shown in the following video. This new crane model was pushed to the extreme with the following modifications:

    1) Reduce from 5 ropes weight attachments to 4 ropes
    2) Increased the main rope's length for an additional 5 segments
    3) Increased the mass ratio between a single rope segment and the cargo box to 1:1000. No commercial physics engines I've used before handle such HUGE mass ratio between joined rigid bodies. The common guideline for physics engines is less than 1:10. Literally you're lifting a ton with a kilogram ! This is probably overkill for most games. However if you do want to simulate extremely heavy weight sensation, here you go!



    A.P.
     
    Last edited: Apr 9, 2016
    John-G likes this.
  23. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    418
    Great! Thank you!
    But, can I increase the rope size in Realtime?
    When it will be available to purchase? Price?
     
  24. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Do you mean changing the length of the ropes (like unrolling it from a coil) or changing the collision shape size of the rope segments in realtime ? The former should work and the latter is not currently supported. It's difficult but not impossible since we need re-populate the model with new collision shapes and mass properties while collision detection is on-going. Based on the exact game play needs it's probably easy to work around it by changing the model into "kinematic" first, change the collision shapes, and then flip it back to "dynamics".
    The release date depends on the interest level of the community and the required feature set. Releasing an engine to the public requires a lot more work like UI polishing, fault tolerance, document etc than using it for internal development. But all options are open to me. What is a reasonable price IYO ?
     
  25. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    A friend showed the following video he made with PhysX 3.3 in UE4 (Unreal Engine 4):


    This is a torture test for the rope because of the high speed collision between the bullets and the highly articulated rope under the stress of a heavy box. In the second half of the video PhysX "projection" was turned on the remove the gaps at joints in the rope however it's a hack to teleport the joined bodies to their constraint space without collision detection. The artifacts were severe as shown in the video that caused jerky motion and interpenetration of rigid bodies.

    I made a similar scene using Articulated Physics Engine and Unity 4.5 as the following:


    As we can see in case of APE there are no gaps at the joints even under heavy stress and it was pretty stable. The mass ratio in my video between a rope segment and the box is 1:50

    A.P.
     
    Last edited: Aug 11, 2014
    John-G likes this.
  26. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    498
    So from my understanding physx is good for rigid bodies and articulated physics is good for joints?
     
  27. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    418
    Hi, I mean changing the length of the rope, like unrolling it.

    About the price I don't know but, I had purchased another "ropes" from AS and I'm very disapointed with. But I see a huge potential in your APE, I'm really want to purchase it. I don't need you to finish it, if you can send it to me before release, I can pay you with PayPal.
     
  28. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Just my curiosity, is this an implementation of Featherstone algorithm? Never had a chance to try it, but I see it becomes more and more popular these days.
     
  29. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    @blueivy: that's correct.
     
  30. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Thank you for the support, Emergki. There is still a lot to do. But I'll make sure you are the first to know when it's ready for public taste.
     
    emergki likes this.
  31. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    418
    Thank you!
     
  32. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Just improved simulation accuracy and stability to the next level. Previously we showed a shooting at rope demo with mass ratio 50:1. Now we can shoot at ropes with huge mass ratios such as 1000:1 as shown in the following video ! Other game physics engines often diverge at mass ratio bigger than 10:1 and couldn't give realistic bounce off when ropes are hit by high speed projectiles. APE here bounced bullets off the ropes at different velocities based on how tight each rope was pulled by its weight. This demonstrated that we were simulating the entire articulated chain as one system and propagated forces through the chain instantaneously - which is almost impossible with iterative solvers typically seen in other engines.

     
    Last edited: Aug 16, 2014
    emergki, John-G and blueivy like this.
  33. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    498
    Wow! :O That's awesome! :D
     
  34. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,112
    Just keeps getting better. :)
     
  35. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    Is it possible to make the ropes look like actual ropes (i.e. dynamically deforming geometry around the joints) ?
     
  36. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Subscribed. Very interesting, in particular your solution to the PhysX rope issues. Will you make this tool public? Rough idea on cost? What version(s) of Unity will it work with? I have a 3.5 project that is screaming for this tool. :)
     
  37. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    @Zeblote: Sure it's possible. In the video the capsules are the rigid bodies (bones) of the rope and I didn't use any skinned mesh to show the physics internals. We can certainly attach skinned mesh with real rope textures to give it more look of rope. I'll give it a try when I get time.
     
  38. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    @bigkahuna: I'm open to a release if demand is strong. Now I have many more features to add. Top on my list is "Visual Joint Editor" so that you can visually assemble rigid bodies with various joint types in the scene view without punching magic pivot/axis coordinates numbers in the inspector. Even to people with strong linear algbra background it's a pain to waste a few backs of envelopes to do the math every time you assemble a robot or a rope.

    Currently it's tested with Unity 4.3 and 4.5, both Pro and Free versions on Mac, Windows and iOS. Shouldn't be a problem to port it to more platforms such as Android and more Unity versions such as 3.5 (seriously, you're still on 3.5, huh?)
     
  39. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    That's awesome! Now another question, can you roll the ropes around wheels with weight attached at the end? Like a pulley? I tried that once with physx but that didn't work at all, rope just fell through the wheel and glitched out.
     
  40. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    @Zeblote: You had to push it to the edge, didn't you ? Seriously no one in games I saw attempted to actually simulate the coil. Tricks people did include making the rope around the coil "kinematic" and just for the look and dynamically insert / removal segments to the vertical part of the rope. However this is fake "coil" and not full dynamics simulation of coil/rope/weight interaction. To dynamically simulate the full rope especially the segments around the coil in real-time under a ver heavy weight attached at the end is extremely challenging, nearly impossible in most physics engines, however it's possible in APE as shown in the following footage:



    It has 32 dynamics bodies and 32 ball joints. The mass ratio between a rope segment and the weight is 1:100. I put it together quickly. It's not perfect and still performance heavy. In reality I don't think you want simulate a long rope of a few hundreds of segments being rolled up to a coil with a heavy weight like this. However a handful of segments like in the video is possible with APE.
     
    Zeblote and John-G like this.
  41. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    498
    I love how each video you're just breaking down new barriers with what you're doing! Keep it up :)
     
  42. Aieth

    Aieth

    Joined:
    Apr 13, 2013
    Posts:
    805
    I have to admit, I'm pretty damn impressed by now ;) Good job, keep it up
     
  43. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    That's even more awesome!

    I must have this when it's done.
     
  44. BlinksTale

    BlinksTale

    Joined:
    Dec 15, 2013
    Posts:
    1
    This is ridiculously impressive. But given the basis of instantaneous instead of iterative physics, and an emphasis on joints instead of rigidbodies, why not express that in the name?

    I clicked the link to this thread because I'm looking for visual feedback representing stress on joints (so if someone's rope is about to split, you can see it), and "Articulated" expresses that to me. If you said "Enhanced Joint Physics Engine" or "Joint Focused Physics Engine" then that would have caught my eye much sooner, as I've run into plenty of problems with PhysX's limitations on joints.

    The project is awesome though, and I can't wait to see this on the store. Everyone seems to be throwing their own tests in here, so I'll throw in mine (and a rather processor intensive one): does it work on mobile?
     
  45. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Hi BlinksTale,

    Thank you for the feedback on the subject. Now I renamed it based on your input. Does it look more appealing / accurate to you ? The word "articulated" was originated from the term of articulated rigid body system in the mechanics/robotics literature. But I can see how it sounds vague and less definitive to the gaming community.

    What is the test you'd like to see ? Are you asking for a "breakable" joint feature or a tension sensor at the joints of a rope that you can read back ? PhysX already supports breakable joint with a preset force value. Does that not work for you?
     
  46. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Just implemented ray-casting and mouse spring APIs with which I can test the APE simulation with external forces exerted by mouse click and drag easily. With these I re-created the 5-link-hinge demo comparing PhysX and APE's basic joint rigidity as shown in the following video:



    Two 5-link-hinge mechanisms simulated by APE (articulated physics engine) and PhysX respectively. Both are configured with a constant velocity motor force at their joints. Under the disturbance of an external spring force exerted by the author interactively PhysX's rigid hinge joints are not rigid at all while APE holds its rigid hinge joints tightly even under heavy stress.
     
    Zeblote and John-G like this.
  47. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Besides mechanical machines APE can model and simulate articulated creatures too. The following is a quick demo of an articulated spider simulated by APE.



    The spider has 8 ball socket joints at its shoulders and 8 hinge joints at its knees and 2 ball joints at its eye balls and 1 ball joint between the butt and the torso. All together it has 8 * 3 + 8 + 2 + 1 = 35 DOF (degree of freedom). The 24 DOF at the shoulders and knees are powered by APE velocity controlled position motors.

    The simulation was fully dynamics and done in Unity editor in real-time. No key frame animations or kinematic motion. Occasionally I dragged the spider around with a dynamic spring force applied between the spider and the mouse cursor to spice things up a little bit.

    Currently only a trivial 4-phase walk controller was implemented in C#. We can easily extend the script to teach the spider more gaits such as jump and turn. The topology of the spider needs some work too to balance the butt with the torso better and reduce the yaw during walk. What's cool about APE editor is that you can generate the physics based motion controller using ID (Inverse Dynamics). I'll explain how ID was used to create the spider's motion controller later if anyone is interested.
     
    Last edited: Sep 17, 2014
    John-G likes this.
  48. crag

    crag

    Joined:
    Dec 13, 2013
    Posts:
    145
    Awesome... I am looking forward to its release to look under the hood (if you package with the code, of course).

    Question: I've been working with hinge joint motors for a while now and was wondering what sort of top speed or max torque you've been attempting with your vehicle without flipping it?
     
  49. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Hi Crag,
    I hope we can release a build before the year end. All the C# code will be packaged that includes most of the modeling code and all of the editor code plus scripting APIs to control all sorts of drive modes and sensors on the motors and joints.
    The max speed and torque on motors heavily depend on the specific model. If you give me a simplified model of the things you have in mind maybe I can probably test it out for you. In general the max torque/speed APE can sustain are magnitudes higher than what PhysX can sustain. You may noticed already that with PhysX the "max force/torque" on hinges started to get clamped very quickly when you increase them. If you check out demo #2 of the 1st post in this thread you get an idea how the motor strength is compared to PhysX in a simplified monster truck build. The bottom line is rigid joints simulated by APE never come apart :)

    A.P.
     
  50. DeepMotionPhysics

    DeepMotionPhysics

    Joined:
    Jul 31, 2014
    Posts:
    239
    Re-balanced the spider's physical model to reduce the wiggling and increased the speed:
    • Added feet to the back legs
    • Replaced the ball joint between the torso and the butt by a hinge joint and added a hinge spring
    • Aligned the feet to ground clearance during the walking gait
    Added some controls to the articulated spider model simulated by APE. Still very rough, but totally physical
    • Speed Up/Down by shorten/lengthen the walk cycle
    • Turn Left/Right by increasing the right/left side step sizes, decreasing the left/right side step sizes and swinging the butt to the right/left side
     
    Last edited: Sep 20, 2014