OpenMarine

Full Version: How to convert radians to degrees in Grafana
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I get magnetic heading from IMU that is recognized by pypilot. It gives heading in two places navigation.attitude as yaw and also as navigation.headingMagnetic. I can get the latter one to Grafana, but it appears as radians. Is it possible to convert to degrees before or inside Grafrana.

Also is it possible to use navigation.attitude "yaw" "pitch" and "roll" in Grafana?
(2023-01-29, 08:16 PM)Relax Wrote: [ -> ]Hi!

I get magnetic heading from IMU that is recognized by pypilot. It gives heading in two places navigation.attitude as yaw and also as navigation.headingMagnetic. I can get the latter one to Grafana, but it appears as radians. Is it possible to convert to degrees before or inside Grafrana.

Also is it possible to use navigation.attitude "yaw" "pitch" and "roll" in Grafana?

Signalk uses SI units - https://www.nist.gov/pml/owm/metric-si/si-units  so best to leave the data as it is. In grafana it's easy to convert to degC. - in select, add a math function. 
[Image: 7s62iK2.png]

Also, I find it really useful to average data in grafana as well, set the group by to 5 minutes or wherever. You can also set select/mean to max which can be handy to see the highest wind gusts.  like this - 

[Image: NArzsEV.png]

Oops, for radians to degrees - 
[Image: QmTMMvx.png]
Hi,

Thank you for your reply. I remembered that Grafana looked like that before. I use now the Openplotter 3 and Openplotter help quides me to use WebSocket API: [attachment=2058]

I managed to get the Magnetic Heading defined in the Transform tab: [attachment=2060]

I think this the new way to bring data to Grafana without InfluxDB...
(2023-01-30, 07:30 PM)Relax Wrote: [ -> ]Hi,

Thank you for your reply. I remembered that Grafana looked like that before. I use now the Openplotter 3 and Openplotter help quides me to use WebSocket API:

I managed to get the Magnetic Heading defined in the Transform tab: 

I think this the new way to bring data to Grafana without InfluxDB...

Ah, Flux - not quite got my head round that yet so I´ve stuck with infuxQL for now, on my grafana  you can set which query language you want to use in the data sources tab. 
Doesn't the websocket limit you to live data, no historical charts?

[Image: KCtIeeI.png]
(2023-01-30, 10:00 PM)PaddyB Wrote: [ -> ]
(2023-01-30, 07:30 PM)Relax Wrote: [ -> ]Hi,

Thank you for your reply. I remembered that Grafana looked like that before. I use now the Openplotter 3 and Openplotter help quides me to use WebSocket API:

I managed to get the Magnetic Heading defined in the Transform tab: 

I think this the new way to bring data to Grafana without InfluxDB...

Ah, Flux - not quite got my head round that yet so I´ve stuck with infuxQL for now, on my grafana  you can set which query language you want to use in the data sources tab. 
Doesn't the websocket limit you to live data, no historical charts?

[Image: KCtIeeI.png]

Yes, the websocket limits me to live data only. I think that I have to install Influx some other way to get it fully functional.
Here is an example which works for me using flux: 
Code:
from(bucket: "Sharky")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "self.environment.wind.angleTrueGround")
  |> filter(fn: (r) => r["_field"] == "value")
  |> map(fn: (r) => ({ r with _value: ((r._value*180.0/3.1415)+360.0)%360.0 }))
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")

best regards, 
Tobias