Sphero v2.0 component proposal for App Inventor

579 views
Skip to first unread message

Gareth Haylings

unread,
Jun 18, 2014, 10:48:38 AM6/18/14
to app-inventor-o...@googlegroups.com
Hi

I am about to buy a Sphero V2.0 which is a robotic ball and will be creating a component to control and program it in AI.

If you have never heard of Sphero it's robotic ball that has a great open source platform that would be ideal for eduactional development. Here is a link to the website: http://www.gosphero.com/sphero-2-0/

The component blocks that I would look at adding to control and receive feedback from  sphero would be:

Heading - Set the direction Sphero will move
Speed - Set the speed sphero will move
Color - Changes the colour of Sphero
CollisionDetection - Event block to detect even sphero has his something
Location - Return the current location of sphero in relation to its start position
MovementDetection - event that returns the rotation of sphero. This is handy if you want to use sphero as a control interface for an app like a joystick


I will be developing this component for myself when I get the Sphero but just wanted feedback whether or not it is of interest as a component that could be added to the official version MIT App Inventor before I write a proposal document.

Jos Flores

unread,
Jun 18, 2014, 11:08:42 AM6/18/14
to app-inventor-open-source-dev
Hi Gareth, this is really cool.

I like the idea of movement; because it's a physical gadget,
embodiment could be a cool thing to play with (like logo turtles).

I would write the document and share it in any case (be it of interest
to MIT or not); you are likely to get good feedback from the community
in any case. Let us know how it goes!

cheers,
José
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to app-inventor-open-so...@googlegroups.com.
> To post to this group, send email to
> app-inventor-o...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/app-inventor-open-source-dev.
> For more options, visit https://groups.google.com/d/optout.

M. Hossein Amerkashi

unread,
Jun 18, 2014, 1:04:19 PM6/18/14
to app-inventor-o...@googlegroups.com

Hefty price but looks pretty fun.

Hossein.

Gareth Haylings

unread,
Jun 18, 2014, 4:27:25 PM6/18/14
to app-inventor-o...@googlegroups.com
Sphero v2 is £94 in the UK which is quite a lot but you can pickup a v1 version for between £35 - £55 on ebay. The main difference between the v1 and v2 is that v2 is twice as fast, the leds are a lot brighter and the communication distance has been increase other than that they are the same. The SDK is compatable with both version.

After making the post earlier I thought to myself I have 6 wowwee RS Media robots and a few other robots. My other half may not be too impressed if I get another robot until I sold a few of my other robots first.

I have been watching lots of videos on youtube about this robot ball and I buzzing with all the hacks and idea I could turn it into so am desperate to get my hands on one of these. As soon as I do I will see exactly what it is capable of and make a proper proposal. I can see the Sphero Component would be a great addition in AI for both hobbiest like myself and the eductional target audience MIT App Inventor is aimed at.

Will keep you posted as soon as I get one



> To post to this group, send email to
> app-inventor-o...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/app-inventor-open-source-dev.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.

RobNCD

unread,
Jun 19, 2014, 4:19:01 AM6/19/14
to app-inventor-o...@googlegroups.com
Thats really cool Gareth.

Now I gotta have one...... LOL 

$129 and $79 on Amazon

Robert

Hal Abelson

unread,
Jun 19, 2014, 7:59:01 AM6/19/14
to App Inventor Open Source Development
HI Gareth,

This looks like great fn.

What is your component like?  Is it a Java library that would need to be added to a special version of App Inventor?   It's too specialized for us to build in to the standard version of App Inventor, so what would you suggest as the easiest way to non-technical users to be able to play with this?

== Hal


==Hal


--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.

Gareth Haylings

unread,
Jun 19, 2014, 9:38:15 AM6/19/14
to app-inventor-o...@googlegroups.com
Hi Hal

What is your component like? 
Haven't done any work on it at the moment as I still need to buy one first. If more of an idea at the moment . I am thinking the Sphero component will be a long the line of the LEGO Mindstorm blocks in AI.

Is it a Java library that would need to be added to a special version of App Inventor?
Yes it's a java library that I will add to the AI source code. Here is a link to the development area for Sphero https://developer.gosphero.com/

It's too specialized for us to build in to the standard version of App Inventor, 
That's not a problem I will be creating the component for my own purpose when I get the Sphero.

what would you suggest as the easiest way to non-technical users to be able to play with this?
Connecting to the ball is done via Bluetooth. There are a number of app on googleplay to control the ball. So that is the easy way to play with it.  Here's a link to the Sphero apps already available:  https://play.google.com/store/search?q=sphero&c=apps

There's also an app which allows you to create macros for the ball on you andriod or IOS device, but if you what to develop an app yourself for the ball then you'll need to either know C or JAVA that's the reason I really want to add a Sphero component to AI so non-programs can easily and quick'ly develop apps for the ball.



On Thursday, 19 June 2014 12:59:01 UTC+1, halgoogle wrote:
HI Gareth,

This looks like great fn.

What is your component like?  Is it a Java library that would need to be added to a special version of App Inventor?   It's too specialized for us to build in to the standard version of App Inventor, so what would you suggest as the easiest way to non-technical users to be able to play with this?

== Hal


==Hal


On Wed, Jun 18, 2014 at 10:48 AM, Gareth Haylings <gareth....@googlemail.com> wrote:
Hi

I am about to buy a Sphero V2.0 which is a robotic ball and will be creating a component to control and program it in AI.

If you have never heard of Sphero it's robotic ball that has a great open source platform that would be ideal for eduactional development. Here is a link to the website: http://www.gosphero.com/sphero-2-0/

The component blocks that I would look at adding to control and receive feedback from  sphero would be:

Heading - Set the direction Sphero will move
Speed - Set the speed sphero will move
Color - Changes the colour of Sphero
CollisionDetection - Event block to detect even sphero has his something
Location - Return the current location of sphero in relation to its start position
MovementDetection - event that returns the rotation of sphero. This is handy if you want to use sphero as a control interface for an app like a joystick


I will be developing this component for myself when I get the Sphero but just wanted feedback whether or not it is of interest as a component that could be added to the official version MIT App Inventor before I write a proposal document.

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.

M. Hossein Amerkashi

unread,
Jun 19, 2014, 9:46:21 AM6/19/14
to app-inventor-o...@googlegroups.com
FYI, Brookestone stores carry Spheros. HERE is the store in Boston

-Hossein.

Gareth Haylings

unread,
Jul 6, 2014, 3:26:53 PM7/6/14
to app-inventor-o...@googlegroups.com

Hi 

I now have a Sphero V2. Cost me £48. It's a really cool piece of tech with load of potential for project I have in mine. I have been playing with it and creating some stand alone apps to control all aspects of it such:

  • control movement, speed
  • Changing its colours
  • receiving its feedback from the in build sensors to make it act as a control interface for rotation of an image.
The apps were very easy and quick to write via ecilpse. 1 other thing I bought at the same time as Sphero was a AI-Ball which is a tiny IP camera. I made a chariot for Sphero to pull with the AI-Ball mounted on top. I managed to drive Sphero round my house while while sitting on my sofa and viewing the live video on my android phone. Was so cool and worked really well. 




On Monday I started to port the code I had used to create a new Sphero AI component which took a while to work out. I have now managed to connect to Sphero via AI but unforunately as soon as the connection is made the companion app crashes and I've been bang my head against a brick wall since Friday trying to solve this issue. the error I am get via logcat is as follows:

E/ActivityThread(20225): Activity appinventor.ai_test.test.Screen1 has leaked IntentReceiver orbotix.robot.base.RobotProvider$1@41c295f0 that was originally registered here. Are you missing a call to unregisterReceiver()?
E/ActivityThread(20225): android.app.IntentReceiverLeaked: Activity appinventor.ai_test.test.Screen1 has leaked IntentReceiverorbotix.robot.base.RobotProvider$1@41c295f0 that was originally registered here. Are you missing a call to unregisterReceiver()?

I am unsure how to solve this so will be taking a slightly different route to control and program Sphero from AI. I'm now going to attempt is create a stand alone app that can be control via intents sent by AI. I'll need to learn about intents and app to app control over the next week to be able to do this. http://developer.android.com/training/basics/intents/filters.html 

RobNCD

unread,
Jul 6, 2014, 3:59:32 PM7/6/14
to app-inventor-o...@googlegroups.com
Hi Gareth

Do you have a copy of the component code available to anywhere for us to take a look at? 
Robert

Gareth Haylings

unread,
Jul 6, 2014, 4:42:40 PM7/6/14
to app-inventor-o...@googlegroups.com
not at the moment will put it up on git



--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.

Gareth Haylings

unread,
Jul 6, 2014, 5:31:46 PM7/6/14
to app-inventor-o...@googlegroups.com, gareth....@googlemail.com

Here is a link to the github with the code for the Sphero component

It works and and finds sphero and connects with the following line of code.
line 102:  RobotProvider.getDefaultProvider().connect(sphero.iterator().next());

Then the AI companion app crashes which I can't find a solution to as of yet



As a stand alone app I'm using roughly the same could and all is fine?

Here is the code from the stand alone app

package com.orbotix.sample.helloworld;
import java.util.List;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
import orbotix.robot.base.*;
import orbotix.robot.sensor.DeviceSensorsData;
import orbotix.sphero.*;
/** Connects to an available Sphero robot, and then flashes its LED. */
public class HelloWorldActivity extends Activity  {
    public static final String TAG = "OBX-HelloWorld";
    /** The Sphero Robot */
    private Sphero mRobot;
       
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        RobotProvider.getDefaultProvider().addConnectionListener(new ConnectionListener() {
            @Override
            public void onConnected(Robot robot) {
               mRobot = (Sphero) robot;
               mRobot.setColor(255, 0, 0);
               mRobot.rotate(180);
               mRobot.setBackLEDBrightness(1);
           
            }
     
            @Override
            public void onConnectionFailed(Robot sphero) {
           
            }
            @Override
            public void onDisconnected(Robot robot) {
              mRobot = null;
            }
        }); 
        
        RobotProvider.getDefaultProvider().addDiscoveryListener(new DiscoveryListener() {
            @Override
            public void onBluetoothDisabled() {
           
            }
            @Override
            public void discoveryComplete(List<Sphero> spheros) {
            
            }
            @Override
            public void onFound(List<Sphero> sphero) {
              RobotProvider.getDefaultProvider().connect(sphero.iterator().next());
            }
        });
              
        boolean success = RobotProvider.getDefaultProvider().startDiscovery(this);
        if(!success){
            Toast.makeText(HelloWorldActivity.this, "Unable To start Discovery!", Toast.LENGTH_LONG).show();
        }
    }
   
    /** Called when the user comes back to this app */
    @Override
    protected void onResume() {
        super.onResume();
     
      
    }
  
    /** Called when the user presses the back or home button */
    @Override
    protected void onPause() {
        super.onPause();
       
        //if (mRobot != null) {
       
         //   mRobot.disconnect();
        //}
    }
    
}




On Sunda
y, 6 July 2014 21:42:40 UTC+1, Gareth Haylings wrote:
not at the moment will put it up on git

On 6 July 2014 20:59, RobNCD <rob...@gmail.com> wrote:
Hi Gareth

Do you have a copy of the component code available to anywhere for us to take a look at? 
Robert

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.

Gareth Haylings

unread,
Jul 6, 2014, 5:36:21 PM7/6/14
to app-inventor-o...@googlegroups.com, gareth....@googlemail.com
Sorry forgot to put link to the git for sphero component:

https://github.com/themadrobot/appinventor-sources/commit/c2a249990dba3ba2470da6c6f7472378e5c6fc22

The line of code is in mraiSphero.java line 102 that connects the sphero that is found.
line 102:  RobotProvider.getDefaultProvider().connect(sphero.iterator().next());
 
As I mentioned on the last post it connect with is line but as soon as it does the companion app crashes. 

Jos Flores

unread,
Jul 6, 2014, 5:46:03 PM7/6/14
to app-inventor-open-source-dev, Gareth Haylings
Gareth, two things to look at. First, I only see edits to two
build.xml files; I believe you are missing the buildserver one.
Second, you are not registering the onResume with the onResumeListener
interface in your component. That might be the cause to the leaking,
although it might not, but it's definitely a difference between your
component and the sample code.

cheers,
José
>>>> an email to app-inventor-open-so...@googlegroups.com.
>>>> To post to this group, send email to app-inventor-o...@googlegroups.com.
>>>> Visit this group at
>>>> http://groups.google.com/group/app-inventor-open-source-dev.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to app-inventor-open-so...@googlegroups.com.

Gareth Haylings

unread,
Jul 6, 2014, 5:51:26 PM7/6/14
to app-inventor-o...@googlegroups.com, gareth....@googlemail.com
forgot to add that file to my git it is already there. I have reuploaded my git

>>>> To post to this group, send email to app-inventor-o...@googlegroups.com.
>>>> Visit this group at
>>>> http://groups.google.com/group/app-inventor-open-source-dev.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Gareth Haylings

unread,
Jul 6, 2014, 6:06:27 PM7/6/14
to app-inventor-o...@googlegroups.com, gareth....@googlemail.com

I have attached the stand alone project which works and does crash. It's basically the same code as the code I ported to my AI Sphero component.

I would love to find a solution to this as I don't really want to go down the route of and external app controlled by AI.
sphero.zip

Gareth Haylings

unread,
Jul 10, 2014, 9:47:08 AM7/10/14
to app-inventor-o...@googlegroups.com, gareth....@googlemail.com
Hi

I've now worked out what is wrong. I was missing a library file which I think is used by sphero after it connects. The file I was missing is libachievement_manager.so which is stored in the folder libs\armeabi in the standalone android app folder when I removed this file from the stand alone app and recompile the app I found sphero connects but as soon as it connects the app crashes which is the same issue as I am having in AI. When I added the libs\armeabi\libachievement_manager.so file back into the standalone project and recompile the app sphero connects and I can control it from the app without any issue. I have now tried to add the  libs\armeabi\libachievement_manager.so to app inventor but think I may be doing something incorrectly as I'm still finding the same issue where sphero connects then the companion app crashes which means I think I am not adding  libs\armeabi\libachievement_manager.so in the correct way in the AI source code. In the standalone app I found libachievement_manager.so has to be in the sub folder libs\armeabi . If I place  libachievement_manager.so directly in the libs a long with the RobotLibrary.jar file the app crashes after connect. Here is an updated link to my github branch for my AI sphero component with the way I am adding libachievement_manager.so

https://github.com/themadrobot/appinventor-sources/commit/bffac45f4343d2e0270b47e216c2ca739115bd73

So you can compare the file structure of the stand alone app I have attached a working ecilpse project to show the libs directory setup correctly I need to do the same in the AI source to get the sphero component working in AI.
Really appreciate any advise on how to add libs\armeabi\libachievement_manager.so to AI.
SpheroUpdateApp.zip

Gareth Haylings

unread,
Jul 17, 2014, 4:20:35 AM7/17/14
to app-inventor-o...@googlegroups.com, gareth....@googlemail.com
Hi

After hitting a brick wall for over a week and almost dropping this project I've managed to get the missing libachievement_manager.so file include in the companion app and now Sphero stays connected via AI. This means I can now continue the project and may a fully working Sphero component. At the moment to get the missing file added I had to manually added but I am pretty confident I will be able to compile this as part of the companion App.

Here is my proposal document for the type of blocks I will be adding to the Sphero component in AI. I may change a few bit in there. Please have a look and comment


In few weeks I will hold a hangout and demonstrate the new component.

Abraham Getzler

unread,
Jul 17, 2014, 4:19:30 PM7/17/14
to app-inventor-o...@googlegroups.com
The document is very detailed and well formatted, but I'm missing something -
I see Parameters, which I associate with Input to blocks,
but isn't there another name and category for the data fields returned to you by event blocks
to tell you the state of your Sphero?

ABG


To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.

gareth.haylings

unread,
Jul 17, 2014, 4:54:33 PM7/17/14
to app-inventor-o...@googlegroups.com
Hi


 The data fields to be returned from sphero are under the sensor feedback category. These sets of blocks will return the current live heading and orientation the ball. The values returned from the sensor feedback could be used to turn sphero into input device like a 3d joystick so that it can be used to control a game. To find out if sphero is connected the isconnected block will tell you this.

The document is a work in progress at the moment and I may reduce or change some of the blocks. I should have most of these blocks working by next Monday should be able to post a video blog to demonstrate sphero working with AI




Sent from Samsung tablet



-------- Original message --------
From Abraham Getzler <aget...@gmail.com>
Date: 17/07/2014 21:19 (GMT+00:00)
To app-inventor-o...@googlegroups.com
Subject Re: [App Inventor Open Source Development] Sphero v2.0 component proposal for App Inventor

Gareth Haylings

unread,
Jul 24, 2014, 5:11:03 PM7/24/14
to app-inventor-o...@googlegroups.com, gareth....@googlemail.com
Really cool I now have sensor feedback and full control of Sphero via my AI component. Not far off completing the component. Hopefully by next week.

>>>> To post to this group, send email to app-inventor-o...@googlegroups.com.
>>>> Visit this group at
>>>> http://groups.google.com/group/app-inventor-open-source-dev.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> To post to this group, send email to
> app-inventor-o...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/app-inventor-open-source-dev.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.

Steeve P

unread,
Sep 18, 2018, 9:10:26 AM9/18/18
to App Inventor Open Source Development
Hello I am a professor in France and I would want to program robots "sphero" with App inventor, but I do not arrive there. Have you a solution? thank you very much.

Juan Antonio

unread,
Sep 19, 2018, 4:28:08 AM9/19/18
to App Inventor Open Source Development
Reply all
Reply to author
Forward
0 new messages