User Tools

Site Tools


drexel_darwin_source_codes_explanation

This is an old revision of the document!


Explanation of Source Codes

Motivation

How a robot operates is pretty much dependent on the algorithm that it reads.

But before we go to that stage, we need to understand how to just simply make the robot move.

This section explains about what each part of the source code means and give examples of a short program.

Code used will be Cpp.

As mentioned previously, since there is no GUI available in DASL's very own Darwin, you cannot use gedit to modify and play around with the codes in Darwin.

Instead, import the codes into your own computer to edit and export them back into Darwin to execute, via the use of the Ubuntu Terminal.

Search the Internet for the relevant codes to achieve this.

These keywords should help in your search: scp, chmod.

Another way you can modify the source codes would be to use the command sudo nano /path/to/C/text/** to open up the text file and edit right inside Darwin. **vi** or **vim** is another way to do so but i prefer **nano**. ==== Walking ==== With reference to the ball following tutorial, I have made a short summary of what is the role of each part of the ball_following tutorial to contributing the making the robot move [[https://github.com/mr1789/darwindasl

Walking::GetInstance()->X_MOVE_AMPLITUDE = 10.0;//initialize value of variables
Walking::GetInstance()->A_MOVE_AMPLITUDE = 10.0;
 
while(count<8)//limit max value
{ 	Walking::GetInstance()->Start();//start walking
	showvalue();
	printf("Press the ENTER key to increase value! \ncount=%d \n", count);	
	getchar();//wait for user interference
	inc();//increase value
	count++;
} 
	Walking::GetInstance()->Stop(); //walking stops when variables reahes max value
    return 0;
}
 
void showvalue()
{
	printf("Walking::GetInstance()->X_MOVE_AMPLITUDE= %f\n", Walking::GetInstance()->X_MOVE_AMPLITUDE);
}
 
void inc()
{
	Walking::GetInstance()->X_MOVE_AMPLITUDE+=10;
}

http://www.youtube.com/watch?v=KMB-WVO0RxA As mentioned here, among the two variables that affect walking speed, the variable X_MOVE_AMPLITUDE controls the length of stride while the variable PERIOD_TIME affect the frequency of taking each step. The following are the codes I used to make Darwin walk slower by decreasing the frequency of it making each step, ie. increasing the variable PERIOD_TIME.

void inc()
{
	Walking::GetInstance()->PERIOD_TIME+=50;
}

http://www.youtube.com/watch?v=rrLZc4-DwJc My codes can be found here. ===== Vision ===== Ok plan is to export vision captured from Darwin's camera to OpenCV totally and ignore how it is done locally with the LinuxCamera class in Darwin. Go here for a guide to install OpenCV via Ubuntu terminal. NOTE: The previous version in DASL's very own Darwin is Maverick-10.10 which is given the End-Of-Life status. The address of the files that one needs to access for upgrade and installation of libraries etc. has now been changed. Some changes need to be done in order to successfully install OpenCV the way it is stated in the link above. Refer [http://www.techskater.com/random/installing-ubuntu-gutsy-packages-via-apt-get-when-eoled/|here]] for details. Hence, if you are working on an outdated version you know what to do. However, based on research and advices received, it is not desirable to use image processing on Darwin it self as it will be slow. The storage space is also little. (TO BE CONTINUED)

drexel_darwin_source_codes_explanation.1478433885.txt.gz · Last modified: 2016/11/06 04:04 by dwallace