Leaf 2.0 7-26-12
What is Leaf 2.0?
Perhaps you have heard that there is a new source of robotics software on the web called ROS?
ROS (Robot Operating System) is a robot architecture originally designed at Stanford and now supported and extended by Willow Garage . A primary reason to work with ROS is that it is becoming a "standard" for academic development. Many or most developers are publishing their software online. Hence, there are thousands of ROS packages (functional units) available for you to use. All open source and free. This includes device drivers, vision, navigation, arm control, etc. etc. etc. This availability is a huge shortcut toward developing advanced robots
The Leaf project is intended to provide a relatively sophisticated baseline robot on which people can build extensions to suit their own interests. The Leaf project software was built for a Windows environment which we believed most potential Leaf builders would be familiar with. Unfortunately, ROS is designed to run under Linux. So, this Leaf 2.0 extension becomes much of an education. You have to learn linux, you have to learn ROS, and you have to be a pretty experienced C/C++ or python programmer. Actually, you need both languages if you want to understand other peoples code. Lisp is also a supported language although less used in ROS so far.
So, Windows based Leaf is close to plug n' play compared to ROS which is more of a big box full of software with little direction on how to put it all together. Learning how to put it together is a big learning experience.
That said, it is worth it. It may take you several years to get good at this, but then you will be a competent robot designer/programmer with the ability to work/play at the cutting edge of robot design. If you like what Windows Leaf does and just want to make some hacks to customize it a bit, stick with Windows Leaf. If you just prefer to stay with Windows, people are working to develop a Windows version of ROS. But for the next decade or so, Iím betting that ROS under Linux will be where most people are doing serious robot development.
A good feature is that you don't have to give up any of your Windows based Leaf to start working on ROS. By making your robot laptop a dual boot system, you can keep your Windows Leaf just as it is and start working with ROS in a Linux partition. The robot hardware remains unchanged.
What is ROS?
ROS is not what we think of as a computer operating system. In fact, ROS is a set of programs that run under Linux which is the conventional Operating System. ROS creates an environment supporting a federated robot design; that is, it supports communication between many relatively independent robot functions. This greatly simplifies development of new robot functionality and integration of new functions into an existing robot.
Look here for more information
The ROS community consists of Willow Garage plus a worldwide collection of universities, companies and individuals developing code and sharing it on hundreds of on-line repositories. If you want inspiration, search "ROS robot" on youtube.
What will you get with ROS 2.0?
As with Windows Leaf, our intention is to provide a operating robot with which you can do your own development projects. In Windows Leaf, we actually provided quite a bit of functionality.
Since ROS supplies an extensive set of function code, Leaf 2.0 will only supply the basics to drive your robot using standard ROS commands. We will use existing ROS functions to achieve control using a joystick just to demonstrate basic operation and how the parts are put together. Any other functionality will be up to you.
In addition, there will be a hybrid system in which some of the existing software will operate in Windows (e.g. the Lisp code, speech recognition and vision) and communicate with a Linux/ROS machine (separate hardware or virtual machine) which will drive the robots through the existing microcontroller and incorporate any other ROS functionality that you want.
Basic ROS capabilities:
Accepts cmd_vel signal for drive motor control
Will accept RC servo commands and Discrete I/O commands in the future. Not implemented now as there is no standard was of doing this in ROS.
Generates odom and tf messages. Standard ROS messages used for navigation etc.
Outputs the existing Leaf DataMsg as a ROS topic which has all the same data as is available in the Windows Leaf including: analog input signals, sonar distances, RC servo positions, Discrete I/O data and drive motor feedbacks. This message can be used by ROS as you need and can be received by the Leaf_Socket node above for transmission to the Windows Lisp programin hybrid mode
Hybrid Windows Leaf capabilities:
It takes the LispCmd message from the RComm dll just as is done in standard Windows leaf and transmits it over ethernet to the Linux machine where it is converted by the Leaf_socket node to a ROS message that is received by the Leaf_base node and sent on to the microcontroller. For data, Leaf_base receives the data message from the microcontroller and turns it into a ROS topic. The Leaf_Socket node receives that message and sends it back to the Lisp software in the Windows machine. In effect, it should be able to do all the basic drive motor, RC servo and DIO commands that the current lisp does.
In standard Leaf, Lisp is able to commands "higher level" modes of operation that were previously performed by Nav and Control. The only such mode that will be implemented initially will be the joystick command mode. Other modes desired can be implemented in ROS and activated when Lisp sends the activation command.
Note: The Windows machine and
Linux machine necessary to implement the hybrid mode can, in theory, be
implemented as either two separate computers or running one on a virtual machine
(VM). So far, we have only tried a laptop with Windows 7 running as
the primary OS and Linux running in a VM. While the system did work, it
was not found very satisfactory. ROS makes heavy use of a node called RVIZ
to analyze performance. RVIZ uses display graphics and ran very
slowly. It may be that this is because the VM does not have direct control
of the graphics and passing everything through the Windows machine to drive the
screen is inefficient. Or maybe not, maybe you can find a better
solution. Perhaps a primary Linux box with a virtual Windows?
We did have good luck running with Linux in the main robot laptop and Lisp along with speech recognition & vision running in a netbook.
Note: there is a lot of learning and testing involved in this
"simple" getting started procedure. Unless you already know it all,
just do one step at a time and work with it until you feel comfortable.
1. Install Linux
Install the latest version of Ubuntu on your Windows robot computer as a dual boot option. (Of course you will back up all your files before doing anything so radical !)But, donít spend forever learning Linux right now, once you know some of the basics and can navigate around the Linux file structure, move on to the next step and continue learning Linux as you learn ROS.
I suggest the following: http://www.ubuntu.com/download/help/install-ubuntu-with-windows
If asked during installation, select that you want it to be installed alongside windows (as a dual boot system).
When done, you will be able to select either Windows or Ubuntu each time you start your computer.
If you donít know linux, you can find many tutorials online by Googling "linux tutorials".
2. Install ROS
Install the latest version of ROS following the online installation directions:
Go through the ROS basic tutorials at http://www.ros.org/wiki/ROS/StartGuide. (note: this may take days!)
Note: the next two steps install a new version of the microcontroller code which is compatible with both Windows operation and ROS/Linux operation. This is to allow you to run either version just by choosing Linux or Windows at boot time. With the problems we've had recently with problems getting Nav and Control to run on some computers. I suggest you have backups of your existing microcontroller code and Nav and Control so that you can restore them if the new files don't work properly.3. Install Microcontroller code
4. Update Nav and Control.exe
Update microcontroller code to a version which will run with either the Windows or ROS versions of Leaf. This version is functionally the same as the one on the website, but requires one more change as in the next step. See Leaf 2.0 Software downloads below.
5. Check out Windows Leaf after above changes.
The revised microcontroller code requires a minor change to the Windows Nav and Control.exe program to operate properly. Replace your existing Nav and Control.exe file in your Leaf folder with the following. See Leaf 2.0 Software downloads below.
Note: this revised Nav and Control.exe is functionally identical to the one on the Leaf website dated 2009. If you have made extensive changes to your Nav and Control program, you can update your version with a simple patch. Please contact me for details on the mail list. Alex
Verify that standard Leaf runs in Windows (with the new Nav and Control program).
Just reboot your computer into Windows, run Leaf as usual. If it responds normally to forward motion and turn commands, everything should be OK.
6. Install Leaf_base package (coming soon)
Download the Leaf_base ROS package here and copy it to your ROS workspace folder.
This package contains the interface between standard ROS functions and your robotís drive system. It also has a test program to verify that everything is working. Link to detailed instructions
Provide info on what Leaf_base does for ros: cmd_vel, odom, tf. RC & DIO work for Windows, but not ROS yet.
This package was developed on ROS Electric version and Linux Maverick (10.10). It is likely that you will have to recompile it if you have a different version of ROS or perhaps even of Linux.
Add recompile instructions.. make clean
ref tutorials on building a basic base module include odom & tf
7. Install joystick control (future)
Install joystick control
ref tutorials e.g. http://www.ros.org/wiki/joy/Tutorials/ConfiguringALinuxJoystick.
8. Install hybrid configuration (future)
Install hybrid Window Linux/ROS configuration
9. and on Do your own thing.
The ROS navigation stack has been installed and run although not too successfully yet. The nav stack requires the odom message and tf. Both of these are supplied by the Leaf_base node, but will not have good data unless you have calibrated your inertial heading calculation on the microcontroller.
Add calibration procedure here.
Leaf 2.0 Software downloads:
This is provides as two s19 files for loading on the micro. One for the 256K version of the micro and one for the 512K version.
This code is compatible with both the Windows version Leaf and the ROS version. The Windows version requires the following update to the Nav and Control program.
Note that the new file names attempt to allow a modicum of configurations management. The name means Windows/Ros version of code dated July 24, 2012.
Nav and Control code.
Provided as just an executable right now. It has run successfully on a Windows 7 machine and a Windows XP SP3 machine. If it doesn't run on yours, let me know on the mail list and we'll solve it somehow. Please let me know if it does work for you and what version of windows you are running.
Nav and Control
Just replace your current copy of Nav and Control.exe in your Leaf folder with this one (and cross your fingers).
More Code (soon to come);