BUG Community

Welcome! Log In

Forums Recent Posts

Subscribe to Recent Posts 11,765 posts found

May 22, 2008 10:41am
tom_joynt 1 post

Topic: BUGmodules / LCD Pressure Sesitivity

On the hardware specs for the LCD screen, it says that there is:
Non-Glare resistive touch screen with touch pressure sensitivity (12-bit resolution)
I was wondering if there is any way currently to use that sensitivity. There is no javadoc or API documentation that I am aware of, next to the Java AWT implementation.

Thanks!
May 22, 2008 10:33am
Medium jconnolly 285 posts

Topic: BUG SDK / Basic Structure of an Application...

jconnolly
Enjoy, and I'll update this thread when more detailed documentation is available.


Wow,syntax highlighting would be really handy. That post fell down the ugly tree and hit every branch on the way down.

http://bugcommunity.com/bugzilla/show_bug.cgi?id=184
May 22, 2008 6:09am
Medium jconnolly 285 posts

Topic: BUG SDK / ClassCastException when tracking services

alain.muse
Hi all,

I have defined a bundle A which contains all the common classes defining the model used by other bundles. This bundle contains an interface IDeviceHandler.
This interface is implemented by services contained in other bundles. Each service registers as a IDeviceHandler.

The bundle that represents "my application" has the following code

_DeviceHandler = (IDeviceHandler)_Context.getService(_ServiceReference[_Index]); <<<--- THE ERROR



Alain,

Could you give me the contents of the exception? The stack trace may be of some help too.

Thanks.
May 21, 2008 7:16pm
turn.self.off 5 posts

Topic: BUGmodules / Connecting modules via cable

i dreamed up a little something i ended up calling the squid.

basically a bug module with ports around the side, top and bottom.

the bottom one can connect to the bug base, or the top of another squid.

the top can, like stated, have another squid inserted, or have a different module inserted.

the ports around the sides (4 of them most likely) are for cables.

this allows for squids to be attached at the other end of the cables, where they can have bug modules mounted and/or spread out cables to even more squids.

May 21, 2008 7:12pm
turn.self.off 5 posts

Topic: BUGmodules / Some ideas for modules.. (a rather long list!)

memo to self, read all posts on this forum before you write any more of them.

i think i have just made a couple of posts about sensors thats found on this list before finding the list…

May 21, 2008 7:08pm
turn.self.off 5 posts

Topic: BUGmodules / Module suggestions

some stuff i posted in other threads here but i guess i can bunch them up for easy reference:

1. "squid" module. basically a branching module that allow one to attach wires to the side of the module via ports that again terminate in pads for other bug modules. also give it a port on top for more squids or a bug module…

hmm, now that i enter that im starting to think that one can basically just use wires that can connect with squids at each end, and use a squid as a pad. and then i move on to thinking about branching squids. the mind boggles…

2. environmental sensors, temperature, humidity, air pressure, that sort of stuff.

hmm, now that i think about it, maybe one more, unique o this thread. lidar ;)

a laser based short range "radar".

May 21, 2008 6:56pm
turn.self.off 5 posts

Topic: Suggestion Box / environmental sensors?

i dont know if its planed, but what about sensors for things like temperature, humidity, air pressure and similar?

May 21, 2008 6:54pm
turn.self.off 5 posts

Topic: Suggestion Box / Making space for more modules.

another option would be some kind of squid like system, where a spreader connector is put onto the base, and then each of those can have maybe 3 ports on the sides and one on top (for putting either a new squid or a module). in each of the 3 side ports one can then put a arm, and on each arm a pad of attaching a module.

with this kind of setup one make for a nice base for building worn computers ;)

May 21, 2008 6:19pm
Medium kschultz 107 posts

Topic: BUG SDK / Using integration build

http://www.igvc.org/design/reports/dr166.pdf

This paper is written by the winner of the intelligent ground vehicle competition, a collegiate autonomous robot navigation challenge. The team comes from Virginia Tech, and wrote a report about it. Their report is not the most detailed, but on pages 9-11 you will see what I’m talking about. They do not talk about actual implementations, but my school’s team uses a similar approach with a Kalman filter and I was going to use that algorithm.

May 21, 2008 6:08pm
Medium jconnolly 285 posts

Topic: BUG SDK / Basic Structure of an Application...

jconnolly
This means little without the code, which I'll reply with once I get an application working that does exactly what we're talking about. :idea:


Ok, I've whipped something together that does what we've discussed. Namely, if it gets an LCD module and the com.buglabs.bug.module.lcd.pub.IModuleDisplay service is available, it will render the output to a GUI, otherwise it just prints to console. The code is below, and it's a bit lengthy. I'll talk to our sysadmin and web-dev team about getting some syntax highlighting together to make this stuff more readable.

I'm going to write up a wiki and fully comment the code and upload it to BUGNet for a good reference point. I have a feeling that this type of selective service referencing will be useful to our community in the near future.

For now, to test this, simply create a new BUG Project, do not select any services required for the application (resulting in a Dragonfly project with only an Activator class generated). Replace the contents of your Activator class with that below.

Try running the app first with the Virtual BUG without any modules attached. Among the verbose OSGi output, you should see the time outputted:
...
STARTING file:/home/jconnolly/localapps/dev/eclipse/plugins/com.buglabs.dragonfly.bug.kernel_1.0.0.5/kernel/com.buglabs.bug.emulator.base.jar
Tracker found service: com.buglabs.bug.base.pub.ITimeProvider
Time: 080521-16_52_35
...


Then try adding the LCD module and a GUI will pop up with the date/time in a Label on the Frame. Simple, but it demonstrates how to handle services as they become available on the fly from OSGi.

Enjoy, and I'll update this thread when more detailed documentation is available.


package test;

import java.awt.Frame;
import java.awt.Label;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;

import com.buglabs.bug.base.pub.ITimeProvider;
import com.buglabs.bug.module.lcd.pub.IModuleDisplay;
import com.buglabs.util.ServiceFilterGenerator;

/*
* This Activator was automatically generated by the Dragonfly SDK provided by BugLabs.
* Only the start and stop methods are
*/
public class Activator implements BundleActivator, ServiceTrackerCustomizer {

/*
* A handle to this Bundles OSGi context
*/
private BundleContext context;

/*
* A handle to the IModuleDisplay service, should it become available.
*/
private IModuleDisplay display;

/*
* A handle to the IModuleDisplay service, should it become available.
* The ITimeProvider service is made available as part of the BUGbase
* bundles, so this should always be available.
*/
private ITimeProvider timeProv;

/*
* A Filter by which the addingService method will be called,
* according to the class names present in the Filter.
*/
private Filter filter;

/*
* Simple data structure to hold the services that may
* be required for this application bundle.
*/
private ArrayList serviceList = new ArrayList();

private ServiceTracker st;

/*
* Default methods required to be overridden for BundleActivator
*
*
*/

/**
* Called when bundle is set to active by OSGi
* @param context provided by OSGi
*/
public void start(BundleContext context) throws Exception {
this.context = context;
System.out.println("Application test in start");
initServices();
filter = context.createFilter(ServiceFilterGenerator
.generateServiceFilter(serviceList));
st = new ServiceTracker(context, filter, this);
st.open();

}

/**
* Called when bundle is set to inactive (stopped) by OSGi
* @param context provided by OSGi
*/
public void stop(BundleContext context) throws Exception {
st.close();

}

/*
* Methods to be overridden for ServiceTrackerCustomizer class
*
*
*
*/

/**
* Called when a service matching something in the Filter for this Activator's
* ServiceTracker object is made available by OSGi
*
* @param reference is a reference to the service that was made available
* when this method is called
*/
public Object addingService(ServiceReference reference) {
//get handle to services I'm interested in

String objClassName = ((String[]) reference
.getProperty(Constants.OBJECTCLASS))[0];

System.out.println(" Tracker found service: " + objClassName);
if (objClassName.endsWith("ITimeProvider")) {
timeProv = (ITimeProvider) context.getService(reference);
doHeadlessStuff();
}

if (objClassName.endsWith("IModuleDisplay") && timeProv != null) {
display = (IModuleDisplay) context.getService(reference);
createGUI();

}

return null;

}

/**
* Called by OSGi Framework when a service matching something in the Filter for this Activator's
* ServiceTracker object is modified in some way
*
* @param reference is a reference to the service that was modified
* when this method is called
*/
public void modifiedService(ServiceReference reference, Object service) {
// TODO Auto-generated method stub

}

/**
* Called by OSGi Framework when a service matching something in the Filter for this Activator's
* ServiceTracker object is modified in some way
*
* @param reference is a reference to the service that was modified
* when this method is called
*/
public void removedService(ServiceReference reference, Object service) {
System.out.println("Service became unavailable: "
+ reference.getBundle().getLocation());

}

/*
*
*
* My own logic
*
*
*/

/**
* Creates a Frame GUI. Called when the IModuleDisplay service becomes available
* as determined in the addingService method. The GUI just prints the time (once)
* when the IModuleDisplay service is available.
*/
private void createGUI() {
Frame frame = display.getFrame();
SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd-HH_mm_ss");
frame.add(new Label(formatter.format(timeProv.getTime())));
frame.setSize(400, 400);
frame.setVisible(true);

}

/**
* Prints out time to console, demonstrating some logic for when the IModuleDisplay
* isn't (or even IS) available.
*/
private void doHeadlessStuff() {
SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd-HH_mm_ss");
String time = formatter.format(timeProv.getTime());
System.out.println("Time: " + time);

}

/**
*
* @return a List of the Services that may be used by this bundle.
*/
public ArrayList getServiceList() {
return serviceList;
}

/**
* Adds the fully-qualified class name for each of the Services that this bundle
* may require.
*/
void initServices() {
getServiceList().add("com.buglabs.bug.module.lcd.pub.IModuleDisplay");
getServiceList().add("com.buglabs.bug.base.pub.ITimeProvider");

}

}

Powered by Community Engine

Top
Login
Close
Bottom