maritime-labs / calypso-anemometer Goto Github PK
View Code? Open in Web Editor NEWPython driver for the Calypso Instruments Ultrasonic Portable Solar wind meter (UP10)
License: GNU Affero General Public License v3.0
Python driver for the Calypso Instruments Ultrasonic Portable Solar wind meter (UP10)
License: GNU Affero General Public License v3.0
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.
At #12 (comment), @UserMacUseface shared a pointer to NMEA0183 XDR sentences 1, which can be used to transmit pitch
and roll
values.
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
Measured Value | Transducer Type | Measured Data | Unit of measure | Transducer Name |
---|---|---|---|---|
air temperature | "C" temperature | 2 decimals | "C" celsius | "TempAir" or "ENV_OUTAIR_T" |
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 invokepkill blue
to release the device again. This is certainly not so elegant.
With kind regards,
Andreas.
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
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
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.
Hi there,
at GH-12, we were aiming to unlock eCompass readings. However, @UserMacUseface, and @honigwald 1 both reported that compass- and temperature readings do not work yet with the recent 0.6.0 release. Bummer.
Nevertheless the eCompass (Yaw/Heading, Pitch, Roll) and the Temperature don't provide any readings.
With kind regards,
Andreas.
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.
Hi there,
people using this software on real hardware reported about occasional connection errors.
So after a few new tests I notice that it often comes to:
BleakDBusError: [org.bluez.Error.Failed] Software caused connection abortOn this matter, I've already discovered hbldh/bleak#666 and hbldh/bleak#802. Probably there should be another connection retry when this happens?
With kind regards,
Andreas.
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')
);
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.