This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to convert radians to degrees in Grafana
#1
Question 
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?
Reply
#2
(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]
Reply
#3
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...
Reply
#4
(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]
Reply
#5
(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.
Reply
#6
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)