|
|
Hello,
I Accelerometer
It Thanks, Edrae. |
|
|
Hi Edrae, What BUG version do you have, and what software release are you using? Yes you may be right about interference with LCD module; both modules have accelerometers and offer the accelerometer services in the OSGi service registry. You can confirm which module a service is coming from by checking the “Provider” property that is returned in the dictionary from BundleContext.getServiceReference() / ServiceReference.getProperty(). Also, you can construct an OSGi filter that will only pick up the service from a specific provider, such as the Motion module. I would suspect you’re getting the correct IAccelerometerControl service from the Motion module, but your configuration changes are not having an effect because you are reading acceleration from the LCD module. thx, ken
|
|
|
Hi kgilmer, I have the first BugBas (wifi edition) in 1.4.3. I didn’t manage to know from which module the serice is coming (always get a null value). But I checked every class and import that ar being used and they all come from the Motion module. I already have a service filter :
I tried to switch from IAccelerometerSampleFeed.getSampleImputStream() to the IAccelerometerSampleProvider and I get the same result. I’m pretty sure that the problem come from reading a sample because when I checked the build version of th module and they are the latest ones :
If you wish the source code, I can send it, even if it is a draft. Thanks for spending time on this, Edrae.
|
|
|
Hi Edrae, Sure, if you send me the source to your application I can show you how the service filter is constructed such that you only get the acceleometer service from the Motion module. Email me at ken at buglabs.net. thx, ken |
|
|
Hi Edrae, I got your project source code and took a look. Yes, so essentially the BUG app wizard generates some boilerplate code that needs to be modified. Line 31 in Activator.java is where the service filter is created. This filter string defines which services your application gets bound to at runtime. You need to make a more specific filter that will only bind to accelerometer services provided by the motion module. You can do this one of two ways: 1) Create a new app, use the wizard to generate the filter. If you use the bug app wizard, and on the second page connect to your BUG with motion and LCD modules attached. In the Target BUG group, select your BUG. Below a list of services should be listed. Go to the accelerometer services, check them, then double-click them to edit the service properties. You want to set the Provider to be com.buglabs.bug.module.motion.MotionModlet. Make this change for each of the services you want to come only from the motion device. 2) Update your source code. You can manually specify the information needed to create the proper filter. Here is some example code that will construct a filter string that binds your services only to the motion module:
thx ken |
|
|
It works ! I don’t try the wizard but updating ma code just work fine. Now graphics are update about 4 times per seconds. It’s not smooth but realy better. And it is not a motion sampling issue, just my code or cpu limitation. I lost some time trying the filter with a virtual bug but it doesn’t work. I think it cannot manage provider. I installed Dragonfly 2.0 to test but it didn’t satisfy me, so back to 1.6. Is Dragonfly 2.0 works with BugBase 1 ? Thanks for solution.
Edrae. |
|
|
Hi Edrae, Awesome, glad to hear you got it working! Regarding the SDK, no the 2.0 version is intended only for the BUG2.0 hardware. Happy new year, -ken |
|
|
Happy new year ! |