Giter VIP home page Giter VIP logo

calypso-anemometer's People

Contributors

amotl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

calypso-anemometer's Issues

bleak.exc.BleakError: Characteristic 0000a001-0000-1000-8000-00805f9b34fb does not support write operations!

Hi,

I have this writing issue when I try to change the device mode low power or normal.

Here is the python code I'm using :

  self.device = CalypsoDeviceApi(ble_address=self.ble_address)
  self.device.settings.ble_discovery_timeout = bleDiscoveryTimeout
  self.device.settings.ble_connect_timeout = bleConnectTimeout
  print("Establishing connection with Calypso...")
  self.deviceConnected = False
  i = 1
  attempts = 10
  while not self.deviceConnected and i <= attempts:
      try:
          await self.device.connect()
          self.deviceConnected = True
          print("Connection established Calypso: True")
      except:
          print(f"Connection established Calypso: False {i}/{attempts}")
          i+=1
  await self.device.about()
  await self.device.set_mode(CalypsoDeviceMode.LOW_POWER)

Here is the result :

Establishing connection with Calypso...
TimeoutError: 
Connection established Calypso: False 1/10
TimeoutError: 
Connection established Calypso: False 2/10
Connection established Calypso: True
{
  "info": {
    "ble_address": "E2:7C:BD:0A:22:B6",
    "manufacturer_name": "CALYPSO",
    "model_number": "UP10",
    "serial_number": "22:7C:BD:A:22:B6",
    "hardware_revision": "",
    "firmware_revision": "0.70",
    "software_revision": ""
  },
  "status": {
    "mode": "SLEEP",
    "rate": "HZ_4",
    "compass": "OFF"
  }
}

File "/home/ludom/Rob_Cours/aston-autonomous-sailboat-2023/ASTON2023/Drivers/Calypso/calypso.py", line 161, in _initialization
    await self.device.set_mode(CalypsoDeviceMode.LOW_POWER)        
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ludom/pyenv/aston/lib/python3.11/site-packages/calypso_anemometer/core.py", line 208, in set_mode
    await self.client.write_gatt_char(
  File "/home/ludom/pyenv/aston/lib/python3.11/site-packages/bleak/__init__.py", line 659, in write_gatt_char
    await self._backend.write_gatt_char(char_specifier, data, response)
  File "/home/ludom/pyenv/aston/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 854, in write_gatt_char
    raise BleakError(
bleak.exc.BleakError: Characteristic 0000a001-0000-1000-8000-00805f9b34fb does not support write operations!

If anyone knows how to solve this issue, please share it.

NMEA0183 XDR sentences for temperature and battery level

Introduction

At #12 (comment), @UserMacUseface shared a pointer to NMEA0183 XDR sentences 1, which can be used to transmit pitch and roll values.

XDR more

Other than those, XDR sentences can apparently be used to transmit temperature data, and battery level, see both 1 and 2.

mandag 15. februar 2016 15.30.56 UTC+1 skrev Mike følgende:

Here are temperature sentences from two different masthead anemometers I have:

$WIXDR,C,022.0,C,,*52
$YXXDR,C,20,C*61

OpenCPN Manual displays those examples:

$IIXDR,C,19.52,C,TempAir*19
$IIXDR,P,1.02481,B,Barometer*29

Status

Measured Value Transducer Type Measured Data Unit of measure Transducer Name
air temperature "C" temperature 2 decimals "C" celsius "TempAir" or "ENV_OUTAIR_T"

Footnotes

  1. NMEA 0183 Sentences » XDR 2

  2. Nmea XDR conventions?

Release bluetooth connection on program termination

Hi again,

@UserMacUseface thankfully just reported another observation, where the implementation has room for improvement.

Something else: How can you actually end the process "cleanly"?

Hm. When it runs interactively? CTRL+C does not work?

Well. The process runs in the background, after being started at system startup via shellscript and then decoupled. I can terminate the process using pkill calypso, but then the bluetooth connection is still active. In order to fix it, I will need to invoke pkill blue to release the device again. This is certainly not so elegant.

With kind regards,
Andreas.

ultrasonic portable mini compabilitty

i have the ultrasonic portable mini ,which is bassically a smaller version of the ultrasonic portable solar wind meter. I tried reading the documentations but nothing said that it ws incompatible, i am able to connect to bluetooth using my phone and the app .But when i downloaded the library and tried running the calypso-anemometer info command it is able to find my device at the good mac address somehow but not connect to it.The library should be compatible with the device so what could be the inability to connect via bluetooth due to

Provide values in correct format for SignalK telemetry

Dear @amotl,
I'm glad that you did all the prework. I was able to use this project to connect my Calypso to my Signalk-Server / Openplotter-project.
The problem was, that the angle was not stable and returning weird results in the windmeter instrument of signalk.
This is because it awaits the AWA (apparent wind angle) in RAD and not in GRAD.

I changed in model.py and now everything is working fine. I suggest to change that in the repo for other people who want to use that.

BR Simon

wind_direction=wind_direction,

bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons)

Connection to device failed with:

Traceback (most recent call last):
  File "/usr/bin/calypso-anemometer", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/util.py", line 30, in wrapper
    return asyncio.run(func(*args, **kwargs))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/cli.py", line 188, in read
    await run_engine(workhorse=CalypsoDeviceApi, settings=settings, handler=handler)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/engine.py", line 24, in run_engine
    await handler(calypso)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/core.py", line 86, in __aexit__
    raise exc_val
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/engine.py", line 24, in run_engine
    await handler(calypso)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/engine.py", line 79, in handler
    await calypso.set_datarate(rate)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/core.py", line 217, in set_datarate
    await self.client.write_gatt_char(
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/client.py", line 690, in write_gatt_char
    assert_reply(reply)
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons)

Subsequent connection attempt succeeded.

Could be handled with multiple connection retries.

Bad bluetooth connection

I connected the Calypso Ultrasonic. But the bluetooth connection is only stable witihin 1 meter of my raspberry pi4.

Connection on my phone is okay. Calypso is discovered by Raspberry Pi in the bluetooth stack.

Support compass readings

Is this needed?

// enable the IMU to receive roll, pitch and eCompass
const characteristic = await device.writeCharacteristicWithResponseForService(
  service, '0000a003-0000-1000-8000-00805f9b34fb', Buffer.from([0x01]).toString('base64')
);

-- UltraSonicComponent.js#L131-L134

NMEA-0183 `--MWV` sentences

We discovered another software 1 for the OpenWind devices that emits NMEA-0183 sentences using the $WIMWV identifier. Does it make sense to support it?

Example sentence:

$WIMWV,214.8,R,0.1,K
type iNMEAMWV struct {
  MWVId	string // $WIMWV
  WindAngle	string // 214.8 - 0 - 359
  TypeAngle	string // Relative - R True - T
  WindSpeed string //0.1
  Units	string // N - knots  - Kilometers/Metres/N Knots
  Status string // A = valid V = invalid
  Termination string // CR LF - 0x0D 0x0A
}
MWV - Wind Speed and Angle

        1   2 3   4 5 
        |   | |   | | 
 $--MWV,x.x,a,x.x,a*hh<CR><LF>

 Field Number:  
  1) Wind Angle, 0 to 360 degrees 
  2) Reference, R = Relative, T = True 
  3) Wind Speed 
  4) Wind Speed Units, K/M/N 
  5) Status, A = Data Valid 
  6) Checksum

-- http://www.nmea.de/nmea0183datensaetze.html#mwv

Footnotes

  1. https://www.openwind.de/wp-content/uploads/2021/03/RaspberryPi.zip

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.