Thursday, June 26, 2008

Multiple NXT Connections

We have faced problem establishing multiple NXTs (using iCommand library) connection with PC. The library is specifying the properties file internally; thus, when you say: nxt.open() it automatically open icommand.properties file located in your home directory or project directory.

Another problem is that commands for motors, sensors,… etc don’t specify which NXT you want to communicate. Hence, if you successfully established the connection with two robots you will have to specify which robot you want to communicate!

Therefore, to overcome this problem we establish robots connection from different main with different properties files. This required a slight change within the library code:

main -1:

private static final String PROS_1 = "icommand.properties";

public static void main(String [] args) throws InterruptedException{

//the object:

NXTCommFactory.setPROPSFNAME(PROS_2);//file properties

NXTCommand ob1 = new NXTCommand(); //creat instance

ob1.setSingleton(ob1); //set the instance

ob1.open(); //open connection

NXTCommand rob1 = ob1.getSingleton();//get the modified instance

NXTCommand.setVerify(true); //verify

NXTCommand.setSingleton(rob1); //set signleton

}

main- 2:

private static final String PROS_2 = "icommand2.properties";

public static void main(String [] args) throws InterruptedException{

//the object:

NXTCommFactory.setPROPSFNAME(PROS_2);//file properties

NXTCommand ob2 = new NXTCommand(); //creat instance

ob2.setSingleton(ob2); //set the instance

ob2.open(); //open connection

NXTCommand rob2 = ob2.getSingleton();//get the modified instance

NXTCommand.setVerify(true); //verify

NXTCommand.setSingleton(rob2); //set signleton
}

library modifications:

[class: NXTCommFactory]:

Create set/get methods for the variable PROPSFNAME. This modification will require you to import all comm classes to your package and also you have to add both bluecov Jar and comm. Jar to your project build path (if you are using Eclipse). The reset classes don’t need any modification.

If you have a better solution please share it with us :-)


Sunday, May 18, 2008

Grid Mapping


In this task we build an occupancy map using the Tribot model of Mindstorms. The grid map infrastructure is constructed using a two dimensional array. Each cell indicates whether the corresponding to one block of 1cm2 in the real work occupied or empty. The map will be updated based on the robot’s path and detected objects; hence, no prior knowledge about the environment is assumed. Besides, it is manipulated using Bresenham’s line algorithm.

The algorithm will read the data positions of the robot and objects estimated using odometry approach and will update the map accordingly. It updates all cells located between two robot’s positions and it indicates that it is empty. If an object is detected the algorithm will update all cells, located in a straight line, between the robot position and the object position such that they marked as empty cells. The object position will marked as occupied cell.

The cells values are given a certainty (probabilistic) value is to indicate whether the robot or the object is likely to exist there or not. The initial cells value well 0.5 which indicate that area hasn’t been explored yet. The updating algorithm will gradually change the value between zero to one. Thus, if an object is detected in a specific location, the cell corresponding to that position will be increased from 0.5 to 0.7, for example, which indicates that the object is likely to be there.

The map will be drawn while the robot navigating the environment. Hence, the users could see the map in a real time.


The following is a map constructed collaboratively between two robots:

+Map of Robot 1


+Map of Robot 2



+Shared Map of robot1 and robot2



Collaborative Mapping is the aggregation of two robots’ occupancy maps. Each robot will explore a region and will keep a record of its position and the environment objects.
At the beginning, each robot will rotate 360 degree while scanning the surrounding after each 30 degree in order to check if any object is located nearly (about 30cm). Once the rotation is completed, the robot will randomly choose one of four directions and it must be free: 0, 90, 180, or 270 to pursue to a new grid point.

The records of the two robots will be merged to create the global map of the environment. Likewise, the map will be shown on the real time.

Saturday, May 17, 2008

Occupancy Grid

Some useful links about occupancy grid mapping are listed below:

Occupancy Grids
Robot Localization and Map Construction Using Sonar Data

Friday, May 16, 2008

Avoid Behavior

Go away: The robot goal is to avoid hitting obstacle. It moves toward and stops while sensing an object within the specified range. It avoids the object after finding the best direction that separates the robot from the object.


Approach Behavior

Go toward: The goal is to get closer to an object. The robot moves toward and stops while sensing an object within specific range. It moves toward after doing some calculation to find the appropriate angle that makes the robot approaches in the right direction with the desired distance.

A Glance About The Project

Mindstorms among Us is a project using LEGO Mindstorms NXT kits to build simple robots that are able to distinguish between walls, balls, and other robots, perform a set of basic behaviors, and keep track of where they are (odometry). These basic sensory behaviors are based on different algorithms to enable the robots to recognize previous mentioned objects. Also, the robot can build a map to describe their environment. Furthermore, the robots are able to build a single map collaboratively. Thus, two robots will describe the same environment. A graphical representation of the map will be displayed for the user so that he can imagine robot’s path and any obstacles. These basic behaviors and simple mapping have been programmed with different programming language such as RobotC and JAVA. The choice of suitable language is based on complexity, functional and non functional requirements of each task. Besides, the physical models of the robot are various to satisfy each task without affecting the accuracy of each task. Many experiments and tests are conducted to ensure the reliability of each function.

This project provides highly valuable real-world hands-on experience on the basics of robotics, including body designs, sensing, actuating and programming. It is a great chance to investigate more in the field of robotics, read more about its main concepts such as odometry and grid occupancy, and a good start up for novice interested students in the robotic field.