@@ -19,49 +19,27 @@ object SeedData {
1919
2020 android.util.Log .d(" BeForBike" , " Proceeding with insertion" )
2121 val baseTime = System .currentTimeMillis()
22- // Insert larger GPS path for visible map display (U shape: east-south-east)
23- val baseLat = - 25.4284f
24- val baseLon = - 49.2733f
25- val baseAlt = 880f
26- // Create a 10-minute ride (600 seconds) with GPS points every 10 seconds = 60 points
27- val totalPoints = 60
28- val timeIntervalSeconds = 10
29- val path = mutableListOf<Triple <Float , Float , Float >>().apply {
30- // East segment: decrease lon (west) - 20 points
31- for (i in 0 .. 19 ) {
32- val progress = i.toFloat() / 19f
33- add(Triple (baseLat, baseLon - progress * 0.2f , baseAlt + progress * 50f ))
34- }
35- // South segment: increase lat - 20 points
36- val turnPoint = last()
37- for (i in 1 .. 20 ) {
38- val progress = i.toFloat() / 20f
39- add(Triple (turnPoint.first + progress * 0.2f , turnPoint.second, turnPoint.third + progress * 30f ))
40- }
41- // East segment: increase lon (east, back) - 20 points
42- val turn2Point = last()
43- for (i in 1 .. 20 ) {
44- val progress = i.toFloat() / 20f
45- add(Triple (turn2Point.first, turn2Point.second + progress * 0.2f , turn2Point.third + progress * 20f ))
46- }
47- }
22+ // Use specific GPS coordinates for the test ride
23+ val path = listOf (
24+ // Start: -25.4290, -49.2721
25+ Triple (- 25.4290f , - 49.2721f , 880f ),
26+ // Checkpoint 1: -25.4285, -49.2730
27+ Triple (- 25.4285f , - 49.2730f , 885f ),
28+ // Checkpoint 2: -25.4292, -49.2738
29+ Triple (- 25.4292f , - 49.2738f , 890f ),
30+ // Checkpoint 3: -25.4301, -49.2735
31+ Triple (- 25.4301f , - 49.2735f , 895f ),
32+ // End: -25.4303, -49.2732 (closer to Checkpoint 3 for better visual connection)
33+ Triple (- 25.4303f , - 49.2732f , 900f )
34+ )
4835
49- // Generate corresponding velocities, powers, and cadences (60 values)
50- val velocities = mutableListOf<Float >()
51- val powers = mutableListOf<Float >()
52- val cadences = mutableListOf<Float >()
36+ val totalPoints = path.size
37+ val timeIntervalSeconds = 75 // 75 seconds between each checkpoint for a 5-minute ride (4 intervals * 75s = 300s = 5 minutes)
5338
54- // Create realistic cycling data with some variation
55- for (i in 0 until totalPoints) {
56- val baseVelocity = 15.0f + (i % 10 ) * 0.5f // 15-19.5 km/h with pattern
57- velocities.add(baseVelocity + (- 1 .. 1 ).random() * 0.5f ) // Add some noise
58-
59- val basePower = 150f + (i % 15 ) * 5f // 150-215 watts with pattern
60- powers.add(basePower + (- 5 .. 5 ).random()) // Add some noise
61-
62- val baseCadence = 85f + (i % 10 ) * 2f // 85-103 rpm with pattern
63- cadences.add(baseCadence + (- 3 .. 3 ).random()) // Add some noise
64- }
39+ // Generate corresponding velocities, powers, and cadences (5 values for 5 points)
40+ val velocities = listOf (17.5f , 18.2f , 16.8f , 19.1f , 17.9f )
41+ val powers = listOf (165f , 172f , 158f , 185f , 175f )
42+ val cadences = listOf (88f , 92f , 85f , 95f , 89f )
6543
6644 // Ensure ride exists first
6745 if (! dbHelper.ensureRideExists(SAMPLE_RIDE_ID , " Sample Ride" )) {
@@ -71,7 +49,7 @@ object SeedData {
7149
7250 android.util.Log .d(" BeForBike" , " Inserting $totalPoints GPS points for sample ride" )
7351 path.forEachIndexed { index, (lat, lon, alt) ->
74- val timestamp = baseTime + index * timeIntervalSeconds * 1000L // 10 seconds apart
52+ val timestamp = baseTime + index * timeIntervalSeconds * 1000L // 75 seconds apart
7553 val success = dbHelper.insertMapData(SAMPLE_RIDE_ID , lat, lon, alt, timestamp = timestamp)
7654 if (success) {
7755 dbHelper.insertVelocity(SAMPLE_RIDE_ID , velocities[index], timestamp = timestamp)
0 commit comments