In this post, I will explain how to install Phratch on an Android device. I created the .apk file for an ARM architecture. The following instructions are based on this page.

Prerequirements:
  • Download Android SDK: http://developer.android.com/sdk/index.html
  • Ant should be installed: http://ant.apache.org/
Image preparation:

First, download  a Pharo 2.0 image and execute the following code. It loads the necessary code for Android support and the Phratch package. Deprecation raiseWarning: false; showWarning: false.

"Installation of Android support"
Gofer new
 url: 'http://source.squeak.org/VMMaker';
 package: 'Android-Base';
 load.
SmalltalkImage checkSourcesFileAvailability: false.
SmalltalkImage checkChangesFileAvailability: false.
"2 - installation of Phratch"
Gofer it
 url: 'http://smalltalkhub.com/mc/JLaval/Phratch/main'
 username: ''
 password: '';
 package: 'ConfigurationOfPhratch';
 load.
(Smalltalk at: #ConfigurationOfPhratch) loadBleedingEdge.

Then, you can execute the following lines that makes Phratch be in User mode:

StartupLoader default removeAllScriptsFromAllDirectories; initialize.
PhratchFrameMorph open saveImageForEndUserSilently.
Image splitting

Now, split your image:

split -d -b 1m /path/to/myapplication.image myapplication.

In macosX, the option -d does not exist. It means that you should remove it and rename all created files with extensions as .00, .01, .02, …

Creation of the Android project

Create a new folder for the project. Inside it, unzip the makevm.zip (https://ci.inria.fr/pharo-contribution/view/VM/job/CogDroid/).
Go inside the dir, and, inside it, unzip the nativeVM-xxx.zip (https://ci.inria.fr/pharo-contribution/view/VM/job/CogDroid/). I use the arm file.

Then do

 mkdir -p src/phratch/eu/android

Then create a .java file in src/phratch/eu/android/Phratch.java, which contains:

package phratch.eu.android;
 import org.golubovsky.cogstack.CogActivity;
 public class Phratch extends CogActivity {
 }

In assets/image, push the image splitted file (files with extension .00, .01, …), and run:

ls -l assets/image/

Make sure subdirectory assets/zipped exists. From https://code.google.com/p/phratch/downloads/list, download in this folder the files ScratchSkin.zip, Manual.zip, locale.zip, Media.zip, and Help.zip.

Customize of the Android project

Now, comes the need to change files. Go back in the makevm folder.

In AndroidManifest.xml

  • change @@PACKAGE@@ by “phratch.eu.android”
  • change @@ACTIVITY@@ by “Phratch”

In build.xml

  • change @@BUILD@@ by “Phratch-android”

In res/values/strings.xml

  • change @@BUILD@@ by Phratch-android

In local.properties

  • change the line sdk.dir by the full path of your sdk, mine is sdk.dir=/Users/janniklaval/Desktop/phratch-and/makevm/sdk

In project.properties, change the two following lines:

  • target=android-4
  • android.library.reference.1=../../project/

by

  • target=android-17
  • android.library.reference.1=project/

In project/local.properties

  • change the line sdk.dir by the full path of your sdk, mine is sdk.dir=/Users/janniklaval/Desktop/phratch-and/makevm/sdk

In project/project.properties, change the following line:

  • target=android-4

by

  • target=android-17

In res/drawable/, you can replace icons.

Finish the creation of the .apk

Run the commands:

 ant clean
 ant debug

You can run

 ant release

The installable apk file will be under bin: Phratch-android-debug.apk.

Deep into Pharo is the second volume of a series of books covering Pharo. Whereas the first volume is intended for newcomers, this second volume covers deeper topics.

External Page: cover.min.jpg

TopicsYou will learn about Pharo frameworks and libraries such as Glamour, PetitParser, Roassal, FileSystem, Regex, and Socket.
You will explore the language with chapters on exceptions, blocks, small integers, and floats.
You will discover tools such as profilers, Metacello and Gofer.

http://rmod.lille.inria.fr/pbe2/

You can contribute to Phratch by several ways.

  • First of all, you can download it and try it. If you have any problem or bug, you can add an issue in the bug tracker.
  • Then, if you are a Smalltalk developper, you can easily contribute to fix these bugs.
  • Another way to contribute is to make documentation for Phratch. Some posts are already available here.
  • You can also extend Phratch with your own blocks. Do not hesitate to share with us your productions.

To download the lastest version of Phratch, just follow the instructions.

Phratch is a programming language that makes it easy to create your own interactive stories, animations, games, music, and art — and share your creations on the web. It is a port of Scratch (http://scratch.mit.edu/) on recent platforms (Phrao 2.0 and Pharo 3.0)

More than Scratch, Phratch includes BYOB, Build your own Blocks (http://byob.berkeley.edu/#download). It allows one to create a block composed by other blocks. Creating a block is available in the category variables below the creation of variable and creation of list. Then, It is possible to edit the block by right clicking.
Phratch is also Panther: It includes two interesting categories: Files and colors. Files allows one to manipulate local and remote files, and Colors to manipulate color features.

Phratch includes new features like Settings, FileSystem, Metacello. For example, I can edit a normal block, and a real browser is opened.

A block is a smalltalk method containing a pragma. This pragma informs Phratch that this method should be displayed as a block. A lot of Blocks are provided by default: from Scratch but also a lots of them comes from BYOB, and Panther.

You can find Phratch and tutorials at code.google.com/p/phratch.

Location: Mines de Douai and ENSTA Brest (France)

Advisor and contacts:
Noury Bouraqadi, Luc Fabresse, Jannik Laval (car _at_ mines-douai.fr, website: http://car.mines-douai.fr/)
Loïc Lagadec (loic.lagadec _at_ ensta-bretagne.fr)

Profile: the candidate must hold a recent Master of Science degree in Computer Science or Software Engineering and must have solid skills in dynamic reflective language and OOP.

Description of the work:
The goal of this PhD is to study Smalltalk integration with FPGAs for robotic applications. This integration will enable us get the best from both worlds. Developers are provided with a high-level dynamic reflective language (Smalltalk) for building and debugging their applications. Still, we can have high performances by projecting part of the programs into FPGAs. These reconfigurable hardware chips can achieve performance faster than C programs, while consuming much less energy.

The work to do can decompose into the following tasks:
-Build reference robotic applications fully in Pharo Smalltalk using actual robots (see http://car.mines-douai.fr/robots/)
-Analyze these applications to identify critical parts to project on FPGAs to significantly increase performances (speed, energy)
-Do the actual projection to FPGA and evaluate performances of the transformed applications
-Generalize the approach and define a methodology for turning Smalltalk code into FPGA
-Propose a solution to automate the methodology

The Ph.D student will receive a grant which net amount is approximately 1420 euros per month for 3 years (36 months).
He will be co-supervised by Loïc Lagadec from the ENSTA-Bretagne (Lab-STICC, Brest) and Jannik Laval, Luc Fabresse and Noury Bouraqadi from Ecole des Mines de Douai (CAR, http://car.mines-douai.fr/).
The first 18th month will be spent in Douai (Lille area), while the last half of the PhD will be spent in Brest.
However, during the full 3 years, there will be a strong interaction with co-supervisers from both labs.

Bibliography:
-A Robust Layered Control System For A Mobile Robot. R. Brooks. IEEE Journal of Robotics and Automation. Vol. 2. Num 1. March, 1985.
-RCS: A Cognitive Architecture for Intelligent MultiAgent Systems. J.S. Albus and A. J. Barbera. Proceedings of the 5th IFAC/EURON Symposium on Intelligent Autonomous Vehicles (IAV 2004). Lisbon, Portugal, 2004.
-Handbook of Robotics. Bruno Siciliano and Oussama Khatib editors. Springer. 2008.
-Multi-Level Simulation of Heterogeneous Reconfigurable Platforms. D. Picard and L. Lagadec. International Journal of Reconfigurable Computing. 2012.
-High-level synthesis for FPGAs: From Prototyping to Deployment. Jason cong and stephen neuendorffer and juanjo noguera and kees vissers and zhiru zhang. IEEE Transactions on Computer-aided design of integrated circuits and systems. Vol. 30. Num 4. April, 2011.
-The MOLEN Polymorphic Processor. S. Vassiliadis and S. Wong and G. Gaydadjiev and K. Bertels and G. Kuzmanov and E. Moscu Panainte. IEEE Transactions on Computers. 2004.

Last may, Dr. Luc Fabresse presented at the ICRA 2013 workshop on Software Development and Integration in Robotics (SDIRIII) our first results in the CAIRE project. It’s about a first version of BoTest, a first version of a UnitTest framework based on the work done in eXtreme Programming, that we adapted to the context of robotics. We give a glimpse of experiments we are doing with our robots. The slides of the presentation are available below.

 

My objective is to have:

  • A virtual image: VirtualBox (preferred), VMWare
  • with Ubuntu: precise? 12.04 (preferred because LTS), quantal 12.10, raring 13.04
  • ROS: Groovy (preferred because latest stable), Hydro (but still unstable), Fuerte (no because no Catkin)
  • MORSE simulator: 1.0 (latest stable), newer

If you don’t want to install it yourself, you can download my VMWare 4.1.4 image of a ROS Groovy on an Ubuntu Quantal 12.10 with MORSE (updated 2013-05-13).

If it works on a newer version of VMWare, please let me know.

Constraints & Incompatible Combinations

I learnt the hard way the multiple incompatible combinations ;-)
Here some constraints:

  • Ubuntu and ROS. You can find here a really good help. So, Groovy works on 12.04 and Quantal (12.10) but not Raring (13.04) which can be used with Hydro.
  • VirtualBox and Ubuntu. The following report on using the latest VirtualBox on OSX 4.2.x :
    • Ubuntu 12.04: no problem but Groovy cannot be installed on top of it.
    • Ubuntu 12.10: it is really slow. It seems to be 3D support problem but I did not succeed to fix it.
    • Ubuntu 13.04: it works perfectly after installing VBox tools and 3D acceleration (cf. here) but Groovy cannot be installed on top of it.
  • ROS and MORSE. MORSE requires Python>=3 but ROS is currently Python 2.7 compliant, even Hydro. However, the MORSE installations notes describes a solution to make install.

Finally I went for:

  • VMWare 4.1.4
  • Ubuntu 12.10
  • ROS Groovy
  • MORSE bleeeding edge

Step 1: Ubuntu Quantal (12.10) on VMWare 4.1.4

It has been straightforward. Steps:

  1. Download Ubuntu iso (ubuntu-12.10-desktop-i386.iso)
  2. Create a VM image in VMWare
  3. Boot on Iso mounted in CD
  4. Install
  5. VMWare Tools should install automatically
  6. Ensure that 3D acceleration checkbox is cheked in the VM preferences
  7. Ensure 3D acceleration is working well by doing in command line:

    /usr/lib/nux/unity_support_test -p

  8. I advise you to do a VM snapshot here ;-)

Step 2: ROS Groovy Installation

Documentation is here.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu quantal main" > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install ros-groovy-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/groovy/setup.bash" >> ~/.bashrc
source ~/.bashrc

Test that ROS is working

TODO: Je ne suis plus sûr de cette ligne ;-)
roscheck ?

You can also do the ROS tutorials.

Step 3: MORSE Installation

Documentation is here.
But we must make ROS Python 3 compliant first.

ROS and Python 3

Documentation is here.

Doing sudo apt-get install morse-simulator did not work for me because of Python problems.

Manual installation steps:

  1. Re-install ROS catkin_pkg from sources to make it use Python 3.
  2. git clone git://github.com/ros-infrastructure/catkin_pkg.git -b 0.1.9
    cd catkin_pkg
    sudo python3 setup.py install
    
  3. Re-install ROS catkin from sources to make it use Python 3. However, cloning the regular catkin repository on github did not work for me because of syntax changes in Python 3 (u"xxx" not supported anymore). So I use here my cloned and modified version. However, I advise you to first check if it has been corrected in the official repository.
  4. # slightly modified version of catkin to support Python 3
    git clone git://github.com/LucFabresse/catkin.git
    cd catkin
    sudo python3 setup.py install
    

MORSE real Installation

sudo apt-get install python3-dev
cd ~
git clone https://github.com/laas/morse.git
cd morse

# if you want a stable version, just checkout the right branch or skip the next command
git checkout -b 1.0_STABLE -t origin/1.0_STABLE

mkdir build && cd build

# compile with the support you need. have a look at cmake --help.
cmake -DPYMORSE_SUPPORT=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_ROS_SUPPORT=ON -DPYTHON_EXECUTABLE=`which python3` ..

sudo make install

You can now test that MORSE is working by executing:

morse check

Step 4: Post-Install

Congrats, if you reached this step, everything is done and you can work.

But I advise you to do a VM snapshot or better a VM clone ;-)

How to Update the Installation

For Ubuntu and ROS:

apt-get update
apt-get upgrade

Be careful, it may install a non Python3-compliant ROS version!

cd ~/morse
git pull
cd build
sudo make install

Use it remotely

You can even use it remotely through ssh -X

Conclusion

That’s all folks.
I hope it saved some time for someone out there.

I created a repository that will contain my new packages:

rosinstall ~/ros /opt/ros/groovy/
echo "source ~/ros/setup.bash" >> ~/.bashrc 
source .bashrc

Do a checkout manually of the sources:

svn co https://svn.code.sf.net/p/bosch-ros-pkg/code/trunk/stacks/exploration ~/ros/exploration

There is an broken link to btVector3 in the following file: ~/ros/exploration/explore/include/explore/explore_frontier.h

Just change the line

#include <LinearMath/btVector3.h>

to

#include <tf2/LinearMath/btVector3.h>

Then you can build the project:

rosmake exploration

Before running explore, launch turtlebot and gmapping:

roslaunch turtlebot_bringup turtlebot.launch
roslaunch turtlebot_navigation gmapping_demo.launch

To run the explore node, run this command line:

roslaunch ~/ros/exploration/explore_stage/explore.xml

On the Turtlebot:

1- update via apt-get

sudo apt-get update
sudo apt-get upgrade

2- fix ip address

ip: 10.1.161.xx
gateway: 10.1.1.1
netmask: 255.255.0.0
Proxy: 10.1.1.3:8080

3- update ros

sudo apt-get install python-rosdep
rosdep update

4- install ros-turtlebot:

 sudo apt-get install ros-groovy-turtlebot ros-groovy-turtlebot-apps ros-groovy-turtlebot-viz

5- Install Chrony

sudo apt-get install chrony

6- manually sync NTP

sudo ntpdate 10.1.1.2

7- modify the file

/etc/chrony/chrony.conf with the correct ntp: add the line "server 10.1.1.2"
you can comment the other servers.

On the workstation

1- Install Chrony

 sudo apt-get install chrony

2- manually sync NTP

sudo ntpdate 10.1.1.2

3- fix ip address

ip: 10.1.161.xx
gateway: 10.1.1.1
netmask: 255.255.0.0
Proxy: 10.1.1.3:8080

4- install:

sudo apt-get install ros-groovy-turtlebot ros-groovy-turtlebot-apps ros-groovy-turtlebot-viz
. /opt/ros/groovy/setup.bash
rosrun kobuki_ftdi create_udev_rules
echo "source /opt/ros/groovy/setup.bash" >> ~/.bashrc

Then on robot computer: 

echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> .bashrc
echo export ROS_HOSTNAME=IP_OF_TURTLEBOT >> .bashrc
source .bashrc

Then on workstation:

echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> .bashrc
echo export ROS_HOSTNAME=IP_OF_WORKSTATION >> .bashrc
source .bashrc

Verification:

on turtlebot:

1- the topics:

 rostopic list

>>I had an error, so I did:

sudo apt-get upgrade
sudo apt-get install ros-groovy-actionlib
sudo apt-get install ros-groovy-rosgraph
roslaunch turtlebot_bringup minimal.launch

>>Then, reexecute the line, it should work:

rostopic list

2- the environment:

echo $ROS_MASTER_URI
rostopic echo /diagnostics
echo $ROS_HOSTNAME

on workstation:

rostopic list
rostopic echo /diagnostics

Last verification:

on workstation:

rostopic pub -r10 /hello std_msgs/String "hello"

on turtlebot:

rostopic echo /hello

The message “hello” begin printed about 10 times a second.

 

Finally

All works now, you can run this line on the robot (I desactivated the automatic launch of the turtlebot nodes)

roslaunch turtlebot_bringup turtlebot.launch

Sometimes, this does not work. Just finish the process (Ctrl-C) and rerun it. Sometimes, I do that 3 or 4 times before it works.

To run the camera and 3d sensors, run this line:

roslaunch turtlebot_bringup 3dsensor.launch

On the workstation, you can open the diagnostic panel:

rqt -s kobuki_dashboard

Now, you can play with Turtlebot tutorials:

  • http://www.ros.org/wiki/turtlebot_bringup/Tutorials/groovy/3D%20Visualisation
  • http://www.ros.org/wiki/turtlebot_teleop/Tutorials/Keyboard%20Teleop
  • http://www.ros.org/wiki/turtlebot_navigation/Tutorials/Autonomously%20navigate%20in%20a%20known%20map

Some other tips:

VMWare:

I installed ROS on a VMWare 5, Ubuntu 12.04.
Due to the generic drivers, RViz does not work well. You have to add this line in your .bashrc:
export LIBGL_ALWAYS_SOFTWARE=1
I also change the file /etc/ld.so.conf.d/GL.conf (not sure it has an impact): I removed the term “mesa” in the file (not the line, only the word).

Building the map:

To build the map, do not launch 3dsensor before.