Beispiel #1
0
        public static void Main(String[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(""); // to ensure point as separator in decimal numbers
            CartesianPos cPos = new CartesianPos(0.90, 0.91, 0.92);                      // creates a CartesianPos object with (x,y,z) = (0.90, 0.91, 0.92)


            RobotTouch rTouch1 = new RobotTouch(
                DateTime.Now,                           // the event occurs now
                9876543211,                             //  object definition
                0.67,                                   // hardness level
                0.68,                                   // moisture level
                0.69,                                   // pressure level
                0.70,                                   // roughness level
                25.5);                                  // temperature level


            try                                         // Try to access a resource.
            {
                rTouch1.insert();                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. Probaly will borken the simulator
            }



            Console.WriteLine("- You can see the results of this execution in Fuseki start terminal or");
            Console.WriteLine("  doing a query to the triple store with your browser at : localhost:3030");
            Console.WriteLine("- Insert any char to close this terminal....");  Console.ReadLine();
        }
Beispiel #2
0
    private void insertHearPos(GameObject go, DateTime dt)
    {
        CartesianPos      cPos = new CartesianPos(go.transform.position.x, go.transform.position.y, go.transform.position.z);
        HearingProperties auxHearingProperties = go.GetComponent <HearingProperties>();
        HearingAttribute  soundType            = HearingAttribute.unknownSound;
        float             volume = 0;
        string            desc   = "";

        if (auxHearingProperties != null)
        {
            soundType = auxHearingProperties.getSoundType();
            volume    = auxHearingProperties.getVolume();
            desc      = auxHearingProperties.getSoundDetail();
        }
        RobotHear rh = new RobotHear(
            dt,                     // the event occurs now
            cPos,                   // object  identifier
            soundType,              // I heard a beautiful music
            volume,                 // the volume is in the middle
            desc);                  // sound detail

        try                         // Try to access a resource.
        {
            rh.insert();            // using dotNetRDF library inserts the information in the triple store
        }
        catch (Exception e)
        {
            Debug.Log("System>>> " + e.Message);                  // change for your: LogError(e);     // Call a custom error logging procedure.
        }
    }
Beispiel #3
0
    private void insertSmellPos(GameObject go, DateTime dt)
    {
        CartesianPos    cPos = new CartesianPos(go.transform.position.x, go.transform.position.y, go.transform.position.z);
        SmellProperties auxSmellProperties = go.GetComponent <SmellProperties>();
        OdorComposition smellType          = new OdorComposition(0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f);

        if (auxSmellProperties != null)
        {
            smellType = auxSmellProperties.odorComposition;
        }
        RobotSmell rs = new RobotSmell(
            dt,                  // the event occurs now
            cPos,                // source position
            smellType);          // it is a putrid odor


        try                                    // Try to access a resource.
        {
            rs.insert();                       // using dotNetRDF library inserts the information in the triple store
        }
        catch (Exception e)
        {
            Debug.Log("System>>> " + e.Message);                  // change for your: LogError(e);     // Call a custom error logging procedure.
        }
    }
Beispiel #4
0
        /// Constructor for the Thing class. The objective is to create a instance of an inanimate object.
        /// All  parameters together defines this object.
        ///
///
        public Thing(long objId, string name, string tag, RGBValue color, CartesianPos pos, PhysicalState state, Material mat, string uri)
        {
            objectId   = objId;
            this.name  = name;
            tagInfo    = tag;
            this.color = color;
            this.pos   = pos;
            this.state = state;
            material   = mat;
            uriId      = uri;
        }
Beispiel #5
0
    private void insertTouchPos(GameObject go, DateTime dt)
    {
        CartesianPos    cPos = new CartesianPos(go.transform.position.x, go.transform.position.y, go.transform.position.z);
        TouchProperties auxTouchProperties = go.GetComponent <TouchProperties>();
        float           hardness           = 0;
        float           moisture           = 0;
        float           roughness          = 0;
        float           pressure           = 0;
        float           temperature        = 0;

        if (auxTouchProperties != null)
        {
            hardness    = auxTouchProperties.getHardness();
            moisture    = auxTouchProperties.getMoistness();
            roughness   = auxTouchProperties.getRoughness();
            pressure    = auxTouchProperties.getPressure();
            temperature = auxTouchProperties.getTemperature();
        }
        RobotTouch rTouch = new RobotTouch(
            dt,                               // the event occurs now
            cPos,                             //  object definition
            hardness,                         // hardness level
            moisture,                         // moisture level
            pressure,                         // pressure level
            roughness,                        // roughness level
            temperature);                     // temperature level

        try                                   // Try to access a resource.
        {
            rTouch.insert();                  // using dotNetRDF library inserts the information in the triple store
        }
        catch (Exception e)
        {
            Debug.Log("System>>> " + e.Message);                  // change for your: LogError(e);     // Call a custom error logging procedure.
        }
    }
Beispiel #6
0
        /// Constructor for the Thing class. The objective is to create a instance of an animate agent.
        /// All the parameter defines this agent in a similar way of the super class Thing.
        /// There are just an additional parameter, named emotion, that defines the emotion state of the agent.
        ///

        public Human(long objId, string name, string tag, RGBValue color, CartesianPos pos, PhysicalState state, Material mat, string uri, EmotionalState emotion) : base(objId, name, tag, color, pos, state, mat, uri)

        {
            this.emotion = emotion;
        }
Beispiel #7
0
    private void insertVision(GameObject go, DateTime dt)
    {
        CartesianPos     cPos      = new CartesianPos(go.transform.position.x, go.transform.position.y, go.transform.position.z);
        VisionProperties auxVision = go.GetComponent <VisionProperties>();
        Status           auxStatus = go.GetComponent <Status>();
        RGBValue         rgb;

        OntSenseCSharpAPI.Material material = OntSenseCSharpAPI.Material.unknownMaterial;
        PhysicalState state = PhysicalState.noneState;
        string        tag   = go.tag;
        string        uri   = "";

        if (auxStatus != null)
        {
            state = auxStatus.getStatus();
        }
        if (auxVision != null)
        {
            rgb      = auxVision.getRGB();
            material = auxVision.getMaterial();
            if (auxVision == vision)
            {
                tag = "SelfRobot";
            }
            uri = auxVision.getURI();
        }
        else
        {
            rgb = new RGBValue(0, 0, 0);
        }
        EmotionalState emotion    = EmotionalState.neutralEmotion;
        EmotionStatus  auxEmotion = go.GetComponent <EmotionStatus>();

        if (auxEmotion != null)
        {
            emotion = auxEmotion.getEmotion();
        }
        RobotVision rv;

        switch (go.tag)
        {
        case Constants.TAG_ROBOT:
            Robot auxRobot = new Robot(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri);
            rv = new RobotVision(dt, auxRobot);
            break;

        case Constants.TAG_HUMAN:
            Human auxHuman = new Human(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri, emotion);
            rv = new RobotVision(dt, auxHuman);
            break;

        default:
            Thing auxThing = new Thing(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri);
            rv = new RobotVision(dt, auxThing);
            break;
        }
        try                                    // Try to access a resource.
        {
            rv.insert();                       // using dotNetRDF library inserts the information in the triple store
        }
        catch (Exception e)
        {
            Debug.Log("System>>> " + e.Message);                  // change for your: LogError(e);     // Call a custom error logging procedure.
        }
    }
Beispiel #8
0
        /// Constructor for the Robot class. The objective is to create a instance of a robot.
        /// All  parameters together defines this robot.
        ///
///
        public Robot(long objId, string name, string tag, RGBValue color, CartesianPos pos, PhysicalState state, Material mat, string uri) : base(objId, name, tag, color, pos, state, mat, uri)
        {
        }
Beispiel #9
0
        private static readonly string ONT_SENSE_URL = "http://localhost:3030/ontsense";        // URL address of the triple store


        public static void Main(String[] args)
        {
            CartesianPos cPos;
            RGBValue     rgb;
            Thing        thing;


            // Start access to Sparql End Point : just one time at main method is enough
            SparqlEndPoint instanceSparql = SparqlEndPoint.getInstance();       // gets the instance for the  singleton object

            instanceSparql.init(ONT_SENSE_URL);



            //
            // creates a RobotVision object	with a  Salmon_Pack
            //
            cPos  = new CartesianPos(0.35, 0.36, 0.37);                 // creates a CartesianPos object with (x,y,z) = (0.35, 0.36, 0.37)
            rgb   = new RGBValue(0.45, 0.46, 0.47);                     // creates a  RGBValue value with (red, green, blue) = (0.45, 0.46, 0.47)
            thing = new Thing(
                1000000010,                                             // object  identifier
                "",                                                     // object name
                "Salmon_Pack",                                          // internal object tag,
                rgb,                                                    // color in RGBValue
                cPos,                                                   // CartesianPos
                PhysicalState.noneState,                                // object Phisical State
                Material.organicMaterial,                               // object Material type
                "https://www.wikidata.org/wiki/Q7405484");              // URI associated with the object

            RobotVision rVision = new RobotVision(DateTime.Now, thing); // creates a RobotVision object  seen at this very moment

            try
            {                                           // Try to access a resource.
                rVision.insert();                       // using dotNetRDF library inserts the information in the triple store
            }


            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. It is likely to interrupt the simulator
            }


            //
            // creates a RobotVision object	with Human
            //
            cPos = new CartesianPos(0.25, 0.326, 0.27);                      // creates a CartesianPos object with (x,y,z) = (0.25, 0.326, 0.27))
            rgb  = new RGBValue(0.25, 0.326, 0.27);                          // creates a  RGBValue value with (red, green, blue) = (0.25, 0.326, 0.27))
            Human human = new Human(
                1000000100,                                                  // object  identifier
                "mariana",                                                   // object name
                "Human",                                                     // internal object tag,
                rgb,                                                         // color in RGBValue
                cPos,                                                        // CartesianPos
                PhysicalState.noneState,                                     // object Phisical State
                Material.organicMaterial,                                    // object Material type
                "https://www.wikidata.org/wiki/Q3238275",                    // URI associated with the human
                EmotionalState.happinessEmotion);                            // human emotional state

            RobotVision rVisionHuman = new RobotVision(DateTime.Now, human); // creates a Vision object  seen at this very moment

            try                                                              // Try to access a resource.
            {
                rVisionHuman.insert();                                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. It is likely to interrupt the simulator
            }



            //
            // creates a RobotVision object	with a Robot information
            //
            cPos = new CartesianPos(0.25, 0.326, 0.27);   // creates a CartesianPos object with (x,y,z) = (0.25, 0.326, 0.27))
            rgb  = new RGBValue(0.25, 0.326, 0.27);       // creates a  RGBValue value with (red, green, blue) = (0.25, 0.326, 0.27))
            Robot robot = new Robot(
                1000001000,                               // object  identifier
                "Kyle",                                   // object name
                "Robot",                                  // internal object tag,
                rgb,                                      // color in RGBValue
                cPos,                                     // CartesianPos
                PhysicalState.noneState,                  // object Phisical State
                Material.organicMaterial,                 // object Material type
                "https://www.wikidata.org/wiki/Q11012");  // URI associated with the robot


            RobotVision rVisionRobot = new RobotVision(DateTime.Now, robot); // creates a RobotVision object  seen at this very moment

            try                                                              // Try to access a resource.
            {
                rVisionRobot.insert();                                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. It is likely to interrupt the simulator
            }



            //
            // creates a RobotHear object with Hear information
            //
            RobotHear rh1 = new RobotHear(
                DateTime.Now,                       // the event occurs now
                1000010000,                         // object  identifier
                HearingAttribute.musicSound,        // I heard a beautiful music
                0.5,                                // the volume is in the middle
                "What A Wonderful World");          // sound detail

            try                                     // Try to access a resource.
            {
                rh1.insert();                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. It is likely to interrupt the simulator
            }



            //
            // creates a RobotHear object	with Hear and Position information
            //
            cPos = new CartesianPos(0.50, 0.51, 0.52); // creates a CartesianPos object with (x,y,z) = (0.50, 0.51, 0.52)
            RobotHear rh2 = new RobotHear(
                DateTime.Now,                          // the event occurs now
                cPos,                                  // source position
                HearingAttribute.musicSound,           // I heard a beautiful music
                0.8,                                   // the volume is a little high
                "Don't worry be Happy");               // sound detail

            try                                        // Try to access a resource.
            {
                rh2.insert();                          // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. It is likely to interrupt the simulator
            }


            //
            // creates a RobotSmell object with Smell
            //
            OdorComposition odor = new OdorComposition(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.8, 0.0, 0.0);
            RobotSmell      rs1  = new RobotSmell(
                DateTime.Now,                           // the event occurs now
                1000102018,                             // object  identifier
                odor);                                  // it is an odor with 0.8 of pungent and 0.7 of popocorn


            try                                     // Try to access a resource.
            {
                rs1.insert();                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. Probaly will borken the simulator
            }

            //
            // creates a RobotSmell with with Smell and Position information
            //

            cPos = new CartesianPos(0.75, 0.76, 0.77);     // creates a CartesianPos object with (x,y,z) = (0.75, 0.76, 0.77))

            RobotSmell rs2 = new RobotSmell(
                DateTime.Now,                           // the event occurs now
                cPos,                                   // source position
                odor);                                  // it is an odor with 0.8 of pungent and 0.7 of popocorn


            try                                     // Try to access a resource.
            {
                rs2.insert();                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. Probaly will borken the simulator
            }


            //
            // creates a RobotTaste object	 with Taste and Position information
            //
            RobotTaste rt = new RobotTaste(
                DateTime.Now,                      // the event occurs now
                1001000000,                        // object  identifier
                0.12,                              // bitter level
                0.13,                              // salt level
                0.14,                              // sour level
                0.89,                              // sweet level
                0.70);                             // umani level

            try                                    // Try to access a resource.
            {
                rt.insert();                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. Probaly will borken the simulator
            }



            //
            // creates a RobotTouch object		with Touch information
            //
            RobotTouch rTouch1 = new RobotTouch(
                DateTime.Now,                           // the event occurs now
                1010000000,                             //  object definition
                0.67,                                   // hardness level
                0.68,                                   // moisture level
                0.69,                                   // pressure level
                0.70,                                   // roughness level
                25.5);                                  // temperature level


            try                                         // Try to access a resource.
            {
                rTouch1.insert();                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. Probaly will borken the simulator
            }



            //
            // creates a RobotTouch object	with Touch and Position information
            //
            cPos = new CartesianPos(0.90, 0.91, 0.92);     // creates a CartesianPos object with (x,y,z) = (0.90, 0.91, 0.92)

            RobotTouch rTouch2 = new RobotTouch(
                DateTime.Now,                           // the event occurs now
                cPos,                                   // position of the object
                0.22,                                   // hardness level
                0.23,                                   // moisture level
                0.24,                                   // pressure level
                0.79,                                   // roughness level
                23.5);                                  // temperature level


            try                                         // Try to access a resource.
            {
                rTouch2.insert();                       // using dotNetRDF library inserts the information in the triple store
            }

            catch (Exception e)
            {
                Console.WriteLine(e);                   // change for your: LogError(e);     // Call a custom error logging procedure.
                throw;                                  // Re-throw the error. Probaly will borken the simulator
            }

            Console.WriteLine("- You can see the results of this execution in Fuseki start terminal or");
            Console.WriteLine("  doing a query to the triple store with your browser at : localhost:3030");
            Console.WriteLine("- Insert any char to close this terminal....");  Console.ReadLine();
        }