package main

import (
	"github.com/bluenviron/goroslib/v2/pkg/msgs/nav_msgs"
	"math"
)

func Topic() string {
	return "/odom"
}

func Label() string {
	return "overspeed"
}

func Rule(data *nav_msgs.Odometry) string {
	velocityX := data.Twist.Twist.Linear.X
	velocityY := data.Twist.Twist.Linear.Y
	absV := math.Pow(math.Pow(velocityX, 2)+math.Pow(velocityY, 2), 0.5)
	if absV*3.6 > 0 {
		return "overspeed"
	}
	return ""
}
