Git Product home page Git Product logo

bluedot's People

Contributors

martinohanlon avatar waveform80 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bluedot's Issues

Controlable behaviour for out of circle touch.

The BlueDot is a blue circle (with a radius of lenght 1) inside a bounding white square (with a side of lenght 2 from -1 to 1).
The behavioud when touching outside the circle but inside the square should be better defined and controlable from the API.
In that area, the distance to the center will be higher than 1 (easy to filter at client side too).
For some usage you want only the circle to be sensitive and to report information, for other usage, you want to benefit from the full square.

Squares

I'd very much like an interface that works with squares. A blue dot is cute, but not very functional on a phone or tablet.
Imagine you could define a table with cells that would call a function on touch.

What is the formula for pos.distance? How can it always be below or equal to 1?

I was worry about the value of pos.distance when the finger is outside of the circle.
Mostly because I use it for saturation in my colour picker.

So I added some print debug:
print(pos.x,pos.y,pos.distance)

And I get "1 1 1" as one of the possible value.
Obviously distance is not equal to sqrt(x^2+y^2)

I believe the documentation should be updated on this topic.
Anything above 1.0 seems to be rounded to 1.0.

Multiple user?

Hi, this is a feature request... or a recepie request if it is already possible.

We (dad and son) would like to be able to connect more than one BlueDot app to a python program.

I don't know if it is technically possible.
I don't know how the API can be modified to support that scenario without breaking compatibility.

But I can see some use for it:

  • Control more motor on a robot (like the pilote controling the move and co-pilote controling the camera heading)
  • Shared control where the co-pilote can take over the control

As for implementation, here is some idea:

  • pos.player will contain 1 for first or single controler
  • pos.player will contain 2 for second controler

If possible, the app will display if you are player 1 or player 2.

The reason I say player is that of course BlueDot could be use to control a video game.

Client to Server Communication

Hi,
I'm using the BlueDot app for controlling my RC car. I have BlueDot python server and the BlueDot android app. I have changed a little the android app, i have just added a new activity with two input fields. Now, i'm trying to send the information from the input fields to the python server.Could you help me to do this?

Android app handle server disconnect

The android app should handle server disconnects (i.e. being stopped) better.

Currently the app would only know the server had stopped when it sent a message (i.e. When the dot is pressed).

Should it:

  • mentor the connection and return to the devices list if the server disconnects
  • try to reconnect if it cannot send the next time the dot is pressed
  • monitor the connection and prompt the user 'do u want to reconnect ?'

Protocol not supported error when using Bluedot on RasPi3

I am trying to set up BlueDot on my Pi3 for the first time (running Jessie) and I'm encountering an error I haven't yet been able to decipher. I'm also running BerryConda, which is creating all sorts of fun errors.

I was able to run this on my PiZeroW just fine yesterday. (No BerryConda).

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.4/dist-packages/bluedot/dot.py", line 410, in init
self.start()
File "/usr/local/lib/python3.4/dist-packages/bluedot/dot.py", line 638, in start
self._server.start()
File "/usr/local/lib/python3.4/dist-packages/bluedot/btcomm.py", line 338, in start
self._server_sock = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
File "/usr/lib/python3.4/socket.py", line 123, in init
_socket.socket.init(self, family, type, proto, fileno)
OSError: [Errno 93] Protocol not supported

Is position values going beyond -1 and 1 intentional?

If you read the position's x and y coordinates, they can go outside the range of -1 to 1.

If this is intentional, what's the use case for that?

If it's not intentional, I suggest clamping the values in the property definition.

Trying to pass x and y into a gpiozero object's value is fine, until it hits a value outside of that range, and it falls over, so you have to clamp it yourself. I did this:

def clamped(v):                                                                 
    return max(-1, min(1, v))

Apply a threshold to 'move' events

The android app sends all 'move' events, a threshold should be applied to preserve bandwidth and increase performance and the majority of 'moves' are tiny fluctuations in press position.

Mock App disconnects

After launching the first sample script a connection (?) is made (blue dot appears) and immediately disconnects.

pi@raspberrypi_3:~/bluedot $ python m.py
Server started 00:00:00:00:00:00
Waiting for connection
Client connected 11:11:11:11:11:11
Client disconnected

Pairing a headless Pi

Could we have a feature that makes it possible to put a headless Pi into pairing mode (e.g. by pressing a GPIOzero button to make the device discoverable)

Add double click

add a .when_double_pressed

Measures the time between a release and a press if its less than say 0.5 decs trigger a when_double_pressed

Edge conditions to test

What happens when:

  • Bluetooth is turned off - DONE
  • The bluetooth device is a '3rd party' usb device - DONE
  • There is no bluetooth device on the Pi - DONE
  • While connected, the client & server move out of range - DONE

Seeing ^M in lots of files

For example if I look at examples/dot_debug.py using vi I see the following

def released():^M
    print("Released: x-{} y-{}".format(dot.position.x, dot.position.y))^M
    print()^M
^M

Add badges to README

MockBlueDot improvements

A couple of improvements could be made to MockBlueDot.

mock_client_sending_data should raise an error if the mock client is not connected
MockBluetoothAdapter - should inherit from BluetoothAdapter then allow_pairing could also be inherited
The mock app - could either inherit from the Blue Dot Python app, allowing reuse, or it could be refactored to use tkinter meaning pygame isnt a requirement.

Display a version number in the app

I'm not sure if my app has been updated with the version from the Play Store. It would be useful if the app displayed a version number somewhere

Enhancement request: Rotary encoder

I've been having a play and was wondering if you could add something to make BlueDot behave like a rotary encoder.

The use model that I have in mind is something like:

  • swipe down turns on device (e.g. lamp)
  • swipe up turns off device
  • swipe left or right changes through menu. (E.g Adjust R, G or B)
    • When in menu mode you have 10 seconds to start drawing a circle (e.g. rotary encoder mode).
    • If you draw anti clockwise the value goes down
    • if you draw clockwise the value goes up.
    • When specifying rotary encoder you could give it a min and max value.

Interested to hear your feedback.

Thanks

Use of '-' confusing in debug output

When I run the dot_debug.py script I get output like:

Moved: x-0.06085610017180443 y-0.02328505739569664
Moved: x-0.0385429784655571 y--0.007508336566388607
Moved: x-0.02274600975215435 y--0.030493568629026413
Moved: x-0.011958551593124866 y--0.053042154759168625
Moved: x-0.0030368606094270945 y--0.07534630596637726
Moved: x--0.0070365434512495995 y--0.09938114136457443

All the minus signs are confusing. Consider using equals signs. e.g.

def moved(pos):
    print("Moved: x={} y={}".format(pos.x, pos.y))

Out of range error results in an exception

When the client and server can no longer communicate, the server raises an unhandled exception.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.4/dist-packages/bluedot-0.0.7-py3.4.egg/bluedot/server.py", line 139, in _wait_for_connection
    self._read()
  File "/usr/local/lib/python3.4/dist-packages/bluedot-0.0.7-py3.4.egg/bluedot/server.py", line 152, in _read
    data = self._client_sock.recv(1024, socket.MSG_DONTWAIT)
TimeoutError: [Errno 110] Connection timed out

The app works fine and recognises the connection is lost.

Keep getting import errors

Tried it on a headless Pi Zero W and on a Pi 3B 1.2, with both Python 2.7.9 and Python 3.4.2 but every time I get the following when I try to run the first bit of code:

Traceback (most recent call last):
File "bluedot.py", line 1, in
from bluedot import BlueDot
File "/home/pi/bluedot/bluedot.py", line 1, in
from bluedot import BlueDot
ImportError: cannot import name BlueDot

Better report off duplicate use by catching the exception.

One copy of my program was running in the background (maybe in a screen) and I did notice.
While launching a second instance I got the error below.
Maybe the error message could be more explicit to help troubleshoot it by the user.

Traceback (most recent call last):
  File "r.py", line 21, in <module>
    bd = BlueDot()
  File "/usr/local/lib/python3.4/dist-packages/bluedot/dot.py", line 401, in __init__
    self.start()
  File "/usr/local/lib/python3.4/dist-packages/bluedot/dot.py", line 600, in start
    self._server.start()
  File "/usr/local/lib/python3.4/dist-packages/bluedot/btcomm.py", line 340, in start
    self._server_sock.bind((self.server_address, self.port))
OSError: [Errno 98] Address already in use

ios client

Bluedot is very useful to me. Thank you for your work.
Would you have a plan to develop a Bluedot client for iphone?

BlueDot.btcomm 'threading' data_received calls

BlueDot.btcomm doesnt spawn threads for running the 'data_received' function. This results in potential backlog issues whereby BlueDot is still processing calls when new messages are received.

Build android apk

Hi Martin, could you upload built android apk to github when new version is released?
Most users from China can't access Google Play. Thank you very much.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.