Difference between revisions of "Robotics: Principles and Practice - Software Installation Guide"

From David Vernon's Wiki
Jump to: navigation, search
Line 19: Line 19:
  
 
== Option 2: Installation of All Required Tools and Utilities on a Computer running Ubuntu 16.04 ==
 
== Option 2: Installation of All Required Tools and Utilities on a Computer running Ubuntu 16.04 ==
 
  
  
Line 26: Line 25:
 
If you don’t already have it, install Ubuntu 16.04
 
If you don’t already have it, install Ubuntu 16.04
  
You can get an Ubuntu 16.04 image�[https://releases.ubuntu.com/xenial/ here].
+
You can get an Ubuntu 16.04 image [https://releases.ubuntu.com/xenial/ here].
 
+
There is a tutorial on installing Ubuntu 16.04 alongside Windows 10 (dual boot)�[https://www.askaswiss.com/2017/01/how-to-install-ubuntu-16-04-alongside-windows-10-dual-boot.html��here].
+
 
+
Disclaimer: I have not validated this tutorial��If you know of a better one, please tell me
+
 
+
 
+
=== CMake ===
+
Download CMake binaries from [http://www.cmake.org/download/ here].  At time of writing the latest version is 3.16.2.
+
<!-- Download CMake 2.8.10-RC3 binaries from [https://cmake.org/files/v2.8/cmake-2.8.10-rc3-win32-x86.exe here] -->
+
 
+
You can opt for either the WIN32 installer (cmake-3.16.2-win32-x86.msi) or the Windows zip file.  The installer has the advantage that it gives you the option to update your system path automatically (which you should take by clicking the appropriate radio button during the installation process). If you choose the installer option, note that if you already have CMake version 3.4 or earlier you much uninstall it first.
+
 
+
=== OpenCV ===
+
Download and install OpenCV from [https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.10/ here]. Choose the version 2.4.10 self-installer, download it, and execute it, and extract the library to <code>C:</code> so that you have a directory <code>C:\opencv</code>.  If you have problems downloading this version from SourceForge site, you can download version 2.4.10 from [http://www.vernon.eu/downloads/opencv-2.4.10.exe here].
+
 
+
Add <code>C:\opencv\build\x86\vc10\bin</code> to the <code>PATH</code> environment variable and add a new environment variable <code>OPENCV_DIR</code> with the value <code>C:\opencv\build</code>, as follows.
+
 
+
* From Windows 10 toolbar, select ''Settings''. 
+
* Type ''Environment Variables''  in the ''Find a Setting'' dialogue box. This will bring up a new ''Systems Properties'' window.
+
* Click the ''Environment Variables ...'' button. This will bring up a new ''Environment Variables'' window.
+
* Select ''Path'' from ''System Variables''. Click ''Edit''.  Click ''New'' and insert <code>C:\opencv\build\x86\vc10\bin</code>. Click ''OK''. 
+
* Under ''User variables'', click ''New''. Insert <code>OPENCV_DIR</code> in the ''Variable name'' box and <code>C:\opencv\build</code> in the ''Variable value'' box. Click ''OK''. 
+
* Click ''OK'' in the ''Environment Variables'' window.
+
* Click ''OK'' in the ''Systems Properties'' window.
+
 
+
=== CORO Repository ===
+
 
+
Copy the CORO repository to the <code>C:</code>  drive:
+
 
+
* Download a zip archive with all the files from  [http://www.vernon.eu/cognitive_robotics/CORO.zip here].
+
* Copy it to <code>C:</code> drive and unzip it so that you have a directory called <code>C:\CORO</code>.
+
 
+
<code>C:\CORO</code> has with a sub-directory structure explained in the course notes. For our purposes here, there is an  <code>C:\CORO\assignments</code>  directory and it will contain an example <code>C:\CORO\assignments\assignment0</code> sub-directory. Later on, you will generate <code>C:\CORO\assignments\assignment1</code> and <code>C:\CORO\assignments\assignment2</code>, and so on. 
+
 
+
There is also a <code>C:\CORO\lectures</code> sub-directory. This has code from the lectures: the source code is in the <code>C:\CORO\lectures\src</code> sub-directory and test data is in the <code>C:\CORO\lectures\data</code> sub-directory.
+
 
+
The next step is to build a MSVC++ <code>.sln</code> solution file so that you can compile the CORO assignment0 executable. To do this, you need to run CMake against the <code>C:\CORO\assignments\assignment0</code> directory (where you will find the main <code>CMakeLists.txt</code> file).    We use <code>assignment0</code> because it is a dummy assignment but you will follow exactly the same procedure for all the real assignments.
+
 
+
* Launch the CMake GUI from the Windows 10 toolbar.
+
 
+
* In the ''Where is the source code:'' type (or browse to)  <code>C:\CORO\assignments\assignment0</code>
+
 
+
* In the ''Where to build the binaries:'' type (or browse to) <code>C:\CORO\assignments\assignment0\build</code>
+
 
+
* Select ''File > Delete Cache'' from the top menu (you '''must''' do this the first time in case there is an old invalid configuration in the CORO directory)
+
 
+
* Click ''Configure''
+
 
+
* Select ''Visual Studio 10 2010'' from the drop-down menu as the generator for the project
+
 
+
* Click ''Finish'' and watch CMake configure your project.  The dialogue box will still highlighted in red, so ...
+
 
+
* Click ''Configure'' two more times and everything should be fine.
+
 
+
* Click ''Generate''  to create the MSVC++ <code>assignment0.sln</code> file in the <code>C:\CORO\assignments\assignment0\build</code> directory.
+
 
+
 
+
Now you are ready to launch MSVC++ and build the CORO assignment0 executable. 
+
 
+
* Go to the <code>C:\CORO\assignments\assignment0\build</code> directory and double-click the <code>assignment0.sln</code> file.  This launches Microsoft Visual C++ 2010 Express. The first time, you may be presented with a pop-up window that asks you how you want to open the file. Select ''Microsoft Visual C++ 2010 Express'' and click on the checkbox to always use this application to open this file type.
+
 
+
* Select <code>Release</code> in the ''Solutions Configuration'' box (this is located left of centre on the toolbar and defaults to <code>Debug</code>).
+
 
+
* Select ''Build > Build Solution'' from the top menu, (if you don't see this and you see  ''Debug > Build Solution'' instead, it's probably because your IDE is set to basic settings. To change this, select ''Tools > Settings > Expert Settings'').
+
 
+
This will compile and link the programs in the the <code>C:\CORO\assignments\assignment0\src</code> sub-directory and install then in the <code>C:\CORO\assignments\assignment0\bin</code> directory.
+
 
+
 
+
Check to see that the example  <code>dvernon.exe</code> executable is there.  If it is not, then select  ''Build > Configuration Manager'' from the menu and make sure the ''INSTALL'' check-box is ticked.  Now rebuild the project again. 
+
 
+
'''Note that you will have to tick this check-box every time you rebuild the <code>.sln</code> solution file with CMake.'''  If you don't do this, then your new executable won't be installed in the <code>bin</code> directory and you'll end up becoming very confused because none of the changes you make to your source code will be reflected in the executable you run from the <code>bin</code> directory (because its an old version from a previous compilation).
+
 
+
 
+
Good!  Now you are now ready to run the example <code>dvernon.exe</code>  application that is provided with the CORO release. To do this, double click the <code>dvernon.exe</code> executable in <code>C:\CORO\assignments\assignment0\bin</code>.  Open <code>input.txt</code> file in <code>C:\CORO\assignments\assignment0\data</code> and, after running <code>dvernon.exe</code>, open the <code>output.txt</code> file, also in the <code>C:\CORO\assignments\assignment0\data</code> directory.
+
 
+
 
+
Try creating your own (dummy) assignment program. To do this, follow the following steps.
+
 
+
* Create a directory with your student Id, e.g.  <code>C:\CORO\assignments\assignment0\src\mystudentid</code>
+
* Copy the source files (<code>.c, .cpp, .h</code>) and the <code>CMakeLists.txt</code> file from the <code>dvernon</code> directory to the mystudentid directory.
+
* Edit the <code>C:\CORO\assignments\assignment0\src\CMakeLists.txt</code> file and replace <code>ADD_SUBDIRECTORY(dvernon)</code> with <code>ADD_SUBDIRECTORY(mystudentid)</code>, where <code>mystudentid</code> is your student number. 
+
* Edit the <code>C:\CORO\assignments\assignment0\src\mystudentid\CMakeLists.txt</code> file and replace <code>dvernon</code> with <code>mystudentid</code>, where <code>mystudentid</code> is your student number. 
+
* Run CMake again. 
+
* Re-open the <code>assignment0.sln</code> file (remember, it's in the <code>C:\CORO\assignments\assignment0\build</code> directory).
+
* Your files should now be visible (and the dvernon ones will no longer be there) and you can now compile your code and install it in the <code>bin</code> directory by selecting ''Build > Build Solution'' from the top menu. 
+
* Make sure that the ''INSTALL'' check-box is ticked when you select ''Build > Configuration Manager'' from the menu to ensure that your executable is installed in the <code>C:\CORO\assignments\assignment0\bin</code> directory.   
+
* Finally, run your program in the <code>C:\CORO\assignments\assignment0\bin</code> directory. You might like to change the contents of <code>input.txt</code> in the  <code>C:\CORO\assignments\assignment0\data</code> directory and re-run your program to convince yourself that everything is working properly.
+
 
+
 
+
For your first assignment, you will simply copy the <code>assignment0</code> directory to <code>assignment1</code> and follow a similar procedure, writing new assignment-specific code, of course.  There is just one thing you need to do:  edit the <code>C:CORO\assignments\assignment1\CMakeLists.txt</code> and change the project name from <code>assignment0</code> to <code>assignment1</code>, viz:
+
 
+
  ##############################################
+
  PROJECT(assignment0)
+
  ##############################################
+
 
+
becomes
+
  
  ##############################################
+
There is a tutorial on installing Ubuntu 16.04 alongside Windows 10 (dual boot) [https://www.askaswiss.com/2017/01/how-to-install-ubuntu-16-04-alongside-windows-10-dual-boot.html here].
  PROJECT(assignment1)
+
  ##############################################
+
  
 +
Disclaimer: I have not validated this tutorial. If you know of a better one, please tell me
  
When submitting an assignment, all you have to do is submit a zipped version of your <code>mystudentid</code> directory with your three source code files.
 
  
The instructor simply has to unzip it and add it to the <code>src</code> directory on her or his computer, along with all the other students and her or his own solution, run CMake, launch the <code>.sln</code> file, compile, install, and check each executable in <code>bin</code> against the test data file in her or his <code>data</code> directory.  Because we build the solutions the same way, you are guaranteed that your code will compile, provided you have followed this procedure.
 
  
  
The final step is to build a MSVC++ <code>.sln</code> solution file so that you can compile the DSA lectures executables. To do this, you need to run CMake against <code>C:\CORO\lectures</code> and <code>C:\CORO\lectures\build</code>, launch <code>C:\CORO\lectures\build\lectures.sln</code>, build the solution, making sure that the ''INSTALL'' check-box is ticked when you select ''Build > Configuration Manager'' from the menu to ensure that the demo executables are installed in the <code>C:\CORO\lectures\bin directory</code>.
 
  
  
 
----
 
----
 
Back to [[Robotics: Principles and Practice]]
 
Back to [[Robotics: Principles and Practice]]

Revision as of 09:40, 22 August 2021

UNDER CONSTRUCTION ... DON'T BOTHER READING ANY FURTHER YET

This page provides a step-by-step guide to downloading, installing, and using the software required to run the example software for Robotics: Principles and Practice with robot simulators and physical robots on Ubuntu 16.04 with ROS.


Follow these instructions exactly as they are stated. Do not be tempted to skip through them, assuming that you will be able to figure it out yourself. You might, but it is more likely you will miss something small but important and it won't work as required. Take your time, follow these instructions carefully, and everything will work.

There are two options:

  • Use a VirtualBox Ubuntu 16.04 virtual machine with everything pre-installed�
  • Install all the required tools and utilities on a computer running Ubuntu 16.04

We cover both in the following, starting with Option 1


Option 1: VirtualBox Ubuntu 16.04 Virtual Machine

Option 2: Installation of All Required Tools and Utilities on a Computer running Ubuntu 16.04

Ubuntu 16.04

If you don’t already have it, install Ubuntu 16.04

You can get an Ubuntu 16.04 image here.

There is a tutorial on installing Ubuntu 16.04 alongside Windows 10 (dual boot) here.

Disclaimer: I have not validated this tutorial. If you know of a better one, please tell me





Back to Robotics: Principles and Practice