Unity plugin progress?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Unity plugin progress?

Postby Julio Jerez » Tue Feb 14, 2017 5:54 pm

check out the joint demos, I added a small box car. :shock:
still do no drive but that coming as soon as I add the universal joint, or maybe we should make it a stand alone demo so that it can be driven around.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Sweenie » Wed Feb 15, 2017 10:54 am

haha, great.

I've modified the robot a bit, added one more axle and changed the hand into a simple gripper using the slider actuator.

I noticed that the actuators slowed down a little bit when reaching the target but then I saw you just fixed that.
Now the the hinge actuator feels more snappy(no slowdown) but my gripper stopped working(slider actuator).
Maybe i'm using to small target values. The gripper should move between position 0.0f to 0.3f but now it doesn't move at all.

It worked before your actuator fix though.

Also added an In-line slider crank(i think). I'm gonna use it to push boxes onto a convyer belt for the robot to pick up. Thats my plan anyway. :lol:
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Julio Jerez » Wed Feb 15, 2017 11:21 am

nice!! I love the crack

Sweenie wrote:I noticed that the actuators slowed down a little bit when reaching the target but then I saw you just fixed that.
Now the the hinge actuator feels more snappy(no slowdown) but my gripper stopped working(slider actuator).
Maybe i'm using to small target values. The gripper should move between position 0.0f to 0.3f but now it doesn't move at all.


yes I finally found what was the cause of the twitch that I saw some time around the stop position
basically when an effect reach the target the actuator stop acting as if the joint acceleration will keep the position and the velocity, but that is no the case, does to many reason, rounding error, time step, stiffness, and load the position and the velocity does change a little.

Sop I though that when the effect reach the target is should continue applying and acceleration to zero the velocity.
Seems to worked in the test a conducted, but I know this is not totally correct because the position can also drift and if that happen it will twitch. so I have to apply a better stop criteria.

I do not think that why the pallet is not moving thought, by I will check it out to se why is that.

I am adding the boxcar with a realistic electric motor that will drive the threads via a differential.

The next think we nee to do to control the robot is that instead to controlling every joint with a UI, we need to use an IK system that give the target will determine the values of the intermediate joint parameter to reach the target.
I am not sure if unity has advanced least square or pseudo in inverse IK system build in.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Sweenie » Wed Feb 15, 2017 11:53 am

Unity has some kind of IK in the Mecanim tool. I'm not sure if i could use it for my robot though. Seems strongly connected to Unitys avatar objects.

https://docs.unity3d.com/Manual/InverseKinematics.html
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Julio Jerez » Wed Feb 15, 2017 12:18 pm

umm that does not seem very good. Bu the parameters seems CCD nonsense.
let us not worry for now, because this is part of the my next project.
I will add a function to the joint library that will calculate a vector of torque, position or velocities given an input vectors.
I will use this for the balancing ragdoll. but we can start using for the robots.
hopefully we can start this next week.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Sweenie » Wed Feb 15, 2017 1:57 pm

The slider actuator is working.

It was my speed setting that was completely wrong.

On the robot hingeactuators I use an angle rate of 50 degrees per second.

Then I set 50 on the speed parameter for the slideractuator. But i just realized that for the slider its probably m/s. 50 ms/s is 180 km/h(~112 mph).
Maybe a little too fast for a gripper i think. :oops:

So I changed to 1 m/s and now it works. :D
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Julio Jerez » Wed Feb 15, 2017 2:23 pm

cool, did you check in?
I tried to play the robot scene and I am getting a crash on exit, no sure what is wrong,
is not happing to other scenes and was not there this morning.

still the fix I added to prevent the twitching when the effector reach the end need to be fixed.
it is actually very simple fix I am doing it now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Sweenie » Wed Feb 15, 2017 2:31 pm

Actually something weird is happening, at least for me.

I created the robotdemo as a standalone demo.

It runs well until the robot touch a rigid body, then the demo crash.
Likewise if the crank touch the rigid body it crashes as well.

It doesn't crash in the editor though and the spinning actuator demo doesn't crash, but in that demo it doesn't touch any rigid body.

Here, try this and see if crashes for you too.

http://www.svenberra.net/RobotDemo.zip

Can you debug even though it uses the static newton lib?
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Julio Jerez » Wed Feb 15, 2017 2:54 pm

ok after I sync I am not crashing anymore. I actually manage to grab an lift the bar that was in the front.

some strange did happens, though the UI is no off the screen I only see the tip of the slider, did you change that.

I fixed the actuator so that now when the effect is within two time step away to the target position, it calculates an acceleration so that the correct only 10% of the position error, and set the velocity to zero, this in effect move the effector at a low pass velocity proportional to the distance error.
It seem very smooth. I will test some more before applying the same technique to all actuators.


and no I cannot no debug static library, however the NewtonWrapper is a dll that lick to newton statically, so if Unity does not do anything special to dependency dlls (some c# project protect this DLL making it imposible to attach a debuger) we should be able to attach the debugger and step in.

I will export the demo and pay before try yours,
Plase sync and try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Julio Jerez » Wed Feb 15, 2017 3:05 pm

yes I see the crash, in debug I get an assert. let me set of the debugger so that I can step in form visual studio.

The weird part is that normally assert let people call debugger, but it seem Unit has exception that interest assert and instead display a window ask you if you want to send the debug to the developer. :roll: I hate that baby sister mentality of some developers.

I hope they do no mess with debug because the only alternative is to debug the stupid dump files.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Julio Jerez » Wed Feb 15, 2017 3:12 pm

yes is perfectly possible to debug it,
the crash happen here. I got the crash and I am fixing it.
This is a very good catch.

PS: I see what is going on, is a bug is the selection of the skeleton joint.
It can be fixed from the editor, but it need to fix that bug and this is a good time to do that.
the I will tell you how to make it work but not for the wrong reasons.
is too early for work around.
I am fixing it now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Sweenie » Wed Feb 15, 2017 3:23 pm

oh, good. :)

Could it be some memory corruption?
Because I don't understand why it doesn't crash when I run the scene inside the editor but it crashes when running standalone.

On the other side, this has happened for me before with plugins in unity.
For example forgetting to delete an object but the Unity Editor doesn't crash, maybe sometimes and sometimes hang. But the standalone player seems more "sensitive" for some reason.

Hmm, this time the player "handled" the crash more nicely for some reason with a litte message on screen and created a logfolder with dumpfiles and stuff. :)
I can see the callstack inside errorlog inside...
Code: Select all
========== OUTPUTING STACK TRACE ==================

0x00007FFB66E51EAD (NewtonWrapper) [c:\newton\corelibrary_300\source\physics\dgskeletoncontainer.cpp:693] dgSkeletonContainer::InitMassMatrix
0x00007FFB66E4C109 (NewtonWrapper) [c:\newton\corelibrary_300\source\physics\dgworlddynamicssimplesolver.cpp:987]


Was the bug in dgSkeletonContainer:InitMassMatrix ?
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Julio Jerez » Wed Feb 15, 2017 5:09 pm

It is fixed now.
No it manifested as memory corruption, but is was not that.

basically when the engine build the island every contact and ever joint is added to the array if the are no connected to a static body. This has always worked,
however now that we are building the skeleton at run time, if a skeleton is connted to the NULL body (which I the engine is a sentinel static body) that become a stop, but in that scene there are tow skeleton connected to the world, but the island builder we make two separate island while the skeleton was the ring to solve but skeleton as a single island.
this all happened because he static world sentinel can no have a skeleton so I need to add a heritic to recognized the special case.

This bug has always been there and was never exposed because we I build stuff like that I do no connected then to the null body, I make a dummy root to serve as the root of the contraction of joints. this way the root can has a skeleton assigned to it.

This is a several rull that we can no inforce end user so it is fix now.

however is a good practice to make a dommy static body to connected any articulation to the body instead of leaving the other body point set to null. The reason for this is performance.
It is clear that those two robot form tow independent island. but internally because they are connect to the Null world, the form a single island.

this use more memory, and in the case of multi thread it can only be solved in one core.
so it is a recommendation not a rule.

connecting it to the world would fix the crash bug, but no the potential performance issue.

BTW I am having a blast with the robot picking objects. :mrgreen:

PS there reason why it do not crash in the editor, is because the island is a flat array of data.
so if the array has data form previous frame it will work but will generate a malfunction that will crash eventually. this are typical bug when using free list allocation and are quiet hard to fix, the best thong that happen is that It did crash.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Sweenie » Wed Feb 15, 2017 5:38 pm

Just tested and no crash. :D

Reuploaded the standalone demo if anyone wants to play with the robot.
http://www.svenberra.net/RobotDemo.zip

By the way, you mentioned you didn't see the GUI sliders completely.
Check above the render screen, there is a scale slider there, make sure it says 1.0
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Julio Jerez » Wed Feb 15, 2017 5:58 pm

yes that was the problem with the gui.
the fixed the slider and seems to work, I will apply the same to the other actuators.
then see if I can get the boxcar going.

Ok I applied the same trick to all three actuators.
Actuators made life easy, don't they?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests