<commit_before>package scavlink.state

import scavlink.coord.Geo
import scavlink.message.VehicleId
import scavlink.message.common.GpsRawInt
import scavlink.message.enums.MavDataStream

case class GpsState(vehicle: VehicleId,
                    timeIndex: Long = 0,
                    fixType: GpsFixType.Value = GpsFixType.Unknown,
                    rawLocation: Geo = Geo(),
                    groundspeed: Double = 0,
                    course: Double = 0,
                    satellitesVisible: Int = 0,
                    horizontalDop: Double = 0,
                    verticalDop: Double = 0) extends State {
  override def toString = s"GpsState(vehicle=$vehicle fixType=$fixType rawLocation=$rawLocation" +
    s" groundspeed=$groundspeed course=$course satellitesVisible=$satellitesVisible" +
    s" horizontalDop=$horizontalDop verticalDop=$verticalDop)"
}

object GpsFixType extends Enumeration {
  val Unknown = Value(0)
  val None = Value(1)
  val _2D = Value(2)
  val _3D = Value(3)
  val DGPS = Value(4)
  val RTK = Value(5)
}

object GpsState extends StateGenerator[GpsState] {
  def stateType = classOf[GpsState]
  def create = id => GpsState(id)
  def streams = Set(MavDataStream.EXTENDED_STATUS)
  def messages = Set(GpsRawInt())

  def extract = {
    case (state: GpsState, msg: GpsRawInt) =>
      state.copy(
        fixType = GpsFixType(msg.fixType),
        timeIndex = msg.timeUsec,
        rawLocation = Geo(
          msg.lat.toDouble / LatLonScale,
          msg.lon.toDouble / LatLonScale,
          msg.alt.toDouble / AltScale
        ),
        groundspeed = msg.vel.toDouble / 100,
        course = msg.cog.toDouble / 100,
        satellitesVisible = msg.satellitesVisible,
        horizontalDop = msg.eph.toDouble / 100,
        verticalDop = msg.epv.toDouble / 100
      )
  }
}<commit_msg>add nicer strings to GpsState<commit_after>package scavlink.state

import scavlink.coord.Geo
import scavlink.message.VehicleId
import scavlink.message.common.GpsRawInt
import scavlink.message.enums.MavDataStream

case class GpsState(vehicle: VehicleId,
                    timeIndex: Long = 0,
                    fixType: GpsFixType.Value = GpsFixType.Unknown,
                    rawLocation: Geo = Geo(),
                    groundspeed: Double = 0,
                    course: Double = 0,
                    satellitesVisible: Int = 0,
                    horizontalDop: Double = 0,
                    verticalDop: Double = 0) extends State {
  override def toString = s"GpsState(vehicle=$vehicle fixType=$fixType rawLocation=$rawLocation" +
    s" groundspeed=$groundspeed course=$course satellitesVisible=$satellitesVisible" +
    s" horizontalDop=$horizontalDop verticalDop=$verticalDop)"
}

object GpsFixType extends Enumeration {
  val Unknown = Value(0)
  val None = Value(1)
  val _2D = Value(2, "2D")
  val _3D = Value(3, "3D")
  val DGPS = Value(4)
  val RTK = Value(5)
}

object GpsState extends StateGenerator[GpsState] {
  def stateType = classOf[GpsState]
  def create = id => GpsState(id)
  def streams = Set(MavDataStream.EXTENDED_STATUS)
  def messages = Set(GpsRawInt())

  def extract = {
    case (state: GpsState, msg: GpsRawInt) =>
      state.copy(
        fixType = GpsFixType(msg.fixType),
        timeIndex = msg.timeUsec,
        rawLocation = Geo(
          msg.lat.toDouble / LatLonScale,
          msg.lon.toDouble / LatLonScale,
          msg.alt.toDouble / AltScale
        ),
        groundspeed = msg.vel.toDouble / 100,
        course = msg.cog.toDouble / 100,
        satellitesVisible = msg.satellitesVisible,
        horizontalDop = msg.eph.toDouble / 100,
        verticalDop = msg.epv.toDouble / 100
      )
  }
}
{'fraction_non_alphanumeric': 0.09544468546637744, 'fraction_numerical': 0.014642082429501085, 'mean_word_length': 2.457357075913777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3511047', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1145, 'n_words': 258}