Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

scripts in stellarium 10

Feedback
herser
2008-09-30
2012-10-09
  • herser
    herser
    2008-09-30

    After versions 8 and 9 I instlalled Stellarium 0.10.0.
    It's a real new version but I don't find how to use scripts in this version. The key M doesn't seem to work.

     
    • barrykgerdes
      barrykgerdes
      2008-10-31

      Hi Matthew

      The new script manager is coming along nicely. All I need now is a command to reset the date time to the present.
      Here is a trial version of my old Total solar eclipse for version 0.10.1 build 3858. It is a bit rough but it works with what we have so far.

      //This script shows the path of the sun from sunrise to sunset as seen from
      //Sydney on the next total eclipse of the sun seen from this location
      core.debug("Starting Solar Eclispe script");
      core.wait(1);
      core.debug("OK, let's go...");
      // Set configuration parameters
      LabelMgr.deleteAllLabels();
      core.clear("natural");
      LandscapeMgr.setFlagLandscape(true);
      LandscapeMgr.setFlagAtmosphere(true);
      MeteorMgr.setFlagShow(true);
      NebulaMgr.setFlagShow(true);
      SolarSystem.setFlagPlanets(true);
      StarMgr.setFlagStars(true);
      //LocationMgr.set
      core.setObserverLocation("Richmond-Windsor, Australia");
      core.wait(1);
      //set up the initial display Position
      core.moveToAltAzi(20, 60);
      //Set FOV
      MovementMgr.zoomTo(80, 2);
      core.wait(2);
      //set the date/time/location for the start of the eclipse display
      core.setDate("2028:07:21T20:20:32");
      //Place a description of events in the lower left
      function commentary(text)
      {
      var id = LabelMgr.labelScreen(text, 100, 100, false, 20, "#aaaaaa");
      LabelMgr.setLabelShow(id, true);
      core.wait(2);
      LabelMgr.setLabelShow(id, false);
      core.wait(1);
      LabelMgr.deleteLabel(id);
      }

      commentary("This is a script of the total Solar eclipse");
      commentary("Seen from Sydney Australia ");
      commentary("On the 21st of July 2008 at 20:20:32 GMT");
      commentary("We will move quickly to the eclipse start time and Zoom in");

      //make the sun move quickly to the eclipse time
      core.setTimeSpeed(.00001157407407407407 * 1000);
      core.wait(10);
      core.moveToAltAzi(20, 30);
      core.wait(8);
      // Select Sun
      core.selectObjectByName("Sun", false);
      // Goto the selected object and track it...
      MovementMgr.setFlagTracking(true);
      core.wait(2.1);
      //zoom auto in
      MovementMgr.autoZoomIn(4);
      core.wait(2);
      //new description
      core.setTimeSpeed(.00001157407407407407 * 400);
      core.wait(14);
      MovementMgr.zoomTo(30, 2);
      //slow down display and expand the display, see stars at maximum eclipse
      //zoom auto out
      //flag atmosphere 0
      //image action drop name Syd-2
      //image action load filename "Syd-3.png" name Syd-3 alpha 1 scale 0.38 xpos -0.6 ypos -0.6
      //set timerate rate 10
      core.setTimeSpeed(.00001157407407407407 * 10);
      commentary("Notice How the stars become visible during eclipse");
      core.wait(2);
      //zoom auto in
      MovementMgr.autoZoomIn(4);
      //timerate rate 400
      core.setTimeSpeed(.00001157407407407407 * 400);
      core.wait(10);
      //zoom auto out

      //#make sure the display returns to sun tracking
      //#Add the final description
      //image action drop name Syd-3
      //image action load filename "Syd-4.png" name Syd-4 alpha 1 scale 0.38 xpos -0.6 ypos -0.6
      //#return display to where we left it
      // Reset configuration parameters to your default
      LandscapeMgr.setFlagLandscape(true);
      LandscapeMgr.setFlagAtmosphere(true);
      LandscapeMgr.setFlagFog(true);
      LandscapeMgr.setFlagCardinalsPoints(true);
      MeteorMgr.setFlagShow(true);
      NebulaMgr.setFlagShow(true);
      SolarSystem.setFlagPlanets(true);
      StarMgr.setFlagStars(true);
      core.wait(3);
      //core.setTimeSpeed(.00001157407407407407);
      // Zoom Out
      MovementMgr.autoZoomOut(2);
      core.wait(12);
      core.setTimeSpeed(.00001157407407407407);

      core.wait(2);
      core.setObserverLocation("Richmond-Windsor, Australia");
      ConstellationMgr.setFlagBoundaries(true);
      GridLinesMgr.setFlagEquatorJ2000Grid(true);
      GridLinesMgr.setFlagEclipticLine(true);
      core.moveToAltAzi(10, 180);
      MovementMgr.zoomTo(60, 2);
      core.wait(2);
      core.setDate ("2008:10:24T20:17:00");
      core.wait(2);

      Barry

       
      • Matthew Gates
        Matthew Gates
        2008-10-31

        Hi Barry,

        I've just added some new time functionality to the core scripting class. If you would have a play with them and let me know of any problems, that would be really useful.

        core.setDate can now accept relative dates. For example:

        core.setDate("now"); // set simulation time to system clock time
        core.setDate("now + 3 days"); // system clock +3 solar days
        core.setDate("- 2 weeks"); // -2 solar weeks

        You can also append "sidereal" (which will be different when the observer is on different planets). For example:

        core.setDate("+ 2.5 days sidereal");


        I also added a function called "waitFor", which will only return once some target date/time is reached. Beware that this function may overshoot a little if the time rate is fast (it just polls the simulation clock ever 50 milli seconds and sees if the target time has been reached or exceeded, then returns).

        You can use the same time specifications as you do with the setDate command, e.g.

        core.waitFor("2008-12-25T00:00:00", "local"); // wait for xmas
        core.waitFor("+ 2 hours"); // wait for 2 [simulation] hours to pass

        Note that if the time rate is backwards, the function will wait for times earlier then the current time, but return immediately if the target time is in the future.

        See the notes in the QtScriptMgr.hpp comments for more information about these functions.

        Cheers,
        Matthew

         
    • barrykgerdes
      barrykgerdes
      2008-10-31

      Thanks Matthew

      I have made some adjustments to the scripts that make them run smoother.

      I checked out the QtScriptMgr.hpp. It reads like a "help file" thanks to your prolific use of comments.

      The only problems I have found are my finger problems. correct syntax is imperative. I accidently erased a "//" off a comment line in a long script which caused it to crash. It took nearly an hour of careful reading to find my mistake.

      The other problem is that most of the commands will cause the script to hang if you don't add a little bit of delay for them to execute.

      Oh! one more command I would like is to return to the default location. This is not a problem with my own scripts because I can call the location but for universal scripts that set a location there is need to return to the default location.

      Other than these problems It is possible to write some good scripts now without any other new commands.

      Barry

       
      • Matthew Gates
        Matthew Gates
        2008-11-01

        The syntax is pretty sensitive, and sadly the feedback when there is a problem is not as helpful as it might be. Fabien mentioned something about a debugging tool coming in a future release of QT, so it might be that we will get quite a sophisticated integrated tool without too much effort if that pans out.

        I found some crashes when I didn't add a pause at the start of scripts, but I think I mitigated that with a delay in the runScript function (waiting for the gui to complete loading).

        When you find a command (or combination of commands) which causes a lock-up or crash, please do post them here or to the pubdevel mailing list.

        Where we get crashes, that is exposing some flaw with underlying code which need to be fixed. Ideally it shouldn't be possible to cause a crash with a script, although that might be hard to prevent completely.

        I'll see what I can do about the Location saving/restoring.

        Matthew

         
    • barrykgerdes
      barrykgerdes
      2008-11-01

      Hi Matthew

      Perhaps I should not have said crash although I did get a couple of crashes when I tried to do something the computer wasn't ready to do. Like not enough delay after a command

      Other than missing delays the errors in the scripts just caused the program to stop.

      The error I had with the comment line not having the "//" caused the script to not start.

      The syntax errors I had were missing ",", ";" and case errors. These errors only caused the script to stop at the problem which made it easy to debug.

      After a few edits on the script file I was able to interpret the problems from the different symtoms and quickly get to the culprit.

      Barry

       
    • Matthew Gates
      Matthew Gates
      2008-11-03

      Barry, and anyone else who's playing with scripting in the dev code:

      You will need to update your scripts if they use setTimeSpeed. I renamed the function setTimeRate and changed the unit of the parameter from JDay/sec to sec/sec.

      Matthew

       
    • barrykgerdes
      barrykgerdes
      2008-09-30

      Siorry Herser

      Scripts are not working in the beta realease. they will be reintigated next release.

      Barry

       
      • Jonas Persson
        Jonas Persson
        2008-10-17

        HI,

        When will next release be?
        I am working on scripts for educational purposes and will need to know when a version capable of running scripts is out. An article in a popular Astronomy Magazine describing this has been published and I expect people to download Stellarium and try some of my scripts. Pity if it is not working as expected.

        Jonas

         
        • Rob Spearman
          Rob Spearman
          2008-10-20

          The current stable release 0.9.1 is still available for download. However, I've suggested that we make it easier to find on the Stellarium home page.

          So if you want to distribute scripts you could just specify which version of Stellarium to use, or possibly just distribute it with the scripts.

          I'm planning to migrate the original scripting language (StratoScript) to a future version of Stellarium, but no timetable yet.

          Rob

           
        • Matthew Gates
          Matthew Gates
          2008-10-17

          Hello Jonas,

          There is no date yet. It seems we usually take something like 6-9 months to make a new release, but there are a lot of variables and it is not clear yet if it will be the same, longer or shorter this time.

          Please note that the new scripting engine will not immediately be backwards compatible with old scripts. If you need to use scripting, please continue to use version 0.9.1 or earlier for now.

          If it is not too difficult to do, we will release a backwards compatibility plugin for old scripts, but that will be implemented in terms of the new scripting engine, and as such will probably not be available from day 1 of the next release.

          Matthew

           
    • Jonas Persson
      Jonas Persson
      2008-10-19

      Hi,

      Thank you for your answer.

      We have been working on scripts with the intention of using it during 2009.
      The original idea was to write educational scripts, where pupils in schools (and other interested) could start a script and get a 5-10 min tour (with audio and pictures) of one specific object ( a planet or a constellation).
      Now we are considering to write audio starguides, a development of written guides, and post them on a website, in order to get more interested in Astronomy.

      Jonas

       
    • barrykgerdes
      barrykgerdes
      2008-10-24

      Hi Matthew

      I tried out the svn version of the preliminary script facility.

      Your partial Lunar eclipse ran OK but the penumbra was not noticeable on my display. So I used you guide and made a script for the total Lunar eclipse. This ran nicely except that it does not return when finished. I added some data to set the display back to standard but I could not set the date/time other than manually.

      I then modified my total Slar eclipse and got that to run as well.

      Have you got any more commands that I can play with?

      By the way if I tried to stop the eclipse with the stop button the display froze and I had to close it.

      Barry

       
      • Matthew Gates
        Matthew Gates
        2008-10-24

        Hey Barry,

        Yeah, we're just starting it now.

        The partial eclipse does look a lot less definite than before - I think this is because of a modified shadow texture. It could do with tweaking.

        Did you notice a weird line where the top of the left tool bar is and the right of the bottom toolbar?

        I get this:

        http://porpoisehead.net/misc/lunar_eclipse_toolbar_mask.jpg

        Do you get the same?

        I get the not-terminating thing too.

        For commands, you can use anything which is a public slot in a StelModule. On a Linux system with doxygen installed, do a "make apidoc" and then point your browser at .../builds/doc/html/classStelModule.html and have a browse for public slots in all the various modules. I think all the basic QT classes are also available - you can even create your own dialogs and have them interact with your script I think, although I didn't try it yet myself. See the QT scripting docs for more details of the language and QT classes which are usable:

        http://doc.trolltech.com/4.3/qtscript.html

        For the scripting engine development there will be a few goals to achieve before we have something really workable:

        1. Making sure there is some reasonably easy way to achieve the same as old script commands using new script commands. There are some missing things (e.g. clear) which will be added to the core scripting API object.

        2. Making all reasonable parts of the Stellarium API (objects and so on) available through the scripting interface. There's still quite a bit of stuff to be written to enable this.

        There are still lots of things to be worked out - like how to pause the new scripting engine, and recording scripts.

        What's cool about the QT scripting language is that it's a real language with flow control and variables and arithmetic and so on. It's much more powerful than the old scripting.

        Once the new scripting engine is looking OK, I'll try to work out some sort of compatibility mode. That might take the shape of a translator which reads old scripting and converts then into new scripts as they are read. If that can't provide enough compatibility with old scripts, I'll probably write a plugin to support old scripts, but that is more work and it depends on demand. I hope that users of the old scripting language will see how much more powerful the new one is, and adopt it quickly.

        Typical software engineer pipe-dream :-D

        Any feedback or ideas are welcome.

        Matthew

         
    • barrykgerdes
      barrykgerdes
      2008-10-24

      Hi Matthew

      Gee I wish we could edit our posts. I always seem to make two or three spelling mistakes (embarrassing).

      1. I can't see any weird marks on the tool bars. maybe I am looking in the wrong place.

      2. The box on the moon display was not noticeable at normal zoom but when I zoomed in I got the same effect as you. It is fixed in regard to the screen position but its position on the moon changes each time I run the script.

      I will check all those hints and see if I can get anything else to work.

      Converting the old scrpt to the new form was no bother. It only took a minute or so to change the commands to the new form.

      Off this subject. I see you put my updated textures.json in the svn however I made a mistake on the coords of M105. Well not really the coords are for my modified texture. The corrected coords are:

      "worldCoords" : [[[162.1267, 12.5719], [162.0142, 12.5614], [162.0117, 12.6772], [162.1258, 12.6828]]],

      This is the position of NGC3387 which the texture really is.

      Barry

       
      • Matthew Gates
        Matthew Gates
        2008-10-24

        I wish they were editable too. As admin I can delete whole posts, but not edit anything, and I frequently see a mistake or omission only a second after posting...

        The strange dis-colouration of the moon during a lunar eclipse seems to be something to do with the toolbars - see how the borders of the slightly darker area line up with the ends of the toolbars?

        Thanks for the update of the M105 location, and for all the refined positions. Some sort of nebula editor/image editor is on the cards, but exactly when that will happen is not clear yet. I honestly don't know how you had the patience to do all that texture positioning manually. It must have been a lot of work - thank you very much for doing it!

        Matthew

         
    • barrykgerdes
      barrykgerdes
      2008-10-24

      Hi Matthew

      Correcting the coords was a mammoth job I checked 135 files and made alterations to nearly all of them. The longest took 4 hrs to position it was about a degree out. There were lots of stars but I had a lot of trouble actually identifiying them using the DSS plates. The average time to correct was about an hour. I did it because I could and it kept me occupied. Most of the textures really fitted the star patterns. However some of my large textures could not overlay all the stars. It is almost impossible to lay a large flat area over a sphere.

      I had a look at my texture of the large magellan cloud today If I made the corners fit the center was out and vice versa so I split it into four adjoining textures. It took most of the day but it made a great improvement. I will do the same with my other large textures. Textures should not be larger than 60 arc seconds square if you want them to fit nicely.

      Barry

       
    • barrykgerdes
      barrykgerdes
      2008-10-24

      Hi Matthew

      The latest script mod got rid of the shading and closing the selecting window is much better.

      I added some instructions to my version to return the display to roughly where it started but I had to set the date to suit the object. This requires reseting the time date manually.

      // Name: Total Lunar Eclispe script
      // Start up script
      core.debug("Starting Total Lunar Eclispe script");
      core.wait(1);
      core.debug("OK, let's go...");
      // Set configuration parameters
      LandscapeMgr.setFlagLandscape(false);
      LandscapeMgr.setFlagAtmosphere(false);
      LandscapeMgr.setFlagFog(false);
      LandscapeMgr.setFlagCardinalsPoints(false);
      ConstellationMgr.setFlagArt(false);
      ConstellationMgr.setFlagLines(false);
      ConstellationMgr.setFlagBoundaries(false);
      ConstellationMgr.setFlagLabels(false);
      ConstellationMgr.setFlagIsolateSelected(false);
      GridLinesMgr.setFlagAzimuthalGrid(false);
      GridLinesMgr.setFlagEquatorGrid(false);
      GridLinesMgr.setFlagEquatorJ2000Grid(false);
      GridLinesMgr.setFlagEquatorLine(false);
      GridLinesMgr.setFlagEclipticLine(false);
      GridLinesMgr.setFlagMeridianLine(false);
      MeteorMgr.setFlagShow(true);
      NebulaMgr.setFlagHints(false);
      NebulaMgr.setFlagShow(true);
      SolarSystem.setFlagPlanets(true);
      SolarSystem.setFlagTrails(false);
      SolarSystem.setFlagHints(false);
      SolarSystem.setFlagLabels(false);
      SolarSystem.setFlagOrbits(false);
      SolarSystem.setFlagLightTravelTime(false);
      SolarSystem.setFlagMoonScale(false);
      StarMgr.setFlagStars(true);
      StarMgr.setFlagLabels(false);
      StarMgr.setFlagSciNames(false);

      core.wait(1);
      //Set date time of start
      core.setDate ("2004:05:04T17:51:00");
      core.selectObjectByName("Moon", false);
      // Goto the selected object and track it...
      MovementMgr.setFlagTracking(true);
      // Delay duration in seconds
      core.wait(2);
      // Zoom in
      MovementMgr.autoZoomIn(2);
      // Time rate in Julian days
      //.00001157407407407407 julian days = 1 second.
      core.setTimeSpeed(.00001157407407407407 * 500);
      // Set the script duration
      core.wait(35);
      // Reset configuration parameters to your default
      LandscapeMgr.setFlagLandscape(true);
      LandscapeMgr.setFlagAtmosphere(false);
      LandscapeMgr.setFlagFog(false);
      LandscapeMgr.setFlagCardinalsPoints(true);
      ConstellationMgr.setFlagArt(false);
      ConstellationMgr.setFlagLines(false);
      ConstellationMgr.setFlagBoundaries(true);
      ConstellationMgr.setFlagLabels(false);
      ConstellationMgr.setFlagIsolateSelected(false);
      GridLinesMgr.setFlagAzimuthalGrid(false);
      GridLinesMgr.setFlagEquatorGrid(false);
      GridLinesMgr.setFlagEquatorJ2000Grid(true);
      GridLinesMgr.setFlagEquatorLine(false);
      GridLinesMgr.setFlagEclipticLine(true);
      GridLinesMgr.setFlagMeridianLine(false);
      MeteorMgr.setFlagShow(true);
      NebulaMgr.setFlagHints(false);
      NebulaMgr.setFlagShow(true);
      SolarSystem.setFlagPlanets(true);
      SolarSystem.setFlagTrails(false);
      SolarSystem.setFlagHints(false);
      SolarSystem.setFlagLabels(false);
      SolarSystem.setFlagOrbits(false);
      SolarSystem.setFlagLightTravelTime(false);
      SolarSystem.setFlagMoonScale(false);
      StarMgr.setFlagStars(true);
      StarMgr.setFlagLabels(false);
      StarMgr.setFlagSciNames(false);

      core.setTimeSpeed(.00001157407407407407);
      // Zoom Out
      MovementMgr.autoZoomOut(2);
      core.wait(2);
      // select a ssystem.ini object and time that centred
      // on the screen view that you wish to return to
      core.selectObjectByName("C/2006 P1 (McNaught)", false);
      // Goto the selected object and track it...
      MovementMgr.setFlagTracking(true);
      core.wait(2);
      // Turn off tracking
      //MovementMgr.setFlagTracking(false);
      core.setDate ("2008:10:24T20:17:00");

      By the way when you edited the textures.json you left a comma off the end of the line. Syntax errors are fatal!

      Barry

       


Anonymous


Cancel   Add attachments