SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 09-20-10, 06:58 PM   #1
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

ran into a little problem with Automation's Navigate from file. Problem deals with calculating an offset heading to add to the sub's current heading so that the sub will head to the current/new waypoint. The waypoints are stored in a file as x,y meters from game origin (I added a new order to the nav officer's order bar that will show the sub's current position in the messagebox so that one can 'plot' a pattern/navigation). The code gets the sub's current fix as x,y meters from game origin. It then calculates the distance between the sub's fix and the current waypoint. That part is fine - distance shows perfect. The problem is this offset heading. When the sub is < 250m from the waypoint or when the half distance to the waypoint is reached it's supposed to calculate the offset to add to the current heading to keep it heading to the current/new waypoint. Something is wrong with my math and I'm not sure what it is. What would the formula be for calculating this offset given sub's current heading, current fix (x,y) and current waypoint (x,y)?? Using trig I tried using offset = atan2( fix.X - waypoint.X / fix.Y - waypoint.Y ) and adding this offset to the sub's current heading. Everything works fine as long as the waypoint is north of the sub. Any waypoints to the west or east are screwed up
TheDarkWraith is offline   Reply With Quote
Old 09-20-10, 07:50 PM   #2
Abd_von_Mumit
The Old Man
 
Join Date: Jan 2007
Location: Warszawa, Polska
Posts: 1,452
Downloads: 46
Uploads: 4
Default

Quote:
Originally Posted by TheDarkWraith View Post
ran into a little problem with Automation's Navigate from file. Problem deals with calculating an offset heading to add to the sub's current heading so that the sub will head to the current/new waypoint. The waypoints are stored in a file as x,y meters from game origin (I added a new order to the nav officer's order bar that will show the sub's current position in the messagebox so that one can 'plot' a pattern/navigation). The code gets the sub's current fix as x,y meters from game origin. It then calculates the distance between the sub's fix and the current waypoint. That part is fine - distance shows perfect. The problem is this offset heading. When the sub is < 250m from the waypoint or when the half distance to the waypoint is reached it's supposed to calculate the offset to add to the current heading to keep it heading to the current/new waypoint. Something is wrong with my math and I'm not sure what it is. What would the formula be for calculating this offset given sub's current heading, current fix (x,y) and current waypoint (x,y)?? Using trig I tried using offset = atan2( fix.X - waypoint.X / fix.Y - waypoint.Y ) and adding this offset to the sub's current heading. Everything works fine as long as the waypoint is north of the sub. Any waypoints to the west or east are screwed up
A wild guess - you lose a minus sign when powering. Now starting an analyze of what you wrote.
__________________
Long, hard, wet and full of seamen. My precious.
SH3+GWX+OLC — sunk x4, retired x2; SH5+TDW — still exploring
My SH5 mods: EQuaTool - Elite Quality Map Tools, Patrol Routine Scripts, No Logo Intro Menu_Animation, Less Annoying Stopwatch
Links: SH5 mods I use, FileFront, Manual plotting how-to
Abd_von_Mumit is offline   Reply With Quote
Old 09-20-10, 07:54 PM   #3
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Abd_von_Mumit View Post
A wild guess - you lose a minus sign when powering. Now starting an analyze of what you wrote.
I figured it out. Wasn't taking quadrants into account and I switched to atan vice atan2. Being able to navigate from files is working Being able to navigate search patterns and all is just about complete
TheDarkWraith is offline   Reply With Quote
Old 09-20-10, 07:58 PM   #4
Abd_von_Mumit
The Old Man
 
Join Date: Jan 2007
Location: Warszawa, Polska
Posts: 1,452
Downloads: 46
Uploads: 4
Default

Quote:
Originally Posted by TheDarkWraith View Post
I figured it out. Wasn't taking quadrants into account and I switched to atan vice atan2. Being able to navigate from files is working Being able to navigate search patterns and all is just about complete
Ah, you spoiled the fun.
__________________
Long, hard, wet and full of seamen. My precious.
SH3+GWX+OLC — sunk x4, retired x2; SH5+TDW — still exploring
My SH5 mods: EQuaTool - Elite Quality Map Tools, Patrol Routine Scripts, No Logo Intro Menu_Animation, Less Annoying Stopwatch
Links: SH5 mods I use, FileFront, Manual plotting how-to
Abd_von_Mumit is offline   Reply With Quote
Old 09-20-10, 09:49 PM   #5
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

new command added to Automation: Navigate_from_file. Parameter 3 of the command specifies the file to be used (without extension). The code will automatically add the .SHN extension.

You define the waypoints to navigate from in the file. The waypoints are specified as x,y meters from game origin. A new order has been added to the navigator's order bar that will allow you to get the current x,y position in meters from game origin for 'mapping' out a navigation route or pattern. When the order is pressed the current x,y position will be displayed in the messagebox.

The code will create a new folder in your \Silent Hunter 5\data folder. The folder will be named Navigation. All your navigation 'scripts' need to be stored here as that is where parameter 3 of the command will find them.

Here are the contents of a test navigation script that will do a box search pattern (these are absolute coordinates):

3039731,9004347,1,5,0
3041023,9004587,1,5,0
3041234,9003242,1,5,0
3039943,9003011,1,5,0
3039740,9004364,1,5,0

the first entry is the X position. Second entry is Y position. Third entry is TC level to use. Fourth entry is speed to use. Fifth entry is depth to use.

Looking into being able to define relative coordinates. These relative coordinates would be relative to your sub for defining things like search patterns.
TheDarkWraith is offline   Reply With Quote
Old 09-21-10, 02:25 AM   #6
Robin40
Chief
 
Join Date: Aug 2010
Location: Rivoli (Italy)
Posts: 310
Downloads: 162
Uploads: 0
Default

Can someone tell me about the interaction of

U-boat Historical Specifications 1.4

with

NewUIs_TDC_4_3_1_ByTheDarkWraith

and

IRAI_0_0_25_TheDarkWraith?
Robin40 is offline   Reply With Quote
Old 09-21-10, 05:03 AM   #7
Abd_von_Mumit
The Old Man
 
Join Date: Jan 2007
Location: Warszawa, Polska
Posts: 1,452
Downloads: 46
Uploads: 4
Default

Quote:
Originally Posted by Robin40 View Post
Can someone tell me about the interaction of

U-boat Historical Specifications 1.4

with

NewUIs_TDC_4_3_1_ByTheDarkWraith

and

IRAI_0_0_25_TheDarkWraith?
This works for me:
U-boat Historical Specifications 1.4
NewUIs_TDC_4_3_1_ByTheDarkWraith
New_UIs_TDC_4_3_1_Patch_3_ByTheDarkWraith
NewUIs_TDC_4_3_1_No_Hydrophone_On_Surface_No_Aircr aft_Spotting
IRAI_0_0_25_ByTheDarkWraith
IRAI_0_0_25_No_hydrophone_on_surface_No_Aircraft_s potting
__________________
Long, hard, wet and full of seamen. My precious.
SH3+GWX+OLC — sunk x4, retired x2; SH5+TDW — still exploring
My SH5 mods: EQuaTool - Elite Quality Map Tools, Patrol Routine Scripts, No Logo Intro Menu_Animation, Less Annoying Stopwatch
Links: SH5 mods I use, FileFront, Manual plotting how-to
Abd_von_Mumit is offline   Reply With Quote
Reply

Tags
dbrn, favorite, new ui

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 1995- 2026 Subsim®
"Subsim" is a registered trademark, all rights reserved.