Buoyancy - simulating disturbed medium (waves)?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Fri Apr 26, 2019 2:36 am

Hi Julio,

I ran into a bit of a problem with my setup (not with Newton). Referring to Archimedes Buoyancy sample in demoSandBox, I am getting a crash on exit, when

Code: Select all
void DestroyTrigger (dCustomTriggerController* const trigger)


is called. This is most likely due to a different setup I have, namely for my equivalent of DemoEntityManager class. The problem is, early into my project, when I started experimenting with Newton, I was looking at the demoSandBox, and I wanted to simplify things for starters (I didn't need any rendering or user interface stuff). So, I implemented a simple entity manager class that holds all my entities in a std::vector<Entity*> container. DemoEntityManager uses a dList, similar to STL. Things worked so far, but I set myself a task to, when time permits, bring this up to date and more in line with the setup used in demoEntityManager.

Well, I think this has now bitten me in the butt... Upon exiting out of my sim, I get a crash in a cleanup code for dCustomTriggerController, namely, in
Code: Select all
dCustomTriggerManager::DestroyTrigger(trigger);
and I'm pretty sure it is because of my setup.

Do you have any suggestions on how to deal with this? I can provide a call stack if it helps...
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Fri Apr 26, 2019 10:55 am

Can't you just destroy the trigger manager before exiting?
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Fri Apr 26, 2019 1:03 pm

Julio Jerez wrote:Can't you just destroy the trigger manager before exiting?


I tried (by just simply calling delete trigger;) but that didn't work.

the problem is in:

Code: Select all
void dgWorld::DestroyBody(dgBody* const body)
{
   for (dgListenerList::dgListNode* node = m_listeners.GetLast(); node; node = node->GetPrev()) {
      dgListener& listener = node->GetInfo();
      if (listener.m_onBodyDestroy) {
         listener.m_onBodyDestroy (this, node, body);
      }
   }

where m_listeners is invalid:
dgList<dgWorld::dgListener> = {m_count=??? m_first=??? m_last=??? ...}

This is deep in the Newton's inner workings and I have no idea how to handle it :roll: Obviously, something that's different in my setup is causing it.
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Thu May 02, 2019 4:27 pm

Ok - I implemented a "fake" buoyancy by adding simple cyclic sinusoidal offsets to vertical position ("bobbing") and pitch/yaw angle offsets (for in-water tilting)... and it looks GREAT! And since they are cyclic, they keep going, so that simulates the waves and solves the topic of this thread!

It would have been nice to have a real buoyancy simulated, but I just don't have time for it in this iteration, and, for all intents and purposes, after the capsule splashdown, the mission ends :mrgreen:

It is good to know that I do have an option to implement it in the future, if I wish to add some post-mission activities, like rescue, lifting capsule out of the water, etc.

In the next few days I'll put together a video of the whole re-entry, parachute deploy and splashdown, and post it here, so you can check out the result!
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Sun May 05, 2019 1:03 am

I just posted a video of my space capsule re-entry and parachute deploy sequence, including a splashdown! The video itself is rather long (11 minutes), so below is a link to my YouTube channel which plays the video just before the splashdown. If you want to see the parachute sequence deployment, back up a bit :mrgreen:

FSX SpacePort re-entry and splashdown sequence

Cheers,
Misho
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Wed May 08, 2019 10:07 am

oh that looks very nice.

In case yo decide to do the realistic Archimedes buoyancy I added a debug display to show how it looks after calibration of teh stationary wave.
The wave is too simple and maybe an animation of the surface using a 2d fft could be cool,
I see if I do that later. but for nwo you can see where is heading
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Wed May 08, 2019 3:46 pm

Julio Jerez wrote:oh that looks very nice.

In case yo decide to do the realistic Archimedes buoyancy I added a debug display to show how it looks after calibration of teh stationary wave.
The wave is too simple and maybe an animation of the surface using a 2d fft could be cool,
I see if I do that later. but for nwo you can see where is heading


Thanks Julio! Yeah I was very happy how it came out! Newton side was super easy to implement (I just assigned a new Transform callback), but the simulator side was a bit tricky with respect how a visual model interacts with water surface - I had to do some workarounds around that!

I will definitely at some point properly implement Archimedes buoyancy - I just need to re-structure my setup as I was explaining. At some point, it would be awesome if the parachute would be able to pull the capsule and make it tip sideways, which would incur emergency procedures by astronauts (which actually happened in the history of spaceflight :wink: )

But, for now, good to know there is that option! :wink:
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron