Tuesday, December 20, 2011

ShanghAI lecture assignment 5

The final assignment of the lot. A number of very interesting questions were posted. We tried our best in coming up with the answers and here they are

assignment - questions and answers

ShangAI Ex 5 Solutions
Thanks and have fun :)
Abishek

ShanghAI lecture assignment 4

The next in this series of experiments involved understanding

1. Principle of cheap design
2. Emergent Behavior
3. Braitenberg Design

A famous experiment performed at Zurich was study of emergent behavior using a set of robots called the swiss cleaning robots.

The scenario is a number of blocks (garbage) are dispersed in a closed arena. Robots are needed to form heaps of the blocks thereby "cleaning the arena"

If the aim of your robot is to clean the room, conventional design requires a vision system in the robots to identify the location of the blocks, pushing them when encountered and avoiding the other robots.

But using the principle of cheap design, robots fitted with Braitenberg obstacle avoidance scheme are used to achieve this. How? The solutions are posted.

ASSIGNMENT

ShanghAI Exercise4

SOLUTION

Exercise 4 - Study Group 160

ShanghAI lecture assignment 3

This was a very exciting assignment. An evolutionary algorithm was used to evolve a robot dog using webots so that it is able to run for the longest time without tripping. Three scenarios were considered

1. Evolution of the brain alone
2. Evolution of the morphology alone
3. Co-Evolution of the brain and the morphology

All three scenarios were studied and a number of questions regarding the benefits of each case was answered. Find the solutions to assignment 3 here.

Assignment 3

ShanghAI Exercise Sheet 3 Minidog

Solution

Exercise 3 - Study Group 160

Thanks,
Abishek

ShanghAI lecture assignment 2

Hi,

The first assignment of this lecture series was to on general intelligence. The second assignment was more interesting and was based on passive dynamic walkers

Passive Dynamic Walkers are mechanical devices that can walk down a slope without any actuation. They are usually inspired by the human legs and, despite a complete lack of motors and sensors, display a very natural-looking walking motion. I am posting the solutions to this assignment here. I once again thank my team members Miss Stephanie Wartenburg, Miss Denise Reiser and Miss Xiong qu for working with me on all assignments.

ShanghAI ExerciseSheetPDW

SOLUTION

AI Exercise 2 - Study Group 160

ShanghAI lectures

I wanted to learn about artificial intelligence. What is a better way than to join a lecture series conducted by an expert in this field from one of the leading universities in the world?

Welcome to ShanghAI lectures.

ShangAI Lectures are a series of online lectures on Natural and Artificial Intelligence. A global classroom of students from different parts of the world get together, online, to know about the cutting edge research that is going on in the field of artificial intelligence.

http://shanghailectures.org/

The class is 3 hours in length through video conferencing. The classes are conducted by professor Rolf Pfiefer from the AI lab in Zurich. It starts off with the professor discussing a topic in front of the class. This is an interactive session where questions will be directed to different global classrooms on the topics being discussed. This is followed by guest lectures from eminent speakers on the field of robotics and artificial intelligence.

The lectures are held over a span of three months with a number of assignments where students are put together in a group and work together on assignments. The assignments are designed to provide a beginner with insight on the different methods adopted in the circles of artificial intelligence. The students get to learn and use Webots simulator which is a powerful simulator for simulating robots in a "real life" setting where they are subjected to forces programmed. (ex gravity).

Lecture Topics
A wide variety of topics are discussed on intelligence, thinking and artificial intelligence. An introduction is given on what is intelligence and artificial intelligence. The landscape is then described using the myriad of developmental robotic projects being carried out. Important concepts such as frame of reference and synthetic methodology are explained with very good examples by professor Rolf.

The properties on intelligent systems and the principles involved in designing them are explained beautifully in detail. The difference in real and virtual worlds and hence the need of an embodied approach was explained in a wonderful way. The different principles of designing agents were detailed with a number of examples for each principle driving home the importance of each principle.

The concept of how locomotion is essential to cognition, two seemingly unrelated activities, was elegantly described by professor Rolf. The assignments provided a deep insight on how "design is out and evolution is in". Evolutionary algorithms were used to describe how the parameters of a robotic dog can be varied to optimize it for a particular fitness. The fitness was the longest distance traversed without falling in case of the robot dog. The ways in which artificial evolution and neural networks are used in the the modern world was mind boggling.

The lectures took a dive into the science fiction path when they described how collective intelligent behavior can be used to have swarm of robots. Modular robots can be used to modify their morphology to achieve different functions. These discussions were very interesting and have made me more curious into this evolving field of artificial intelligence.

Group 160
I was assigned to a group which is proudly called group 160. We worked together on the assignment projects and it was a wonderful experience. There was a rich sharing of information and ideas as we worked on the assignments. It was amazing working with such hard working and extremely talented individuals. The group was also assigned a highly motivating mentor who graded our assignments and provided us with feedback, helped us when we got stuck and motivated us throughout the course. The dynamics of the group was almost perfect even when we had not known/seen each other before. I still have not seen any of my group mates still :) . I had a wonderful time working in group160 with very knowledgable people in my team.

Acknowledgement
I want to thank my team members Miss. Stephanie Wartenburg, Miss. Denise Rieser and Miss. Xiong qu for their active participation in the assignments, keeping me motivated and also providing me with a great amount of knowledge in this otherwise obscure field :). I also want to thank our supervisor Mr. Naveen Kuppuswamy for his motivation and valuable feedback.

Installing ROS on mac

The errors encountered when installing ROS in a MAC is documented here.

ROS installation in MAC

Installation of ROS in MAC
http://www.ros.org/wiki/electric/Installation/OSX

Error 1
When installing ROS in MAC, there comes a point where a number of tools are required to be installed. The installer automatically generates the scripts required to install the tools. It asks for your password. But the terminal sort of crashed and did not accept even if my password was correct.

The solution to this is we need to manually install the tools before installing ROS.

Dependencies in MAC -
sudo port install py26-pil
sudo port install py26-numpy
sudo port install google-test
sudo port install log4cxx
sudo port install boost
sudo port install py26-paramiko

run the ROS installer command from http://www.ros.org/wiki/electric/Installation/OSX

Error 2:
rosinstall command not found.
roslocate command not found


Solution:
export PATH=$PATH:/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin


RXGRAPH
rosmake rxtools
Running rxgraph gives the following error 
Error - ImportError: No module named gobject

Solution
The problem here is the symbolic link to python.
make sure the link to python in /usr/bin points to /opt/local/bin/python2.6
sudo mv /usr/bin/python /usr/bin/python_old
sudo ln -fsv /opt/local/bin/python2.6 /usr/bin/python

rosdep install rxtools
rosdep install rxgraph

Make sure all the following dependencies are met
sudo port install graphviz
sudo port install py26-cairo py26-gobject py26-gtk py26-wxpython
sudo port install py26-gtk

rosdep satisfy [package_name]

http://www.php-architect.com/blog/2009/02/25/installing-python-pygtk-on-mac-osx/
http://answers.ros.org/question/1364/rxgraph-no-module-named-gobject-os-x

ROS - Robot Operating Systems

You can find my notes in installation of ROS in a mac and the tutorials that are available on their website
here.

ROS - meta operating system for your robot. It provides hardware abstraction, low level device control, implementation of commonly used functionality, message passing between processes and package management.

Ot provides tools and libraries for obtaining, building, writing and running code across multiple computers. 

Communication in ROS - several different sytles of communication
1. synchronous RPC style communication over services
2. asynchronous streaming of data over topics
3. storage of data on a peremeter server.

ROS is not realtime framework though it is possible to integrate

ROS file system level -
1. Packages - are used to organize software. packages contain runtime processes (nodes), ROS dependent library, datasets config files
2. Manifests - contain metadata about packages
3. stack - aggregation of packages to perform a function. ex navigation stack
4. Stack Manifest - metadata about stacks.
5. Message types : data structures for messages sent in ROS.
6. Service types - request and response data structures for services.

ROS Computation Graph Level -
Computation Graph - a peer to peer network of ROS processes that are processing data together. The concepts of computation graph are

1. nodes - processes that perform computation. It is an executable file within an ROS package. It uses a ROS client library to communicate with other nodes. Nodes can publish or subscribe to a topic. It can also provide or use a service

2. master - ROS master provides name registration and lookup to the rest of the computation graph. The master enables the nodes to find each other, exchange messages or invoke services

3. parameter server - allows data to be stored by key in a central location. Part of master.

4. messages - similar to c structs. used to communicate between the nodes

5. services - Request/Reply - 2 data structures, one for request the other for reply. A node offers a service under a name. A client uses the service by sending a request to the node and waiting for a response. This is presented to the programmer as a remote procedure call.

6. topics - messages routed via the publish/subscribe semantics. A node publishes a message under a topic. A node interested in certain kind of data will subscribe to that topic. There may be multiple concurrent publishers and subscribers in a topic.  publishers and subscribers do not know each other. this is done to decouple the production and consumption of information.

7. bags - format for saving and playing back ROS message data. used to store data like sensor data that can be difficult to collect.

MEthodology
1. ROS master stores topics, services and registration information of all nodes
2. nodes communicate with the master to provide registration information
3. nodes make connections with other nodes using information present in the ROS master
4. Master callbacks nodes when registration information changes.

nodes connect to other nodes directly.  The commonly used protocol is TCPROS. The master acts like a DNS server. TCPROS uses TCP/IP sockets

Command line remapping of names - A compiled program can be recompiled at runtime to operate in a different computation graph topology. This is done using the names. 

Names
Graph Resource Names - provide encapsulation in ROS. Each resource in defined within a namespace which may share other resources. Resources can create resources within their namespace and they can access resources within or above their namespace. connections can be made between resources in different namespaces but this is achieved by integrating the code above both namespaces.

valid names
1. first character should be alpha character or tilde  or forward slash /
2. subsequent characters can be alphanumeric underscore forward slashes

Resolving
4 types of graph resource names in ROS
1. base    - base
2. relative    - relative/name
3. global     - /global/name
4. private     -˜private/name


Client libraries
Collection of code that is used for programming. lets us create ROS nodes, publish and subscribe to topics, write and call services and use the parameter server.
C++ and Python support
rospy, roscpp


Installation of ROS in MAC
http://www.ros.org/wiki/electric/Installation/OSX

Error 1
When installing ROS in MAC, there comes a point where a number of tools are required to be installed. The installer automatically generates the scripts required to install the tools. It asks for your password. But the terminal sort of crashed and did not accept even if my password was correct.

The solution to this is we need to manually install the tools before installing ROS.

Dependencies in MAC -
sudo port install py26-pil
sudo port install py26-numpy
sudo port install google-test
sudo port install log4cxx
sudo port install boost
sudo port install py26-paramiko

run the ROS installer command from http://www.ros.org/wiki/electric/Installation/OSX

Error 2:
rosinstall command not found.
roslocate command not found

Solution:
export PATH=$PATH:/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin


Tutorials
Assume ROS is installed in ros_sw folder
The file system is found inside the ros_sw. It is composed of
1. packages - contains libraries, tools etc. lowest level of ROS software organization
2. package manifests - description of a package, defines dependencies between packages
3. stack - collection of packages to form a higher level library
4. stack manifests - information on stack

File system tools.
rospack suite -
To get information about packages and stacks
rospack find [package name]
rosstack find [stack name]

rosbash suite -
1. change directory to a package or stack  - roscd [locationname[/subdir]]
2. list - rosld [locationname[/subdir]]


Tutorial - Creating a ROS package
roscreate-pkg - create package
rospack - list package dependencies

1. roscreate-pkg [package_name] [depend1][depend2][depend3]

2. rospack
rospack profile - to make changes to the path so that new directories are found
rospack find [package]

roscreate-pkg = ros+create-pkg : generates all the files needed to create a ROS package
rospack = ros+pack(age) : provides information related to ROS packages
rosstack = ros+stack : provides information related to ROS stacks

If rospack fails, that implies that your workspace is not listed in the ROS_PACKAGE_PATH. Open .bashrc and add this at the end. (after sourcing setup.bash line)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/Location/to/workspace


BUILDING A PACKAGE
1. rosdep install [package] _ install system dependencies required by ROS packages
2. rosmake [package] - to build a package we created
3. rosmake [package1] [package2] [package3]

NODES
Client Libraries
1. rospy - python client library
2. roscpp - C++ client libraries

3. roscore - first thing you should run when using ROS
4. rosnode  list - shows a list of all running  nodes
5. rosnode info [node] - shows more information about a node
6. rosrun [package_name] [node_name] - Run a particular node from a package 

RXGRAPH
rosmake rxtools
Running rxgraph gives the following error 
Error - ImportError: No module named gobject

Solution
The problem here is the symbolic link to python.
make sure the link to python in /usr/bin points to /opt/local/bin/python2.6
sudo mv /usr/bin/python /usr/bin/python_old
sudo ln -fsv /opt/local/bin/python2.6 /usr/bin/python

rosdep install rxtools
rosdep install rxgraph

Make sure all the following dependencies are met
sudo port install graphviz
sudo port install py26-cairo py26-gobject py26-gtk py26-wxpython
sudo port install py26-gtk

rosdep satisfy [package_name]

http://www.php-architect.com/blog/2009/02/25/installing-python-pygtk-on-mac-osx/
http://answers.ros.org/question/1364/rxgraph-no-module-named-gobject-os-x