This document discusses the PROFETA tool for programming autonomous systems. PROFETA provides a set of classes to represent basic beliefs, goals, and actions. It includes a declarative language based on AgentSpeak(L) to express an agent's behavior. A PROFETA program defines beliefs and goals as subclasses, defines actions by subclassing Action and overriding the execute() method, and writes rules using the declarative syntax. The engine executes the behavior by matching events to rules and executing corresponding actions. Special features like reactors and singleton beliefs are also discussed.
Integrating Cloud Services in Behaviour Programming for Autonomous RobotsCorrado Santoro
This document discusses integrating cloud services into behavior programming for autonomous robots. It introduces PROFETA, a framework for programming robot behaviors using a BDI model. PROFETA allows defining behaviors with rules but synchronous execution can cause issues for slow cloud services. CLEPTA is introduced as a decoupling layer to asynchronously execute cloud service sensors and actions. It uses service invokers and proxies asynchronous sensors and actions. This allows a robot to respond to voice commands using asynchronous cloud text-to-speech and speech-to-text services.
Actors provide a model for building concurrent and distributed applications using message passing between isolated computing entities called actors. Akka is an implementation of the actor model that allows building scalable and fault-tolerant applications on the JVM. Akka provides features like remote deployment of actors, asynchronous message passing, supervision strategies, and dispatchers for configuring how messages are processed.
Carol McDonald gave a presentation on the new features introduced in Java SE 5.0, including generics, autoboxing/unboxing, enhanced for loops, type-safe enumerations, varargs, and annotations. Generics allow type-safety when working with collections by specifying the collection element type. Autoboxing automatically converts between primitives and their corresponding wrapper types. The enhanced for loop simplifies iteration over collections. Type-safe enumerations provide an improved way of defining enum types. Varargs and annotations were also introduced to simplify coding patterns.
The document contains code snippets from 3 weekly coding assignments:
1) A Java program to check if a string is a palindrome. It compares characters at the beginning and end of the string.
2) A Java program to sort a list of names in ascending order using string comparison and swapping.
3) A Java program to count the frequency of words in a given text by tokenizing, sorting, and printing the words.
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
The question asks to create classes to represent publications, books, and tapes. The Publication class has title and price attributes. The Book class inherits from Publication and adds a noOfPages attribute. The Tape class inherits from Publication and adds a playingTime attribute.
The document contains 4 code snippets demonstrating different ways to take input in Java programs:
1) Using command line arguments and the args array to print a greeting with a passed in name
2) Swapping two integers entered from the keyboard using only two variables
3) Reading input from the keyboard using InputStreamReader and BufferedReader classes
4) Taking input using the Scanner class to read an integer, string, and double from console input
The document provides code examples for several basic Java programs, including:
1) A program that compares two numbers and prints which is greater.
2) A program that takes a number as input and prints all even numbers between 1 and the input.
3) Programs that calculate the area and perimeter of shapes like circles and rectangles.
4) Programs that calculate the factorial of a number and construct a triangle shape using asterisks.
5) A program that finds and lists all leap years between two given years.
Generics were introduced in Java 5.0 to provide compile-time type safety and prevent runtime errors. The document discusses key features of generics like type erasure, type inference, subtype polymorphism, wildcard types, and generic methods. It analyzes data from open source projects to evaluate hypotheses about generics reducing type casts and code duplication. The findings show generics benefits were limited and adoption by projects and developers was uneven, with conversion of legacy code to use generics being uncommon.
Integrating Cloud Services in Behaviour Programming for Autonomous RobotsCorrado Santoro
This document discusses integrating cloud services into behavior programming for autonomous robots. It introduces PROFETA, a framework for programming robot behaviors using a BDI model. PROFETA allows defining behaviors with rules but synchronous execution can cause issues for slow cloud services. CLEPTA is introduced as a decoupling layer to asynchronously execute cloud service sensors and actions. It uses service invokers and proxies asynchronous sensors and actions. This allows a robot to respond to voice commands using asynchronous cloud text-to-speech and speech-to-text services.
Actors provide a model for building concurrent and distributed applications using message passing between isolated computing entities called actors. Akka is an implementation of the actor model that allows building scalable and fault-tolerant applications on the JVM. Akka provides features like remote deployment of actors, asynchronous message passing, supervision strategies, and dispatchers for configuring how messages are processed.
Carol McDonald gave a presentation on the new features introduced in Java SE 5.0, including generics, autoboxing/unboxing, enhanced for loops, type-safe enumerations, varargs, and annotations. Generics allow type-safety when working with collections by specifying the collection element type. Autoboxing automatically converts between primitives and their corresponding wrapper types. The enhanced for loop simplifies iteration over collections. Type-safe enumerations provide an improved way of defining enum types. Varargs and annotations were also introduced to simplify coding patterns.
The document contains code snippets from 3 weekly coding assignments:
1) A Java program to check if a string is a palindrome. It compares characters at the beginning and end of the string.
2) A Java program to sort a list of names in ascending order using string comparison and swapping.
3) A Java program to count the frequency of words in a given text by tokenizing, sorting, and printing the words.
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
The question asks to create classes to represent publications, books, and tapes. The Publication class has title and price attributes. The Book class inherits from Publication and adds a noOfPages attribute. The Tape class inherits from Publication and adds a playingTime attribute.
The document contains 4 code snippets demonstrating different ways to take input in Java programs:
1) Using command line arguments and the args array to print a greeting with a passed in name
2) Swapping two integers entered from the keyboard using only two variables
3) Reading input from the keyboard using InputStreamReader and BufferedReader classes
4) Taking input using the Scanner class to read an integer, string, and double from console input
The document provides code examples for several basic Java programs, including:
1) A program that compares two numbers and prints which is greater.
2) A program that takes a number as input and prints all even numbers between 1 and the input.
3) Programs that calculate the area and perimeter of shapes like circles and rectangles.
4) Programs that calculate the factorial of a number and construct a triangle shape using asterisks.
5) A program that finds and lists all leap years between two given years.
Generics were introduced in Java 5.0 to provide compile-time type safety and prevent runtime errors. The document discusses key features of generics like type erasure, type inference, subtype polymorphism, wildcard types, and generic methods. It analyzes data from open source projects to evaluate hypotheses about generics reducing type casts and code duplication. The findings show generics benefits were limited and adoption by projects and developers was uneven, with conversion of legacy code to use generics being uncommon.
ppt of class and methods in java,recursion in java,nested class,java,command line argument,method overloading,call by value,call by reference,constructor overloading core java ppt
This document provides an agenda for introducing Erlang. It begins with a brief history of Erlang, noting it was created by Ericsson for developing telecommunication systems and needed to support concurrency and error recovery. The rest of the agenda covers key Erlang features like concurrency, distribution, and hot code loading. It also discusses Erlang/OTP design patterns, common tools, applications developed in Erlang, integrated development environments for Erlang, Erlang syntax like functions and modules, how to obtain Erlang, and concludes with a question and answer section.
This document contains a Java practical file belonging to Rachit Gupta, an MCA student. It consists of 16 programs of varying complexity written in Java, along with the output of each program. The programs cover topics such as calculating the square root of a number, finding the perimeter of a rectangle, calculating percentage of marks, and generating an electric bill based on units consumed. The file is a submission of Rachit Gupta's Java practical assignments for his 4th semester MCA course at the University of Jammu.
The document discusses sorting and searching algorithms. It introduces selection sort and insertion sort. Selection sort works by repeatedly finding the smallest element and swapping it into the sorted position. Insertion sort iterates through the array and inserts each element into the sorted position. The document also introduces merge sort, which works by recursively sorting and merging halves of the array.
The document outlines a Java programming practical course covering various Java concepts and programs. It includes 40 practical programs to be completed ranging from basic programs to find area of a circle, factorial of a number to more advanced programs involving OOP concepts like inheritance, abstraction, exception handling and multithreading. It also provides the evaluation and marking scheme for the practical exam.
This document provides code examples and exercises for learning Java programming. It lists chapter exercises from the book "Java Programming 7th Edition by Joyce Farrell" and additional examples from other sources. The examples cover topics like converting between units of measurement, calculating projections, and interactive guessing games. The document also includes sample code for making the examples interactive by prompting the user for input via dialog boxes.
Introduction to theano, case study of Word EmbeddingsShashank Gupta
Theano is a Python library that allows defining, optimizing, and evaluating mathematical expressions involving multi-dimensional arrays efficiently. It can compile expressions into optimized C code for fast CPU and GPU execution. Theano uses symbolic differentiation to automatically compute gradients for neural network training via backpropagation. It represents computations as a graph with variable nodes and operation nodes. This graph can be optimized before generating efficient C code. Theano is useful for machine learning algorithms that require large-scale numeric optimization like neural networks. The document discusses implementing word embedding models in Theano including autoencoder, GloVe, and skip-gram negative sampling models. Code examples are provided in GitHub links.
Java's eight primitive data types each have a corresponding wrapper class that allows them to be used as objects. The wrapper classes are in the java.lang package and include classes like Integer and Double. Wrapper classes "wrap" the primitive types in objects. For example, an Integer object holds an int value. Wrapper classes have methods to convert between the primitive type and its object representation.
JavaScript objects must implement certain standard properties and methods. Objects have a prototype property that is either an object or null, and prototype chains must have finite length. The typeof operator returns a string indicating the type of a variable or value. JavaScript supports basic types like undefined, null, boolean, number, string, and object. Functions are objects that can be called, and have properties like length and arguments. Variables declared with var have function scope, while variables assigned without var have global scope. Arrays, objects, and functions can be declared using various syntaxes. JavaScript uses prototypal inheritance rather than classes.
The document discusses exception handling in Java. It defines different types of errors like logical errors, compilation errors, and runtime errors. It explains checked and unchecked exceptions. It describes how to handle exceptions using try, catch, and finally blocks. It provides examples of handling ArithmeticException and other exceptions. It also discusses multi-catch, throw statement, re-throwing exceptions, and throws keyword to declare exceptions in method signatures.
Why we cannot ignore Functional ProgrammingMario Fusco
The document discusses several key concepts in functional programming including:
1) Pure functions that are referentially transparent and have no side effects like modifying variables or data structures.
2) Immutable data and persistent data structures that allow for sharing without synchronization.
3) Separating computational logic from side effects improves modularity and allows for parallelization.
4) A pure functional core can be wrapped with functions that have side effects to push effects to the outer layers.
Java supports generics as of version 1.5 to allow type-safe operations on parameterized types like List<String>. Generics eliminate the need for explicit casting when adding and retrieving elements. Wildcard types like List<?> provide flexibility but are more limited than specific types. Generic methods allow algorithms to operate on types in a generic way through type parameters.
The document provides the syllabus for a Java lab course. It outlines 11 programming assignments that students must complete, including developing classes for rational numbers, dates, Lisp-like lists, stacks, vehicles, currency conversion, and a scientific calculator. It provides sample code and algorithms for implementing a rational number class, date class, Lisp list operations, stack data structure using arrays and linked lists, vehicle class hierarchy demonstrating polymorphism, currency classes for serialization, and a basic calculator using event-driven GUI programming.
This document provides an overview of various Java operators including:
- Arithmetic operators like +, -, *, /, %
- Relational operators like >, <, ==, !=
- Assignment operators like =
- Logical operators like &&, ||, !
- Increment/decrement operators like ++, --
- Bitwise operators like &, |, ^
- String concatenation operator +
- Ternary operator ?:
It includes examples of using each operator and discusses shorthand operators, precedence rules, and automatic type conversions. Key operator types like arithmetic, relational, logical and bitwise are defined along with examples of using each in code snippets.
The document discusses decision making and if statements in Java. It provides examples of using if statements to compare integers, floating point numbers, strings, and objects. It also covers comparing values using relational operators and validating user input. The document shows how to use cascaded if/else if statements to handle multiple alternatives and conditional logic. Examples are provided to simulate an elevator that skips the 13th floor and to describe earthquake damage based on magnitude on the Richter scale.
This document proposes a standard called AR-LEM for Augmented Reality Learning Experience Models. It describes models for activities, workplaces and augmentations that can be used to create augmented reality learning experiences. The activity model defines action steps, triggers, instructions and flow. The workplace model defines tangible people, places and things that can be activated or deactivated. It also describes how to attach augmentations like overlays, videos and 3D models to tangibles. The document provides examples of using these models to assemble an augmented reality activity for assembling a cabinet, including activating overlays on detected markers and transitioning between action steps.
The document discusses object-oriented programming concepts like objects, classes, encapsulation, inheritance and polymorphism. It provides examples of how real-world entities like a dog, car etc. can be modeled as objects in code with their state represented by variables and behavior by methods. A class defines the common properties of objects and acts as a blueprint from which individual objects are created. Encapsulation binds data and methods operating on that data within an object. Polymorphism allows the same message to be interpreted differently by different objects through operator and function overloading.
Transfer learning, active learning using tensorflow object detection api설기 김
Explanation of tensorflow object detection, explanation of transfer learning, active learning, test result using actual data.
An introduction to the tool that makes it easy to use object detection api is also included.
The full version with animations can be found in this link.
https://docs.google.com/presentation/d/11EVzICHMw3UbNRRaODxQVT0qhuHrzpMhBCnVZy4FrhI/edit?usp=sharing
ppt of class and methods in java,recursion in java,nested class,java,command line argument,method overloading,call by value,call by reference,constructor overloading core java ppt
This document provides an agenda for introducing Erlang. It begins with a brief history of Erlang, noting it was created by Ericsson for developing telecommunication systems and needed to support concurrency and error recovery. The rest of the agenda covers key Erlang features like concurrency, distribution, and hot code loading. It also discusses Erlang/OTP design patterns, common tools, applications developed in Erlang, integrated development environments for Erlang, Erlang syntax like functions and modules, how to obtain Erlang, and concludes with a question and answer section.
This document contains a Java practical file belonging to Rachit Gupta, an MCA student. It consists of 16 programs of varying complexity written in Java, along with the output of each program. The programs cover topics such as calculating the square root of a number, finding the perimeter of a rectangle, calculating percentage of marks, and generating an electric bill based on units consumed. The file is a submission of Rachit Gupta's Java practical assignments for his 4th semester MCA course at the University of Jammu.
The document discusses sorting and searching algorithms. It introduces selection sort and insertion sort. Selection sort works by repeatedly finding the smallest element and swapping it into the sorted position. Insertion sort iterates through the array and inserts each element into the sorted position. The document also introduces merge sort, which works by recursively sorting and merging halves of the array.
The document outlines a Java programming practical course covering various Java concepts and programs. It includes 40 practical programs to be completed ranging from basic programs to find area of a circle, factorial of a number to more advanced programs involving OOP concepts like inheritance, abstraction, exception handling and multithreading. It also provides the evaluation and marking scheme for the practical exam.
This document provides code examples and exercises for learning Java programming. It lists chapter exercises from the book "Java Programming 7th Edition by Joyce Farrell" and additional examples from other sources. The examples cover topics like converting between units of measurement, calculating projections, and interactive guessing games. The document also includes sample code for making the examples interactive by prompting the user for input via dialog boxes.
Introduction to theano, case study of Word EmbeddingsShashank Gupta
Theano is a Python library that allows defining, optimizing, and evaluating mathematical expressions involving multi-dimensional arrays efficiently. It can compile expressions into optimized C code for fast CPU and GPU execution. Theano uses symbolic differentiation to automatically compute gradients for neural network training via backpropagation. It represents computations as a graph with variable nodes and operation nodes. This graph can be optimized before generating efficient C code. Theano is useful for machine learning algorithms that require large-scale numeric optimization like neural networks. The document discusses implementing word embedding models in Theano including autoencoder, GloVe, and skip-gram negative sampling models. Code examples are provided in GitHub links.
Java's eight primitive data types each have a corresponding wrapper class that allows them to be used as objects. The wrapper classes are in the java.lang package and include classes like Integer and Double. Wrapper classes "wrap" the primitive types in objects. For example, an Integer object holds an int value. Wrapper classes have methods to convert between the primitive type and its object representation.
JavaScript objects must implement certain standard properties and methods. Objects have a prototype property that is either an object or null, and prototype chains must have finite length. The typeof operator returns a string indicating the type of a variable or value. JavaScript supports basic types like undefined, null, boolean, number, string, and object. Functions are objects that can be called, and have properties like length and arguments. Variables declared with var have function scope, while variables assigned without var have global scope. Arrays, objects, and functions can be declared using various syntaxes. JavaScript uses prototypal inheritance rather than classes.
The document discusses exception handling in Java. It defines different types of errors like logical errors, compilation errors, and runtime errors. It explains checked and unchecked exceptions. It describes how to handle exceptions using try, catch, and finally blocks. It provides examples of handling ArithmeticException and other exceptions. It also discusses multi-catch, throw statement, re-throwing exceptions, and throws keyword to declare exceptions in method signatures.
Why we cannot ignore Functional ProgrammingMario Fusco
The document discusses several key concepts in functional programming including:
1) Pure functions that are referentially transparent and have no side effects like modifying variables or data structures.
2) Immutable data and persistent data structures that allow for sharing without synchronization.
3) Separating computational logic from side effects improves modularity and allows for parallelization.
4) A pure functional core can be wrapped with functions that have side effects to push effects to the outer layers.
Java supports generics as of version 1.5 to allow type-safe operations on parameterized types like List<String>. Generics eliminate the need for explicit casting when adding and retrieving elements. Wildcard types like List<?> provide flexibility but are more limited than specific types. Generic methods allow algorithms to operate on types in a generic way through type parameters.
The document provides the syllabus for a Java lab course. It outlines 11 programming assignments that students must complete, including developing classes for rational numbers, dates, Lisp-like lists, stacks, vehicles, currency conversion, and a scientific calculator. It provides sample code and algorithms for implementing a rational number class, date class, Lisp list operations, stack data structure using arrays and linked lists, vehicle class hierarchy demonstrating polymorphism, currency classes for serialization, and a basic calculator using event-driven GUI programming.
This document provides an overview of various Java operators including:
- Arithmetic operators like +, -, *, /, %
- Relational operators like >, <, ==, !=
- Assignment operators like =
- Logical operators like &&, ||, !
- Increment/decrement operators like ++, --
- Bitwise operators like &, |, ^
- String concatenation operator +
- Ternary operator ?:
It includes examples of using each operator and discusses shorthand operators, precedence rules, and automatic type conversions. Key operator types like arithmetic, relational, logical and bitwise are defined along with examples of using each in code snippets.
The document discusses decision making and if statements in Java. It provides examples of using if statements to compare integers, floating point numbers, strings, and objects. It also covers comparing values using relational operators and validating user input. The document shows how to use cascaded if/else if statements to handle multiple alternatives and conditional logic. Examples are provided to simulate an elevator that skips the 13th floor and to describe earthquake damage based on magnitude on the Richter scale.
This document proposes a standard called AR-LEM for Augmented Reality Learning Experience Models. It describes models for activities, workplaces and augmentations that can be used to create augmented reality learning experiences. The activity model defines action steps, triggers, instructions and flow. The workplace model defines tangible people, places and things that can be activated or deactivated. It also describes how to attach augmentations like overlays, videos and 3D models to tangibles. The document provides examples of using these models to assemble an augmented reality activity for assembling a cabinet, including activating overlays on detected markers and transitioning between action steps.
The document discusses object-oriented programming concepts like objects, classes, encapsulation, inheritance and polymorphism. It provides examples of how real-world entities like a dog, car etc. can be modeled as objects in code with their state represented by variables and behavior by methods. A class defines the common properties of objects and acts as a blueprint from which individual objects are created. Encapsulation binds data and methods operating on that data within an object. Polymorphism allows the same message to be interpreted differently by different objects through operator and function overloading.
Transfer learning, active learning using tensorflow object detection api설기 김
Explanation of tensorflow object detection, explanation of transfer learning, active learning, test result using actual data.
An introduction to the tool that makes it easy to use object detection api is also included.
The full version with animations can be found in this link.
https://docs.google.com/presentation/d/11EVzICHMw3UbNRRaODxQVT0qhuHrzpMhBCnVZy4FrhI/edit?usp=sharing
Slides for the Cluj.py meetup where we explored the inner workings of CPython, the reference implementation of Python. Includes examples of writing a C extension to Python, and introduces Cython - ultimately the sanest way of writing C extensions.
Also check out the code samples on GitHub: https://github.com/trustyou/meetups/tree/master/python-c
This document provides information about an artificial intelligence course at Sanjivani College of Engineering, including the course objectives, an overview of planning in AI, types of planning strategies like forward and backward state space planning, and an example of the block world planning problem. It also discusses logical representations of planning problems using first-order logic, the STRIPS planning framework, and an algorithm for goal stack planning.
IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...IRJET Journal
This document provides an unabridged review of supervised machine learning regression and classification techniques. It begins with an introduction to machine learning and artificial intelligence. It then describes regression and classification techniques for supervised learning problems, including linear regression, logistic regression, k-nearest neighbors, naive bayes, decision trees, support vector machines, and random forests. Practical examples are provided using Python code for applying these techniques to housing price prediction and iris species classification problems. The document concludes that the primary goal was to provide an extensive review of supervised machine learning methods.
This document describes a Python program that simulates gravitational interactions between bodies using numerical integration methods like Euler, Runge-Kutta, and Crank-Nicholson. The program uses classes, multiprocessing for plotting, unit testing, documentation, and is managed as an open source project on GitHub. Profiling identified the gravity calculation as the most computationally intensive part.
In this talk, I'm presenting an alternative approach to thinking about UI and navigation on iOS - one that is declarative and that I find easy to reason about in a big application. I did live coding and the link is on the last slide. Enjoy!
Presentation from JVMLS 2015
One bottleneck in the Nashorn JavaScript engine is startup time. Nashorn, as it works currently in Java 8, JITs everything to Java bytecode, accruing overhead in code generation and class installation. Nashorn in Java 9, can in unfortunate cases, increase this compilation workload significantly, as the new optimistic type system, which has greatly increased steady state performance, requires more code invalidation on warmup. Based on our optimistic type compilation framework, which contains all the mechanisms for quick code replacement and on stack replacement on the bytecode level, I will present the new execution architecture we are developing. It will minimizes compile time intelligently, while maintaining or possible even increasing code performance, due to extra profiling and execution frequency information being passed to the JIT. I will also talk about what the future will bring in terms of other dynamic languages on the Nashorn engine, partial method compilation of hot paths and other intriguing possibilities that our new execution model opens up.
This document provides an introduction to holographic development using the HoloLens. It discusses the different devices that can be used, how to set up the HoloLens SDK and build a first app. It covers input methods like gaze, tapping, and voice commands. The rest of the document demonstrates HoloLens development tools like the HoloToolkit and how to implement features like spatial mapping, gestures, and shaders. It concludes with a discussion of future mixed reality devices.
This document provides an overview and introduction to the Drools5 Community Training course. It discusses the theoretical background of artificial intelligence, expert systems, and rule-based production systems. It also introduces the main modules of the Drools Business Logic Integration Platform including Drools Expert, jBPM5, Drools Fusion, and Drools Guvnor.
This tutor puts a trip to the kingdom of object recognition with computer vision knowledge and an image classifier.
Object detection has been witnessing a rapid revolutionary change in some fields of computer vision. Its involvement in the combination of object classification
as well as object recognition makes it one of the most challenging topics in the domain of machine learning & vision.
This document discusses Python assertion and unit testing. It provides an example of using assertions to validate the output of a factorial function. Assertions allow checking conditions and halting the program if a condition is false. The document also covers unit testing frameworks in Python like unittest, and describes common concepts like test fixtures, test cases, test suites, and test runners. It provides an example unittest code to test the factorial function with common assertion methods like assertEqual.
The Ring programming language version 1.7 book - Part 85 of 196Mahmoud Samir Fayed
The document discusses embedding Ring programs within other Ring programs using the ringvm library. It describes functions for running Ring code in isolated states to prevent conflicts, executing programs serially, passing variables between states, and running Ring programs from other programs while controlling memory management. The goal is to provide safe integration of Ring programs and applications.
This document provides an introduction to Android development, covering key concepts like activities, intents, services, and broadcast receivers. It explains that activities represent screens in an app and make up the user interface. The activity lifecycle and how to declare activities are described. Intents are used to start activities, services, and send broadcasts. Services run in the background without a UI, and broadcast receivers allow apps to listen for system events and intents. Examples of implementing services and broadcast receivers are also provided.
The Ring programming language version 1.3 book - Part 7 of 88Mahmoud Samir Fayed
Ring 1.3 includes improvements to RingQt classes, the Objects library, LibCurl, and other features. Better RingQt classes allow getting event information and enabling/disabling events. The updated Objects library manages GUI objects and provides a natural API for creating windows from classes. RingLibCurl adds functions wrapping LibCurl. Other enhancements include better support for calling methods from object attributes, displaying compiler warnings, and code quality improvements.
Aspect oriented programming (AOP) allows encapsulation of cross-cutting concerns in separate units called aspects. This modularizes functionality that spans multiple classes. Spring provides AOP support through @AspectJ annotations or XML configuration. Advice like before, after returning, and around intercept method invocations defined by pointcut expressions. This separates concerns and promotes loosely coupled and reusable code.
The document provides an overview of key Android application components:
- Activities represent a single screen in an app and have a defined lifecycle managed by the ActivityManager.
- Services run in the background without a UI and are started via Intents.
- Broadcast receivers listen for system broadcasts and app-defined Intents.
- The document discusses creating an Android Studio plugin to generate CreateIntent methods for passing data between activities.
- It provides examples of how code generator plugins work by modifying the code in the current file based on the cursor position. The plugin would generate the CreateIntent method code based on the fields in the class.
- The key aspects of creating such a plugin involve using the Android Studio API to access the current file and class, generate the method code as a PsiElement, and insert it into the class. This allows automatically generating boilerplate code to reduce errors and effort.
Architecting Single Activity Applications (With or Without Fragments)Gabor Varadi
Presentation by Gabor Varadi (@zhuinden)
What Activity and Fragment actually are in Android
What are the problems they solve, and what are their downsides
How to use a custom solution that simplifies navigation in Android applications
https://github.com/Zhuinden/navigation-example
Similar to Reactive Autonomous System Programming using the PROFETA tool (20)
The document discusses unmanned aerial vehicles (UAVs) and multi-UAV systems. It provides background on different types of flying machines, including fixed-wing aircraft, helicopters, and multirotors. Multirotors have become popular due to several technological revolutions that made their components smaller, lighter, and more powerful. The document then covers multirotor basics, including their reference systems, common airframe designs, and how thrust and rotational motions are achieved by modulating the speeds of multiple synchronized rotors.
The document describes the I2C (Inter-Integrated Circuit) bus interface. I2C is a digital communication protocol used to connect integrated circuits on the same circuit board. It uses just two bidirectional open-drain lines - serial data (SDA) and serial clock (SCL). Devices on the I2C bus can operate as either a master or slave. The master device initiates and controls data transfers. Slave devices respond to the master's commands. The document outlines the electrical considerations, addressing schemes, data transfer protocols, and how to implement I2C on a PIC18F25K22 microcontroller.
Timers 1, 3, and 5 of the PIC18 microcontroller family are versatile 16-bit timers that can be clocked from various sources and prescaled. They support overflow interrupts and gating. The PIC18 also includes 5 Capture-Compare-PWM (CCP) modules that can be configured to operate in capture, compare, or PWM modes to interact with the timers in hardware without interrupts. Each CCP module is associated with a pin and selectable timer.
Pulse Width Modulation Signal Generation with MCUsCorrado Santoro
Pulse Width Modulation (PWM) is a technique that modulates a digital signal to produce an analog effect. It generates a square wave with varying duty cycle, which is the ratio of the high pulse duration to the total period. PWM can be used to transfer analog values over digital lines, modulate intensity of lights and power systems like DC motors. While microcontrollers have hardware for PWM generation, it can also be done in software by setting a timer to produce pulses with frequencies and durations defined by the desired duty cycle.
Timers 2, 4, and 6 of PIC18 microcontrollers are 8-bit timers that use a prescaler to divide the clock source frequency. They increment until they reach the value in the period register, then reset to 0 and trigger an interrupt. The interrupt can be further divided by a programmable postscaler value between 1 and 16. These timers provide a method of generating periodic interrupts for tasks like PWM or software timing in PIC18 microcontrollers.
This document describes using a finite state machine (FSM) approach to handle asynchronous events in microcontroller units (MCUs). It provides an example of toggling LEDs in response to button presses without using busy-waiting. The example encodes the button states as states in a FSM with states like "CHECK FOR PRESS" and "CHECK FOR RELEASE". Transitioning between these states based on button input allows handling events asynchronously and without blocking other tasks. It also describes adding a software timer to flash an LED while still handling button presses.
The document discusses the author's experiences programming robotic systems for competitions using different approaches, languages and tools over time. It describes how they initially used Erlang and the ERESYE logic programming engine to represent the robot's environment, state and behavior with facts and production rules. It then explains how they transitioned to using Python and developed the PROFETA tool when upgrading the robot's hardware, as an Erlang VM was not available for the new ARM board. The author also explores how they considered shifting from a pure logic-based approach to using the Belief-Desire-Intention model of agency.
The document proposes a system of self-organizing UAVs that can autonomously cover a wide area for monitoring purposes. The UAVs form a flock through an overlay network and use algorithms for flock formation and path planning to efficiently cover the terrain. A simulator was developed to validate the approach and test its fault tolerance. Further studies are needed to evaluate performance under different conditions. The goal is to apply the system to monitor landslides using real UAVs.
The document describes implementing a system-on-chip (SoC) using VHDL that includes a CPU, ROM, and parallel I/O port. The CPU is a 32-bit RISC architecture with 32 general purpose registers and instructions include MOV, ADD, SUB, LOAD, STORE. The ROM stores the program code. The parallel I/O port interfaces with external devices and responds to memory reads and writes. Implementation details are provided for each component in VHDL including register definitions, control signals, and finite state machines to describe operation.
The document discusses using the Ready-for-PIC board and SDR libraries to interact with the board's peripherals. It covers initializing and using digital I/O lines, timers, and the analog-to-digital converter. The SDR library provides functions to easily initialize and control these components without needing in-depth knowledge of the microcontroller's registers. Interrupts from timers and other peripherals can also be handled using the library functions. Example code is provided to illustrate flashing LEDs using timers and reading pushbuttons.
Erlang uses pattern matching rather than variable assignment. When using the = symbol in Erlang, it matches the left-hand side to the right-hand side rather than assigning a value. This means a variable can only be matched once - a bound variable cannot be reused like in other languages. So a statement like A = A + 1 would generate an error, as it is trying to match the already bound variable A to a new value.
The document provides an overview of the Unix shell and its basic concepts:
- The shell allows users to interact with the operating system by entering commands
- Common Unix shells include bash, csh, and ksh
- The shell prompt displays information about the user and current directory
- Commands can be run internally by the shell or externally by spawning new processes
- Processes have attributes like the command line, exit status, and environment variables
An analog to digital converter (ADC) samples an analog input signal and converts it to a digital value. The document discusses the basic components and configuration of an ADC, including setting the input range and reference voltages, data format, clock source, and enabling the ADC. It also provides an example of using an ADC to control the flashing frequency of an LED based on the voltage from an analog sensor.
This document describes two exercises using timers and UART on a microcontroller. The first exercise implements a light that turns on with a pushbutton and off automatically after 10 seconds, with a flashing LED indicating when it will turn off. The second exercise adds the ability to configure the timer values through UART commands. It describes the timer, UART, and program setup as well as the main program flow and configuration function.
The document discusses using the Universal Asynchronous Receiver/Transmitter (UART) peripheral in Microchip PIC18F microcontrollers for serial communication. It describes the basics of UART transmission including start bits, data bits, optional parity bits, and stop bits. It also covers setting the baud rate generator, transmitting and receiving bytes using the transmitter and receiver hardware, and handling errors like overrun and framing errors. The UART in the PIC18F25K22 microcontroller is used as a specific example.
The document discusses how to handle interrupts in Microchip PIC18F microcontrollers. It explains that peripherals can generate interrupts on events like timer overflow or UART transmission. The microcontroller routes interrupts to the CPU when the global interrupt enable (GIE) bit is set. It provides steps to enable interrupts for a specific peripheral by setting the peripheral's interrupt flag (IF), interrupt enable (IE) bit, and clearing IF after handling the interrupt. Interrupts can optionally use two priority levels by setting the interrupt priority enable (IPEN) bit. The document also gives an example of using timer interrupts to blink an LED based on a pushbutton input.
TIMER0 is an 8/16-bit timer in PIC18F microcontrollers that can be used to track time. It uses an internal or external clock source, and its frequency can be divided with a prescaler. TIMER0's value is stored in registers and increments in hardware. When it overflows at the maximum value, an interrupt flag is set. Software can check this flag to trigger events at timed intervals without needing to continuously check the timer value. Using overflow mode reduces code complexity compared to clearing the timer value periodically.
Programming the Digital I/O Interface of a PIC microcontrollerCorrado Santoro
The document discusses the digital I/O interface of Microchip PIC18F microcontrollers. It explains that each pin can be programmed as an input or output. As an input, the pin can read logic high or low voltages to detect button presses or sensor signals. As an output, it can generate voltages to control LEDs or other devices. The document provides examples of connecting buttons, sensors, and LEDs to digital pins and programming the pins as inputs and outputs using configuration registers to read button states and toggle an LED.
The document introduces microcontrollers, which are integrated circuits that contain all components of a basic computer system on a single chip. It describes the typical components of a microcontroller, including a CPU, memory, input/output peripherals, and communication interfaces. It also discusses how microcontrollers are commonly used in devices like appliances, vehicles, and industrial equipment. The document focuses on the PIC18F25K22 microcontroller, outlining its memory resources and peripherals that can be programmed through special function registers using the C programming language.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
Reactive Autonomous System Programming using the PROFETA tool
1. Programming using the PROFETA tool
Reactive Autonomous System Programming
using the PROFETA tool
Corrado Santoro
ARSLAB - Autonomous and Robotic Systems Laboratory
Dipartimento di Matematica e Informatica
Universit` di Catania, Italy
a
santoro@dmi.unict.it
Miniscuola WOA 2013 - Torino, 04 Dicembre 2013
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
1
2. Programming using the PROFETA tool
Outline
1 Introducing PROFETA
Basic Entities
Beliefs and Actions
Sensors
Execution Semantics
2 Special features of
3 Goals in PROFETA
Basics
Why Goals?
Goal Failure
4 Contexts in PROFETA
PROFETA
Special Kind of Beliefs
Special Kind of Actions
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
Motivation Scenarios
Defining and Using
Contexts
2
3. Programming using the PROFETA tool
Introducing PROFETA
Introducing PROFETA
Introducing PROFETA
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
3
4. Programming using the PROFETA tool
Introducing PROFETA
Basic Entities
PROFETA Basics
PROFETA (Python RObotic Framework for dEsigning
sTrAtegies) is Python tool for programming autonomous
systems (agents or robots) using a declarative approach.
PROFETA has been designed at ARSLAB @ UNICT in 2010.
The aim is to have a single environment to implement the
software of an autonomous robot.
It provides an “all-in-one” environment supporting both
imperative (algorithmical part) and declarative (behavioural
part) programming models.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
4
5. Programming using the PROFETA tool
Introducing PROFETA
Basic Entities
PROFETA Basics
PROFETA provides
A set of classes to represent basic BDI entities, i.e.
Beliefs ⇒ Knowledge
Goals ⇒ States to be achieved
Actions ⇒ Things to do to reach the Goals
A declarative language—dialect of AgentSpeak(L)—to express
agent’s behaviour
An engine executing that behaviour
A Knowledge base storing the beliefs
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
5
6. Programming using the PROFETA tool
Introducing PROFETA
Basic Entities
PROFETA Declarative Syntax
A PROFETA behaviour is a set of rules in the form
Event / Condition >> set of Action
where:
Event can be: belief assert or retract, goal achievement
request, goal failure.
Condition refers to a certain state of the knowledge base.
Action can be: belief assert or retract, goal achievement
request, user defined atomic action.
Example:
+object_at("X","Y") / object_got("no") >>
[ move_to("X", "Y"), pick_object() ]
Such expressions are managed thanks to operator
overloading
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
6
7. Programming using the PROFETA tool
Introducing PROFETA
Basic Entities
Basic Parts of a PROFETA Program
Download PROFETA from:
http://github.com/corradosantoro/profeta
Import the PROFETA libraries
Define beliefs and goals as subclasses of Belief and Goal
Define user actions by subclassing Action and overriding
method execute()
Instantiate the PROFETA Engine
Define the rules by means of the declarative sytntax
Run the Engine
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
7
8. Programming using the PROFETA tool
Introducing PROFETA
Basic Entities
“Hello World” in PROFETA
# import libraries
from profeta.lib import *
from profeta.main import *
# instantiate the engine
PROFETA.start()
# define a rule
+start() >> [ show_line("hello world from PROFETA") ]
# assert the "start()" belief
PROFETA.assert_belief(start())
# run the engine
PROFETA.run()
start() is a library belief
show line() is a library action
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
8
9. Programming using the PROFETA tool
Introducing PROFETA
Basic Entities
The “Picking Object” Robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from profeta . lib import *
from profeta . main import *
class object_at ( Belief ):
pass
class object_got ( Belief ):
pass
class move_to ( Action ):
def execute ( self ):
x = self [0]
y = self [1]
# ... perform movement to x , y
class pick_object ( Action ):
def execute ( self ):
# drive the arm to pick object
PROFETA . start ()
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >>
[ move_to ( " X " , " Y " ) , pick_object () , - object_got ( " no " ) , + object_got ( " yes " ) ,
- object_at ( " X " , " Y " ) ]
PROFETA . assert_belief ( object_got ( " no " ))
PROFETA . run ()
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
9
10. Programming using the PROFETA tool
Introducing PROFETA
Beliefs and Actions
Belief Syntax
A belief is defined as a subclass of Belief
In a rule, it is referred as an “atomic formula” with:
one or more ground terms, e.g. object at(123, 456)
one or more variables, e.g. object at("X", "Y")
A variable is expressed using a string starting with capitals
Within the set of actions:
+bel(...) asserts a belief in the KB
-bel(...) retracts a belief from the KB
As trigger event:
+bel(...) triggers the rule when the belief is asserted
-bel(...) triggers the rule when the belief is retracted
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
10
11. Programming using the PROFETA tool
Introducing PROFETA
Beliefs and Actions
Action Syntax
An action is defined as a subclass of Action
The execute() method has to implement the computation
which concretely performs the action; such a computation is
executed atomically
In a rule, it is referred as an “atomic formula” with:
one or more ground terms, e.g. move to(123, 456)
one or more variables, e.g. move to("X", "Y")
A variable is expressed using a string starting with capitals
In method execute() terms can be accessed as
self[term index]
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
11
12. Programming using the PROFETA tool
Introducing PROFETA
Beliefs and Actions
The “Picking Robot” Rule
1
2
3
4
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >>
[ move_to ( " X " , " Y " ) , pick_object () , - object_got ( " no " ) , + object_got ( " yes " ) ,
- object_at ( " X " , " Y " ) ]
That rule says:
When an object is seen at a certain position and ...
No object has been picked from the robot, then ...
Move to that position, pick the object, and ...
Update the beliefs in order to reflect the new state.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
12
13. Programming using the PROFETA tool
Introducing PROFETA
Sensors
Sensors
Belief object at() is intended to be asserted as soon as an
object is found (or detected) at a certain position.
How is such a detection performed?
A Sensor class is provided with the objective of allowing the
programmer to write the proper code to “sense” the
environment and generate the proper beliefs.
The programmer has to:
subclass Sensor
override the sense() method
inform the Engine that a new sensor has been added in the
program.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
13
14. Programming using the PROFETA tool
Introducing PROFETA
Sensors
The “Picking Object” Robot with a Sensor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
....
class ObjectSensor ( Sensor ):
def sense ( self ):
Obj = detect_an_object ()
if Obj is None :
return None
else :
(x , y ) = Obj
return + object_at (x , y )
PROFETA . start ()
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >>
[ move_to ( " X " , " Y " ) , pick_object () , - object_got ( " no " ) , + object_got ( " yes " ) ,
- object_at ( " X " , " Y " ) ]
PROFETA . assert_belief ( object_got ( " no " ))
PROFETA . add_sensor ( ObjectSensor ())
PROFETA . run ()
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
14
15. Programming using the PROFETA tool
Introducing PROFETA
Sensors
Sensor Semantics
1
2
3
4
5
6
7
8
9
10
11
12
....
class ObjectSensor ( Sensor ):
def sense ( self ):
Obj = detect_an_object ()
if Obj is None :
return None
else :
(x , y ) = Obj
return + object_at (x , y )
...
Method sense() may return
None, nothing has been sensed
+bel(...), something has been sensed, a belief is added to
the KB and the “add event” is generated.
bel(...), something has been sensed, a belief is added to
the KB but the “add event” is NOT generated.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
15
16. Programming using the PROFETA tool
Introducing PROFETA
Execution Semantics
PROFETA Structures
Terminology (according to AgentSpeak):
A Plan is a rule of the PROFETA program
An Intention is a plan which is selected for execution (the
instantiation of a plan)
PROFETA Structures:
An Event Queue which stores add/retract belief events
An Intention Stack which stores Intentions to be executed
A Sensor Set which stores instantiated sensors
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
16
17. Programming using the PROFETA tool
Introducing PROFETA
Execution Semantics
PROFETA (Informal) Execution Semantics
PROFETA Main Loop Execution:
1
If the Intention Stack is not empty, execute an action step and
go to 1.
2
If the Event Queue is not empty, pick an event, find the
relevant plan, verify the condition part and then put the plan
at the top of Intention Stack, then go to 1.
3
If both the Intention Stack and Event Queue are empty, scan
sensors in Sensor Set and, for each of them, call the sense()
method and analyse the return value; if it is an event, put it in
the Event Queue.
4
Go to 1.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
17
18. Programming using the PROFETA tool
Special features of PROFETA
Special features of PROFETA
Special features of PROFETA
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
18
19. Programming using the PROFETA tool
Special features of PROFETA
Special Kind of Beliefs
Special Kind of Beliefs
1
2
3
4
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >>
[ move_to ( " X " , " Y " ) , pick_object () , - object_got ( " no " ) , + object_got ( " yes " ) ,
- object_at ( " X " , " Y " ) ]
Here ...
Belief object at() represents that “an object has been
detected”; after plan execution, the belief is removed.
Belief object got() represents a state of the robot, which
could have picked or not the object. Only one belief of this
kind can be present in the KB.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
19
20. Programming using the PROFETA tool
Special features of PROFETA
Special Kind of Beliefs
Special Kind of Beliefs
To support such cases, the following “special beliefs” are provided:
Reactors, i.e. beliefs which are automatically removed from
the KB when the associated plan is executed.
SingletonBeliefs, i.e. beliefs which are “single instance”.
Therefore ...
1
2
3
4
5
6
7
8
9
10
11
12
13
...
class object_at ( Reactor ):
pass
class object_got ( SingletonBelief ):
pass
...
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >>
[ move_to ( " X " , " Y " ) , pick_object () , + object_got ( " yes " ) ]
...
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
20
21. Programming using the PROFETA tool
Special features of PROFETA
Special Kind of Actions
Example: Factorial in PROFETA Using Reactors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from profeta . lib import *
from profeta . main import *
class fact ( Reactor ):
pass
class KB ( Sensor ):
def sense ( self ):
e = raw_input ( " Enter Number : " )
return + fact ( int ( e ) , 1)
PROFETA . start ()
PROFETA . add_sensor ( KB ())
+ fact (1 , " X " ) >> [ show ( " the resuilting factorial is " ) , show_line ( " X " ) ]
+ fact ( " N " , " X " ) >> [ " Y = int ( N ) * int ( X ) " , " N = int ( N ) - 1 " , + fact ( " N " , " Y " ) ]
PROFETA . run ()
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
21
22. Programming using the PROFETA tool
Special features of PROFETA
Special Kind of Actions
Special Kind of Actions
1
2
3
4
5
6
...
+ fact (1 , " X " ) >> [ show ( " the resuilting factorial is " ) , show_line ( " X " ) ]
+ fact ( " N " , " X " ) >> [ " Y = int ( N ) * int ( X ) " , " N = int ( N ) - 1 " , + fact ( " N " , " Y " ) ]
...
show() and show line() are library actions which are used
to print an output onto the screen.
An action can also be any Python expression, given that it is
expressed as a string (string action)
A string action can manipulate and create any plan variable
but... look out!! PROFETA is not typed!
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
22
23. Programming using the PROFETA tool
Goals in PROFETA
Goals in PROFETA
Goals in PROFETA
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
23
24. Programming using the PROFETA tool
Goals in PROFETA
Basics
Goals
Goals are (according to AgentSpeak(L)) “states of the
systems which an agent wants to achieve”, but indeed ...
... a goal is something like a “procedure plan” which expresses
the things to do to achieve the goal itself.
In PROFETA, a goal:
is first defined as a subclass of Goal
it is expressed, in the plans, as an “atomic formula”, with zero
or more terms.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
24
25. Programming using the PROFETA tool
Goals in PROFETA
Basics
Example: Factorial with goals
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from profeta . lib import *
from profeta . main import *
class do_factorial ( Reactor ):
pass
class fact ( Goal ):
pass
class KB ( Sensor ):
def sense ( self ):
e = raw_input ( " Enter Number : " )
return + do_factorial ( int ( e ))
PROFETA . start ()
PROFETA . add_sensor ( KB ())
+ do_factorial ( " N " ) >> [ show ( " computing factorial of " ) , show_line ( " N " ) ,
fact ( " N " , 1) ]
fact (1 , " X " ) >> [ show ( " the resuilting factorial is " ) , show_line ( " X " ) ]
fact ( " N " , " X " ) >> [ " Y = int ( N ) * int ( X ) " , " N = int ( N ) - 1 " , fact ( " N " , " Y " ) ]
PROFETA . run ()
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
25
26. Programming using the PROFETA tool
Goals in PROFETA
Basics
The “Object Picker” with Goals
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from profeta . lib import *
from profeta . main import *
class object_at ( Reactor ):
pass
class object_got ( SingletonBelief ):
pass
class pic k_object_at ( Goal ):
pass
class move_to ( Action ):
def execute ( self ):
# ... perform movement to x , y
class drive_arm ( Action ):
def execute ( self ):
# drive the arm to pick object
PROFETA . start ()
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >> [ pick_object_at ( " X " , " Y " ) ,
+ object_got ( " yes " ) ]
pick _object_at ( " X " , " Y " ) >> [ move_to ( " X " , " Y " ) , drive_arm () ]
PROFETA . assert_belief ( object_got ( " no " ))
PROFETA . run ()
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
26
27. Programming using the PROFETA tool
Goals in PROFETA
Why Goals?
Why Goals?
Goals are “procedures”, thus they help to better organize your
PROFETA program, e.g.
1
2
3
4
... >> [ goal1 () , goal2 () , goal3 () ]
goal1 () >> [ ... do something ... ]
goal2 () >> [ ... do something ... ]
goal3 () >> [ ... do something ... ]
Goals can introduce branches since a condition is allowed in
the head of the rule, e.g.
1
2
pick_object_at ( " X " , " Y " ) / ( lambda : X < 100) >> [ move_to ( " X " , " Y " ) , ... ]
pick_object_at ( " X " , " Y " ) / ( lambda : X >= 100) >> [ # do other things ]
Goals may fail!
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
27
28. Programming using the PROFETA tool
Goals in PROFETA
Goal Failure
Goal Failure
Let us suppose that the robot cannot reach the object if it is
located around position (1500, 1000), so:
1
2
3
4
5
6
7
8
9
...
def is_reachable (x , y ):
return math . hypot ( x - 1500 , y - 1000) > 100
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >> [ pick_object_at ( " X " , " Y " ) ,
+ object_got ( " yes " ) ]
pick_object_at ( " X " , " Y " ) / ( lambda : is_reachable (X , Y )) >>
[ move_to ( " X " , " Y " ) , ... ]
pick_object_at ( " X " , " Y " ) >> [ fail () ] # the goal fails !
Library action fail() causes the current goal to fail
Calling goals/plans fail in sequence (is something like an
exception)
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
28
29. Programming using the PROFETA tool
Goals in PROFETA
Goal Failure
Recovery Actions
A goal failure can be triggered also within the code of an
Action, by calling fail().execute()
A failure event can be catched by a rule in order to try a
recovery action
To catch a failure of a goal g, the related event is -g(), e.g.
1
2
3
4
5
6
7
...
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >> [ pick_object_at ( " X " , " Y " ) ,
+ object_got ( " yes " ) ]
pick_object_at ( " X " , " Y " ) / ( lambda : is_reachable (X , Y )) >>
[ move_to ( " X " , " Y " ) , ... ]
pick_object_at ( " X " , " Y " ) >> [ fail () ] # the goal fails !
- pick_object_at ( " X " , " Y " ) >> [ ... do smthg to perform recovery ... ]
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
29
30. Programming using the PROFETA tool
Goals in PROFETA
Goal Failure
Goal Failure Semantics
If we have
1
2
3
4
... >> [ goal1 () , ... ]
goal1 () >> [ goal2 () ]
goal2 () >> [ goal3 () ]
goal3 () >> [ ... , fail () ]
In plan in line 4, we have a stack of goal calls goal1() →
goal2() → goal3(), and goal3() fails, thus
If a plan related to -goal3() exists, it is first executed;
otherwise, if a plan related to -goal2() exists, it is executed;
otherwise, if a plan related to -goal1() exists, it is executed;
otherwise, the calling plan of goal1() (line 1) is interrupted.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
30
31. Programming using the PROFETA tool
Contexts in PROFETA
Contexts in PROFETA
Contexts in PROFETA
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
31
32. Programming using the PROFETA tool
Contexts in PROFETA
Motivation Scenarios
Scenario 1: Synchronous vs. Asynchronous Actions
According to PROFETA execution semantics, Sensors are
polled only if there are no intentions to be executed
Therefore, during intention execution, an agent/robot is
blind, w.r.t. events which could happen in the environment
Action dynamics/duration matters!! E.g.
If action move to(X,Y) is synchronous, i.e. it waits for the
robot to reach the desired position, no events can be captured
during the move!
In a robotic application this is quite undesirable.
Solution:
Make action move to(X,Y) asynchronous and add a Sensor
checking that the target position has been reached.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
32
33. Programming using the PROFETA tool
Contexts in PROFETA
Motivation Scenarios
The “Object Picker” with Asynchronous move to()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
class object_at ( Reactor ): pass
class object_got ( SingletonBelief ): pass
class target_got ( Reactor ): pass
class move_to ( Action ):
def execute ( self ):
# ... trigger movement to x , y and i m m e d i a t e l l y return
class drive_arm ( Action ):
def execute ( self ):
# drive the arm to pick object
class TargetGot ( Sensor ):
def sense ( self ):
if motion_control . target_reached (): return + target_got ()
else : return None
PROFETA . start ()
PROFETA . add_sensor ( TargetGot ())
+ object_at ( " X " , " Y " ) / object_got ( " no " ) >> [ move_to ( " X " , " Y " ) ]
+ target_got () >> [ drive_arm () , + object_got ( " yes " ) ]
PROFETA . assert_belief ( object_got ( " no " ))
PROFETA . run ()
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
33
34. Programming using the PROFETA tool
Contexts in PROFETA
Motivation Scenarios
Uncontextualised beliefs
Here, target got() is asserted whatever movement has been
started.
If we want to check that a certain movement is completed, we
should add a proper belief, e.g. to make the robot following a
path:
1
2
3
4
5
... >> [ move_to (1000 , 0) , + movement ( " one " ) ]
+ target_got () / movement ( " one " ) > >[ move_to (1000 , 1000) , + movement ( " two " ) ]
+ target_got () / movement ( " two " ) > >[ move_to (0 , 1000) , + movement ( " three " ) ]
+ target_got () / movement ( " three " ) >> [ show ( " yeahhh !!! " ) ]
...
that is, we have to add a contextual information by means of
additional beliefs.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
34
35. Programming using the PROFETA tool
Contexts in PROFETA
Motivation Scenarios
Scenario 2: A robot making “many things”
Let’s consider a robot which has to:
1
2
3
Gather at most 10 objects placed in the environment
Put the object into a specific container
Go to step 1.
Here we have two tasks or“macrostates” in which events
sensed from the environment may have require different
actions.
Contextual beliefs could be used but ...
... it could be better to have language constructs which allows
a better identification of the plans related to each task.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
35
36. Programming using the PROFETA tool
Contexts in PROFETA
Defining and Using Contexts
Contexts in PROFETA
PROFETA let a programmer to define contexts:
macrostates in which only specified plans can be triggered.
A context is defined by placing the statement
context(ContextName) in the plan list; after it, all plans will
be referred to ContextName.
At run-time, a context is “entered” by calling the library
action set context(ContextName).
This action asserts the library reactor start() which is used
to trigger an “intialization plan” in the entered context.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
36
37. Programming using the PROFETA tool
Contexts in PROFETA
Defining and Using Contexts
Contexts in PROFETA: An Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
class go ( Goal ): pass
go () >> [ set_context ( " pick_objects " ) ]
context ( " pick_objects " )
# put here plans for ’ p i c k _ o b j e c t ’ task
+ start () >> [ + objects_got (0) ]
+ o b j e c t _ d et e ct ed _ at ( " X " , " Y " ) >> [ move_to ( " X " , " Y " ) ]
+ target_got () / objects_got ( " N " ) >> [ drive_arm () , " N = N + 1 " ,
+ objects_got ( " N " ) , after_pick () ]
after_pick () / objects_got (10) >> [ set_context ( " put_away_objects " ) ]
context ( " put_away_objects " )
# put here plans for ’ p u t _ a w a y _ o b j e c t ’ task
+ start () >> [ move_to (1500 , 1000) ] # the position of the c o n t a i n e r
+ target_got () >> [ r e le a s e _ a l l _ ob j e c t s () , set_context ( " pick_objects " ) ]
PROFETA . achieve ( go ())
PROFETA . run ()
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
37
38. Programming using the PROFETA tool
Other Features
Other features
Other features
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
38
39. Programming using the PROFETA tool
Other Features
Handling specific Sensor Dynamics
Sensors are polled using the latency derived from the
execution of the main PROFETA loop
If you need to poll a Sensor with a specific dynamics, the
AsyncSensorProxy allows a Sensor to be decoupled from the
main loop
It can have its own peridicity (NOT guaranteed!!).
1
2
3
4
5
6
7
...
class MyAsyncSensor ( Reactor ):
def sense ( self ):
time . sleep ( millisecs /1000.0)
# perform sensing
PROFETA . add_sensor ( AsyncSensorProxy ( MyAsyncSensor ()))
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
39
40. Programming using the PROFETA tool
Other Features
Handling specific Action Dynamics
Actions can be easily made asynchronous by subclassing
AsyncAction instead of Action.
An AsyncAction is executed in a different thread w.r.t. that of
PROFETA main loop
1
2
3
4
5
6
7
...
class MyAsyncAction ( AsyncAction ):
def execute ( self ):
# ....
... >> [ ... MyAsyncAction (...) ... ]
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
40
41. Programming using the PROFETA tool
Conclusions
Conclusions
PROFETA allows to define robot strategies in a flexible and
intuitive way, by using the principles of the BDI model.
PROFETA combines the advantages of both imperative and
declarative approach, while offering an all-in-one environment
PROFETA performs quite well also in systems with few
memory, and has been successfully applied in various robot
built at ARSLab
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
41
42. Programming using the PROFETA tool
Conclusions
TO DO List
Concurrent Plans. But under the strong control of the
programmer.
MAS Support. Currently PROFETA does not support
muliple-agents: one robot/agent for virtual machine.
Better notion of Task (or “Goal”). A Task is what the
agent should do to achieve a specific goal. Why not mulitple
and different choices for a goal/task? This could give a
“deliberation ability” to agents.
Porting to other languages. Only Python? Why not C++?
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
42
43. Programming using the PROFETA tool
Conclusions
References
http://github.com/corradosantoro/profeta
L. Fichera, D. Marletta, V. Nicosia, C. Santoro. Flexible Robot Strategy
Design using Belief-Desire-Intention Model. In Proc. of International
Conference on Research and Education in Robotics (EUROBOT 2010),
Spriger CCIS Series, Rappreswille, Swizerland), May 27-30, 2010.
L. Fichera, D. Marletta, V. Nicosia, C. Santoro. A Methodology to
Extend Imperative Languages with AgentSpeak Declarative Constructs.
In Proc. of Workshop on Objects and Agents (WOA2010), CEUR-WS
Publisher, ISSN 1613-0073, Rimini, Italy, Sept. 5-7, 2010.
G. Fortino, W. Russo, C. Santoro. Translating Statecharts-based into BDI
Agents: The DSC/PROFETA case. MAS&S Workshop @ MATES 2013.
F. Messina, G. Pappalardo, C. Santoro. Integrating Cloud Services in
Behaviour Programming for Autonomous Robots. CSmart-CPS
Workshop, LNCS, 2013.
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
43
44. Programming using the PROFETA tool
Conclusions
Reactive Autonomous System Programming
using the PROFETA tool
Corrado Santoro
ARSLAB - Autonomous and Robotic Systems Laboratory
Dipartimento di Matematica e Informatica
Universit` di Catania, Italy
a
santoro@dmi.unict.it
Miniscuola WOA 2013 - Torino, 04 Dicembre 2013
Corrado Santoro - Using the PROFETA Tool - MiniScuola WOA 2013
44