Editing Vessel Tutorial 2

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 278: Line 278:
 
= Spacecraft Empty Mass =
 
= Spacecraft Empty Mass =
  
The total mass of the spacecraft is continually tracked by Orbiter, and consists of the declared empty mass of the spacecraft and the total mass in all the propellant resources. The empty mass is normally constant, but things like jettisons will change the mass. Let's put the mass determination into a separate function. This will help out later when we start jettisoning parts.
+
The total mass of the spacecraft is continually tracked by Orbiter, and consists of the declared empty mass of the spacecraft and the total mass in all the propellant resources. The empty mass is normally constant, but things like jettisons will change the mass. Let's put the mass determination into a seperate function. This will help out later when we start jettisoning parts.
  
 
Add the following code to the class definition, to define the new method
 
Add the following code to the class definition, to define the new method
Line 333: Line 333:
 
= Main Retro =
 
= Main Retro =
  
Can we land yet? Yes, if you are less than 15km from the surface and travelling downward at less than 200m/s. You can try to set up a scenario by flying a much more maneuverable vehicle (like, say, a ShuttlePB) to an appropriate altitude and velocity. Go up to about 15km, then use translation jets or just point nose down and use the main jets, to get to about 200m/s downward. The horizontal speed should be as close to zero as you can get it. Point the nose straight up, then quit Orbiter, edit the Current State scenario, and replace the ShuttlePB with Surveyor. Remember to set the PRPLEVEL line correctly, or you may end up without RCS fuel!
+
Can we land yet? Yes, if you are less than 15km from the surface and travelling downward at less than 200m/s. You can try to set up a scenario by flying a much more maneuverable vehicle (Like, say, a ShuttlePB) to an appropriate altitude and velocity. Go up to about 15km, then use translation jets or just point nose down and use the main jets, to get to about 200m/s downward. The horizontal speed should be as close to zero as you can get it. Point the nose straight up, then quit Orbiter, edit the Current State scenario, and replace the ShuttlePB with Surveyor. Remember to set the PRPLEVEL line correctly, or you may end up without RCS fuel!
  
 
Now run Orbiter again, and start the Current State. Turn on the retrograde autopilot. Then just land it! It is theoretically possible, and with sufficient practice actually possible, to land Surveyor under these conditions. It's almost exactly like all the old lunar lander video games. Just get vertical speed to zero as altitude reaches zero. The survivable landing speed of a Surveyor is something around 5m/s downward.
 
Now run Orbiter again, and start the Current State. Turn on the retrograde autopilot. Then just land it! It is theoretically possible, and with sufficient practice actually possible, to land Surveyor under these conditions. It's almost exactly like all the old lunar lander video games. Just get vertical speed to zero as altitude reaches zero. The survivable landing speed of a Surveyor is something around 5m/s downward.
Line 361: Line 361:
 
  const double RETRO_STA  = -0.75;
 
  const double RETRO_STA  = -0.75;
  
Notice that the retro ISP is calculated here, unlike for the other engines. This is because there was no specification in the documentation. However, the nominal average thrust and total burn time was specified.
+
Notice that the retro ISP is calculated here, unlike for the other engines. This is because there was no specifications in the documentation. However, the nominal average thrust and total burn time was specified.
  
 
Compile and test. Notice how much heavier the spacecraft is now. If you are in the air, you probably can't land safely anymore, and if you are on the surface, you probably can't take off. Also, the retro engine is there, ready to be fired, but what button fires it? Right now, none. You can't control the retro at all. Let's fix that. Add another method to the class definition
 
Compile and test. Notice how much heavier the spacecraft is now. If you are in the air, you probably can't land safely anymore, and if you are on the surface, you probably can't take off. Also, the retro engine is there, ready to be fired, but what button fires it? Right now, none. You can't control the retro at all. Let's fix that. Add another method to the class definition
Line 430: Line 430:
 
So, we dumped the AMR and retro casing, but where did they go? It would be great to see them fall away. We can do that!
 
So, we dumped the AMR and retro casing, but where did they go? It would be great to see them fall away. We can do that!
  
First, lets prepare the new objects. Each different object has to have its own mesh and config file. In our case, we will borrow again a mesh from Surveyor1-1.zip. This time it's engine1.msh. Use the ShipEdit program to magnify this by a factor of 5, and save it as Orbiter\meshes\Surveyor-Retro.msh.
+
First, lets prepare the new objects. Each different object has to have its own mesh and config file. In our case, we will borrow again a mesh from Surveyor1-1.zip. This time its engine1.msh. Use the ShipEdit program to magnify this by a factor of 5, and save it as Orbiter\meshes\Surveyor-Retro.msh.
  
 
Now, the Surveyor1-1.zip file doesn't have a mesh for the AMR, so let's simulate one. Squish Surveyor-Retro.msh in the X and Y directions to 50% and the Z direction to 20%. Now rotate it around X by 180deg. Save this as Orbiter\meshes\Surveyor-AMR.msh
 
Now, the Surveyor1-1.zip file doesn't have a mesh for the AMR, so let's simulate one. Squish Surveyor-Retro.msh in the X and Y directions to 50% and the Z direction to 20%. Now rotate it around X by 180deg. Save this as Orbiter\meshes\Surveyor-AMR.msh
Line 553: Line 553:
 
So, now we can call SetupMeshes whenever we originally set up the vehicle state in clbkSetClassCaps, and whenever the configuration changes, like in Jettison. Replace the AddMesh line there with a call to SetupMeshes:
 
So, now we can call SetupMeshes whenever we originally set up the vehicle state in clbkSetClassCaps, and whenever the configuration changes, like in Jettison. Replace the AddMesh line there with a call to SetupMeshes:
  
   SetupMeshes();
+
   void SetupMeshes();
  
 
Also, add this line to the bottom of the Jettison method, after the case statement.
 
Also, add this line to the bottom of the Jettison method, after the case statement.
Line 573: Line 573:
 
Check here for the [[Surveyor Source Code]]
 
Check here for the [[Surveyor Source Code]]
  
[[Category: Articles]]
+
 
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
[[Category:Add-on tutorials]]
 

Please note that all contributions to OrbiterWiki are considered to be released under the GNU Free Documentation License 1.2 (see OrbiterWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)