Remotely Debugging Java Applications

Totem’s software is written as a single Java application executed when power is first applied to the robot.  To speed up the development process the software is developed on a separate MS Surface tablet and then downloaded to the robot.  In most cases the software is tested in the Java development environment hosted on the Surface.  However there are occasions when the software must be tested on the robot itself (e.g., testing modules that interact with hardware).  Thankfully Java supports remote debugging – the ability to use the Java development environment to remotely debug the software executing on the robot.  This article describes the configuration required to accomplish remote debugging of the robot’s Java applications, assuming Eclipse is used as the host Java development environment.

Verify Java Run-Time Compatibility

On the Surface PC invoke the Eclipse Preferences dialog, then navigate to Java > Installed JREs:

eclipse

On the Raspberry Pi type “java -version”:

piRuntime

Both JREs should use the same major version number – 1.8 in this case.

Create a Shell Script to Execute the Application with a Remote Debugging Listener

Java applications are packaged for deployment as a single standalone “jar” archive file.  Contained within the jar archive are the various application implementation artifacts (e.g., Java class files, images, etc).  Executing the application is accomplished by invoking the “java” command and passing the filename of the application’s jar file as a parameter.  To enable remote debugging additional parameters are provided specifying the network port on which java listens for connections by remote development environments.  Unfortunately several parameters must be specified containing rather cryptic syntax.

Rather than type a lengthy command each time we want to run the application we can create a shell script that provides a short, easy-to-type alias instead.  For example, the debug.sh shell script shown below executes the application within jar file totem.jar while creating a remote debugger listener on port 8000:

javaRemoteDebugging

Now each time we want to remotely debug the totem.jar application we can simply type ./debug.sh to start the application.

Create an Eclipse Remote Debugging Configuration

Within the Eclipse development environment create a new remote debugging configuration by opening the Debug Configurations dialog.  Select the line titled Remote Java Application and then click the New icon located  at the top of the list.  In response Eclipse will create a new entry and display a panel listing the entry’s various configuration options.  The following image illustrates typical configuration values, assuming the listener is listening on port 8000 as shown in the previous step:

eclipseRemoteDebugging

At this point the configuration is complete.  To remotely debug the application the first step is to start the application running on the robot by invoking the ./debug.sh command within the Raspberry Pi’s command window.  Then click the Debug button within Eclipse’s debug manager window (or invoke the link within the Debug menu) to connect the Eclipse debugger to the running application.  You can now set breakpoints and examine variable values in real-time as the application executes on the robot.

Chassis Construction Photos 2/16/16

It’s hard to believe it’s been a year since my last post – time really flies! Although I didn’t have much time this year to work on the robot I did make some progress. During this time I’ve been investigating options for mounting the wheel drive motors on the legs. Which side of the axle should contain the main drive gear? Should the motor casing be mounted on the leg’s inside or outside?
Continue reading →

Selecting an H-Bridge Motor Controller

When I started my Tote-m robotics project I had planned on building simple H-bridge motor controllers myself.  The basic circuit is rather simple – four FET transistors connected in an “H” configuration with the motor between them (see here for additional details).  However the bridge is just the tip of the iceberg – I would also need a microcontroller to generate a PWM signal (Pulse Width Modulation) to control the motor’s speed and direction.  Additional features such as regenerative braking add still more complexity.

Given this realization I set out to determine if a commercial motor controller  combining a microcontroller and bridge exists within a reasonable price range.  After scouring the web I finally settled on four candidates: Continue reading →

Designing a Stair Climbing Mechanism

stairClimbingRobotDuring the last year I’ve been researching designs for robot locomotion platforms that can ascend steps while transporting a payload.  This is a much harder problem to solve than originally expected.  The challenge is that there are competing requirements.  In order to easily navigate hallways within a typical home environment a robot can’t be wider or longer than approximately 2 feet (assuming that the robot can turn on its central axis).  Anything wider than this and the robot can’t fit through a door; anything longer and the robot can’t navigate around box corners such as that found in a room entrance.  However, constraining a robot to 2’w x 2’l makes for a relatively narrow base to contain the center of gravity while ascending and descending stairs, especially while carrying a payload that might make the robot tipsy. Continue reading →

Intelligent Motor Subsystem Interface Specification

intelligentMotorSubsystemConcept Overview

From an architecture perspective the Transport Robot is envisioned as a “system of systems” – the robot’s central computer is connected to its various subsystems via a “central nervous system” USB network.  The central computer sends commands to the various subsystems and then later receives acknowledgement that the commands have either been completed or aborted.

The robot’s locomotion platform is comprised of four such subsystems – one subsystem per each leg of the robot.  Instead of the central computer directly controlling the motors of each leg, microcontrollers embedded within each leg translate high-level “move” commands into the low-level signals required to drive each leg’s motor.  For example, suppose the robot wants to move forward one meter.  After determining that the most efficient path is to simply move forward the required distance, the robot’s central computer sends commands to each leg commanding them to move forward the one meter distance.  Each leg’s microcontroller then computes the number of rotations required of the motor given the wheel’s physical properties pre-programmed into the controller.  The controller pulses the motor enough times to cover the required distance, then sends an acknowledgement to the host computer indicating that the command has been accomplished. Continue reading →

Sizing D.C. Drive Motors

motorWhen building a mobile robot selecting the drive motors is one of the most important decisions you will make.  This article covers some of the basic physics and rules of thumb used to select DC drive motors for mobile robots. Before you can select your motors you’ll need to know some characteristics of the robot you want to build.  How much will it weight?  How fast will it move?  Once you have an idea of what your robot will look like, the equations in this article will give you some guidelines you can use for determining the power required from the robot’s motor(s).  These power requirements will determine 1) how fast the robot can accelerate from rest to full speed, and 2) how fast the robot can travel up an incline (if at all). Continue reading →

Project: Transport Robot

Goal

Build a robot that can help transport heavy loads within a home environment.

Project Concept

transportRobotConceptWhen I discuss my robotics hobby with friends a question typically asked is “why build a transport robot instead of something more exciting, for example a humanoid robot?”. The reason is that my main objective is to design and build a robot with a practical application; otherwise a robot is little more than an intellectual curiosity. With this objective in mind the question becomes – what can a robot do for me? For several days I pondered this question while going about my daily activities. Over time I noticed I frequently performed a particular activity – moving items from one place to another. For example carrying trashcans to the curb at night; carrying groceries in from the car after shopping; carrying laundry upstairs after being washed. That’s when I realized having an assistant to carry objects would be a great help, especially up the stairs of a multi-story home. Continue reading →