Menu

How would you implement SetData PDU?

siavee
2014-11-26
2014-12-16
  • siavee

    siavee - 2014-11-26

    Hi Karl,

    How would you implement SetData PDU?

    Looking at the currently implemented EntityState PDU. Articulated part records are implemented as VariableParameterCollection. I noticed that the VariableParameter type has Lengh of 16 bytes, which is the same the articulated parameter lengths.

    Should FixedDatum and VariableDatum inherit from VariableParameter?

    -Avi

     
  • Karl  Jones

    Karl Jones - 2014-11-27

    Hi,

    No the VariableDatum and Fixed Datum will need to inherit from DataTypeBaseComplex and you will need a VariableDatumCollection class and FixedDatumCollection class.

    I do this because the Unity inspector does not support inheritance unless you inherit your classes from ScriptableObject, however ScriptableObjects are created differently and are not easily garbage collected. You have to manually destroy them. So the collection class is responsible for this, when it is destroyed it will then destroy the other objects it is responsible for.

    If you make a start on the SetData PDU I will do the Variable and Fixed data types for you.

    Regards

    Karl

     
  • siavee

    siavee - 2014-11-28

    Hi Karl,

    Thanks for the explanation. I have made a start on SetData PDU on commit f9e1e70.

    Also, if there's anything you would like to change from my implementations before merging to the main branch. Please do.

    Best regards,
    Avi

     
  • Karl  Jones

    Karl Jones - 2014-11-28

    Thanks Avi.

     
  • siavee

    siavee - 2014-12-12

    Hi Karl,

    If possible, can you give an example on how you would implement Fixed and Variable datums especially since right now DataTypeBaseComplex no longer inherits from ScriptableObject?

    If you are short on time I will do them first then you can correct them later if you want.

    Regards,
    Avi

     
    • Karl  Jones

      Karl Jones - 2014-12-12

      Hi Avi,

      It should be quite simple now. I will try and do it today.

      Karl

       

      Last edit: Karl Jones 2014-12-12
  • Karl  Jones

    Karl Jones - 2014-12-12

    Hi Avi,

    I have added the FixedDatum, I will add the variable datum when I get a chance or you can copy what I have done for the fixed datum, although you wont need a PropertyDrawer for this one.

    Karl

     
    • siavee

      siavee - 2014-12-13

      Hi Karl,

      Awesome! I will do the VariableDatum and you can check them out afterwards.

      Avi

       
  • siavee

    siavee - 2014-12-13

    Hi Karl,

    I have implemented VariableDatum class in the latest commit of vdevelop branch.I have also finished the implementation of SetData PDU, and also completed the VariableDatum part of Comment PDU.

    While developing, I noticed that we can't call base class implementation more than 1 generation above (we can't call base.base.method() -> http://stackoverflow.com/questions/2323401/how-to-call-base-base-method).

    I then modified the SetData PDU class to not inherit from Comment anymore and implemented a DatumSpecification data type. I have also modified Comment PDU to use it too.

    Please have a look and tell me what you think.

    I will implement several PDU and their event signaling next.

    Avi

     
    • Karl  Jones

      Karl Jones - 2014-12-13

      Hi Avi,

      Sounds interesting.
      I'm away this weekend but will look into it when I get back.

      Thanks

      Karl

       

      Last edit: Karl Jones 2014-12-13
    • Karl  Jones

      Karl Jones - 2014-12-13

      What base.base function are you trying to call? It should be ok to propagate the call down. I.e the child calls its child which calls its child etc.

      Karl

       

      Last edit: Karl Jones 2014-12-13
      • siavee

        siavee - 2014-12-14

        Hi Karl,

        The function that SetData PDU tries to call is SimulationManagementHeader's Decode & Encode function. Since SetData PDU (previously) inherits from Comment, if we call base.Decode or Encode on SetData's functions we would get incorrect result.

        I looked at KDIS source, and in Data_PDU::Encode, the first line of the function is the call to Simulation_Management_Header::Encode( stream ). We can't do this in C#. One of the option is to not call base method here and do a complete implementation of the encoding operation.

        The other option is to refactor the DatumSpecification part of the PDU, which I did.

         
        • Karl  Jones

          Karl Jones - 2014-12-14

          Oh yes of course. I would try to keep it inherited from comment and just re implement the encode decode stuff. Its only a few lines of code. I'll have a closer look tomorrow.

          Karl

           

          Last edit: Karl Jones 2014-12-15
  • siavee

    siavee - 2014-12-15

    Okay, please let me know once you have taken a look at it.

    Avi

     
  • Karl  Jones

    Karl Jones - 2014-12-15

    Hi Avi,

    Just had a look, I did not realise the datum specification was in the DIS standard. I am happy to stay with your approach.

    Regards

    Karl

     
    • siavee

      siavee - 2014-12-16

      Hi Karl,

      Awesome!

      Thanks,
      Avi

       
  • Anonymous

    Anonymous - 2019-04-26
    Post awaiting moderation.

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.