Skip to content

Added wind direction calibration#33

Open
gregw wants to merge 3 commits intomaritime-labs:mainfrom
gregw:calibration
Open

Added wind direction calibration#33
gregw wants to merge 3 commits intomaritime-labs:mainfrom
gregw:calibration

Conversation

@gregw
Copy link
Copy Markdown

@gregw gregw commented May 27, 2025

Since a wind sensor may not be installed in alignment, this PR adds the --calibration option to add an offset to the wind_direction.

The conversion of wind_direction to windAngle has been corrected so that it is correctly negative for a port angle. The calculations assumes that 360 degree heading will be given for a sensor without a compass.

The inclusion of navigation.attitude fields has been made conditional on the compass being turned on.

The TODO of "Improve path naming" has been implemented by allowing an address to be pass in, which defaults to a sanitized segment based on the name and location

Since a wind sensor may not be installed in alignment, this PR adds the --calibration option to add an offset to the wind_direction.

The conversion of wind_direction to windAngle has been corrected so that it is correctly negative for a port angle.  The calculations assumes that 360 degree heading will be given for a sensor without a compass.

The inclusion of navigation.attitude fields has been made conditional on the compass being turned on.

The TODO of "Improve path naming" has been implemented by allowing an address to be pass in, which defaults to a sanitized segment based on the name and location
@gregw
Copy link
Copy Markdown
Author

gregw commented May 27, 2025

This is not yet tested, as I cannot get near to my sensor for a few days.
Also this is the first python code I've ever written - so probably all wrong anyway.

@gregw
Copy link
Copy Markdown
Author

gregw commented May 27, 2025

Ha, the BLE just reaches my boat on the mooring from the shore! so I was able to test. Looks like it is working as intended:

2025-05-27 13:31:29,023 [calypso_anemometer.telemetry.network] INFO    : Sending message to udp://127.0.0.1:4123
{"updates": [{"$source": "calypso-up10", "values": [{"path": "environment.outside.temperature", "value": 273.15}, {"path": "environment.wind.angleApparent", "value": -0.47123889803846897}, {"path": "environment.wind.speedApparent", "value": 8.9}, {"path": "electrical.batteries.calypso-up10:mast.name", "value": "Calypso UP10"}, {"path": "electrical.batteries.calypso-up10:mast.location", "value": "Mast"}, {"path": "electrical.batteries.calypso-up10:mast.capacity.stateOfCharge", "value": 1.0}]}]}
{
  "wind_speed": 8.8,
  "wind_direction": 333,
  "battery_level": 100,
  "temperature": 0,
  "roll": -90,
  "pitch": -90,
  "heading": 360
}

@gregw gregw marked this pull request as ready for review May 27, 2025 03:36
Since a wind sensor may not be installed in alignment, this PR adds the --calibration option to add an offset to the wind_direction.

The conversion of wind_direction to windAngle has been corrected so that it is correctly negative for a port angle.  The calculations assumes that 360 degree heading will be given for a sensor without a compass.

The inclusion of navigation.attitude fields has been made conditional on the compass being turned on.

The TODO of "Improve path naming" has been implemented by allowing an address to be pass in, which defaults to a sanitized segment based on the name and location
@gregw
Copy link
Copy Markdown
Author

gregw commented May 30, 2025

I modified it to not use ':' in the battery name:


Ha, the BLE just reaches my boat on the mooring from the shore! so I was able to test. Looks like it is working as intended:

2025-05-27 13:31:29,023 [calypso_anemometer.telemetry.network] INFO    : Sending message to udp://127.0.0.1:4123
{"updates": [{"$source": "calypso-up10", "values": [{"path": "environment.outside.temperature", "value": 273.15}, {"path": "environment.wind.angleApparent", "value": -0.47123889803846897}, {"path": "environment.wind.speedApparent", "value": 8.9}, {"path": "electrical.batteries.calypso-up10_mast.name", "value": "Calypso UP10"}, {"path": "electrical.batteries.calypso-up10_mast.location", "value": "Mast"}, {"path": "electrical.batteries.calypso-up10_mast.capacity.stateOfCharge", "value": 1.0}]}]}
{
  "wind_speed": 8.8,
  "wind_direction": 333,
  "battery_level": 100,
  "temperature": 0,
  "roll": -90,
  "pitch": -90,
  "heading": 360
}

batteries values are now in databrowser:

Path Value type date source
electrical.batteries.calypso-up10_mast.capacity.stateOfCharge 0.47 ratio 05/31 07:24:22 calypso-up10
electrical.batteries.calypso-up10_mast.location "Mast" 05/31 07:24:22 calypso-up10
electrical.batteries.calypso-up10_mast.name "Calypso UP10" 05/31 07:24:22 calypso-up10
environment.outside.temperature 220.14999999999998 K 05/31 07:24:22 calypso-up10
environment.wind.angleApparent -0.009139091124986972 rad 05/31 07:24:22 AdvancedWind.XX
environment.wind.angleApparent 0 rad 05/31 07:24:22 calypso-up10
environment.wind.angleTrueWater -0.009139091124986972 rad 05/31 07:24:22 AdvancedWind.XX
environment.wind.directionTrue -0.009139091124986972 rad 05/31 07:24:22 AdvancedWind.XX
environment.wind.speedApparent 4.255894893753966 m/s 05/31 07:24:22 AdvancedWind.XX
environment.wind.speedApparent 6 m/s 05/31 07:24:22 calypso-up10
environment.wind.speedOverGround 4.255894893753966 m/s 05/31 07:24:22 AdvancedWind.XX
environment.wind.speedTrue 4.255894893753966 m/s 05/31 07:24:22 AdvancedWind.XX

Since a wind sensor may not be installed in alignment, this PR adds the --calibration option to add an offset to the wind_direction.

The conversion of wind_direction to windAngle has been corrected so that it is correctly negative for a port angle.  The calculations assumes that 360 degree heading will be given for a sensor without a compass.

The inclusion of navigation.attitude fields has been made conditional on the compass being turned on.

The TODO of "Improve path naming" has been implemented by allowing an address to be pass in, which defaults to a sanitized segment based on the name and location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant