carla 0.14.1

Rust client library for Carla simulator
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
use super::{Junction, LandmarkList, WaypointList};
use crate::{
    error::ffi::with_ffi_error,
    geom::Transform,
    road::{
        JuncId, LaneId, LaneType, RoadId, SectionId,
        element::{LaneMarking, LaneMarking_LaneChange},
    },
};
use carla_sys::carla_rust::client::FfiWaypoint;
use cxx::SharedPtr;
use derivative::Derivative;
use static_assertions::assert_impl_all;

/// A waypoint on a CARLA map representing a specific position on a road lane.
///
///  [`Waypoint`] is fundamental for navigation and path planning in CARLA. Each waypoint:
/// - Represents a point on a specific lane with position and orientation
/// - Provides methods to navigate forward/backward along lanes
/// - Allows lane changes and junction traversal
/// - Gives access to lane properties (width, type, markings)
/// - Can find nearby landmarks (traffic signs, speed limits, etc.)
///
/// Corresponds to [`carla.Waypoint`](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint) in the Python API.
///
/// # Examples
///
/// ```no_run
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// use carla::client::Client;
///
/// let client = Client::connect("localhost", 2000, None)?;
/// let world = client.world()?;
/// let map = world.map()?;
///
/// // Get a waypoint at a specific location
/// let location = carla::geom::Location::new(10.0, 20.0, 0.3);
/// if let Some(waypoint) = map.waypoint_at(&location)? {
///     println!("Lane ID: {}", waypoint.lane_id());
///     println!("Lane width: {}m", waypoint.lane_width());
///
///     // Navigate forward
///     let next_waypoints = waypoint.next(2.0)?; // 2 meters ahead
///
///     // Change lanes
///     if let Some(left_lane) = waypoint.left()? {
///         println!("Can change to left lane");
///     }
/// }
/// # Ok(())
/// # }
/// ```
#[derive(Clone, Derivative)]
#[derivative(Debug)]
#[repr(transparent)]
pub struct Waypoint {
    #[derivative(Debug = "ignore")]
    pub(crate) inner: SharedPtr<FfiWaypoint>,
}

impl Waypoint {
    /// Returns the unique identifier of this waypoint.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.id](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.id)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.id](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.id)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.id](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.id)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn id(&self) -> u64 {
        self.inner.GetId()
    }

    /// Returns the OpenDRIVE road ID.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.road_id](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.road_id)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.road_id](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.road_id)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.road_id](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.road_id)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn road_id(&self) -> RoadId {
        self.inner.GetRoadId().into()
    }

    /// Returns the OpenDRIVE section ID.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.section_id](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.section_id)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.section_id](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.section_id)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.section_id](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.section_id)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn section_id(&self) -> SectionId {
        self.inner.GetSectionId().into()
    }

    /// Returns the OpenDRIVE lane ID.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.lane_id](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.lane_id)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.lane_id](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.lane_id)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.lane_id](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.lane_id)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn lane_id(&self) -> LaneId {
        self.inner.GetLaneId().into()
    }

    /// Returns the distance from the beginning of the road to this waypoint (in meters).
    ///
    /// This is the "s" coordinate in the OpenDRIVE specification.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.s](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.s)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.s](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.s)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.s](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.s)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn distance(&self) -> f64 {
        self.inner.GetDistance()
    }

    /// Returns the transform (position and rotation) of this waypoint.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.transform](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.transform)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.transform](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.transform)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.transform](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.transform)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn transform(&self) -> Transform {
        Transform::from_ffi(self.inner.GetTransform())
    }

    /// Returns the OpenDRIVE junction ID (or -1 if not in a junction).
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.junction_id](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.junction_id)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.junction_id](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.junction_id)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.junction_id](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.junction_id)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn junction_id(&self) -> JuncId {
        self.inner.GetJunctionId().into()
    }

    /// Returns `true` if this waypoint is inside a junction.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.is_junction](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.is_junction)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.is_junction](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.is_junction)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.is_junction](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.is_junction)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn is_junction(&self) -> bool {
        self.inner.IsJunction()
    }

    /// Returns the junction this waypoint belongs to (if any).
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.get_junction](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.get_junction)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.get_junction](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.get_junction)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.get_junction](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.get_junction)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn junction(&self) -> crate::Result<Option<Junction>> {
        let ptr = with_ffi_error("junction", |e| self.inner.GetJunction(e))?;
        Ok(Junction::from_cxx(ptr))
    }

    /// Returns the width of the lane in meters.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.lane_width](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.lane_width)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.lane_width](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.lane_width)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.lane_width](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.lane_width)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn lane_width(&self) -> f64 {
        self.inner.GetLaneWidth()
    }

    /// Returns the lane type (Driving, Sidewalk, Shoulder, etc.).
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.lane_type](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.lane_type)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.lane_type](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.lane_type)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.lane_type](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.lane_type)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn type_(&self) -> LaneType {
        self.inner.GetType()
    }

    /// Returns waypoints at a specified distance in the forward direction.
    ///
    /// Returns all possible waypoints at the given distance (e.g., branching at junctions).
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.next](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.next)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.next](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.next)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.next](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.next)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    ///
    /// # Arguments
    /// * `distance` - Distance in meters to the next waypoint(s)
    pub fn next(&self, distance: f64) -> crate::Result<WaypointList> {
        let ptr = with_ffi_error("next", |e| self.inner.GetNext(distance, e))?;
        Ok(unsafe { WaypointList::from_cxx(ptr).unwrap_unchecked() })
    }

    /// Returns waypoints at a specified distance in the backward direction.
    ///
    /// Returns all possible waypoints at the given distance (e.g., branching at junctions).
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.previous](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.previous)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.previous](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.previous)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.previous](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.previous)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    ///
    /// # Arguments
    /// * `distance` - Distance in meters to the previous waypoint(s)
    pub fn previous(&self, distance: f64) -> crate::Result<WaypointList> {
        let ptr = with_ffi_error("previous", |e| self.inner.GetPrevious(distance, e))?;
        Ok(unsafe { WaypointList::from_cxx(ptr).unwrap_unchecked() })
    }

    /// Returns waypoints at a specified distance ahead until reaching the end of the lane.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.next_until_lane_end](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.next_until_lane_end)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.next_until_lane_end](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.next_until_lane_end)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.next_until_lane_end](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.next_until_lane_end)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    ///
    /// # Arguments
    /// * `distance` - Distance between waypoints in meters
    pub fn next_until_lane_end(&self, distance: f64) -> crate::Result<WaypointList> {
        let ptr = with_ffi_error("next_until_lane_end", |e| {
            self.inner.GetNextUntilLaneEnd(distance, e)
        })?;
        Ok(unsafe { WaypointList::from_cxx(ptr).unwrap_unchecked() })
    }

    /// Returns waypoints at a specified distance backward until reaching the start of the lane.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.previous_until_lane_start](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.previous_until_lane_start)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.previous_until_lane_start](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.previous_until_lane_start)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.previous_until_lane_start](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.previous_until_lane_start)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    ///
    /// # Arguments
    /// * `distance` - Distance between waypoints in meters
    pub fn previous_until_lane_start(&self, distance: f64) -> crate::Result<WaypointList> {
        let ptr = with_ffi_error("previous_until_lane_start", |e| {
            self.inner.GetPreviousUntilLaneStart(distance, e)
        })?;
        Ok(unsafe { WaypointList::from_cxx(ptr).unwrap_unchecked() })
    }

    /// Returns the waypoint to the left lane, if available.
    ///
    /// Checks if a lane change to the left is possible based on lane markings.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.get_left_lane](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.get_left_lane)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.get_left_lane](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.get_left_lane)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.get_left_lane](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.get_left_lane)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn left(&self) -> crate::Result<Option<Waypoint>> {
        let ptr = with_ffi_error("left", |e| self.inner.GetLeft(e))?;
        Ok(Self::from_cxx(ptr))
    }

    /// Returns the waypoint to the right lane, if available.
    ///
    /// Checks if a lane change to the right is possible based on lane markings.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.get_right_lane](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.get_right_lane)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.get_right_lane](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.get_right_lane)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.get_right_lane](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.get_right_lane)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn right(&self) -> crate::Result<Option<Waypoint>> {
        let ptr = with_ffi_error("right", |e| self.inner.GetRight(e))?;
        Ok(Self::from_cxx(ptr))
    }

    /// Returns the lane marking on the right side of the lane.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.right_lane_marking](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.right_lane_marking)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.right_lane_marking](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.right_lane_marking)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.right_lane_marking](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.right_lane_marking)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn right_lane_marking(&self) -> crate::Result<Option<LaneMarking>> {
        let ptr = with_ffi_error("right_lane_marking", |e| self.inner.GetRightLaneMarking(e))?;
        Ok(LaneMarking::from_cxx(ptr))
    }

    /// Returns the lane marking on the left side of the lane.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.left_lane_marking](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.left_lane_marking)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.left_lane_marking](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.left_lane_marking)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.left_lane_marking](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.left_lane_marking)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn left_lane_marking(&self) -> crate::Result<Option<LaneMarking>> {
        let ptr = with_ffi_error("left_lane_marking", |e| self.inner.GetLeftLaneMarking(e))?;
        Ok(LaneMarking::from_cxx(ptr))
    }

    /// Returns the lane change permission for this waypoint.
    ///
    /// Indicates which lane changes are allowed (left, right, both, or none).
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.lane_change](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.lane_change)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.lane_change](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.lane_change)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.lane_change](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.lane_change)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    pub fn lane_change(&self) -> LaneMarking_LaneChange {
        self.inner.GetLaneChange()
    }

    /// Returns all landmarks within a specified distance from this waypoint.
    ///
    /// # Arguments
    /// * `distance` - Maximum search distance in meters
    /// * `stop_at_junction` - If true, stops searching when reaching a junction
    ///
    /// # Returns
    /// A list of landmarks (traffic signs, speed limits, etc.) within the specified distance.
    pub fn all_landmarks_in_distance(
        &self,
        distance: f64,
        stop_at_junction: bool,
    ) -> crate::Result<LandmarkList> {
        let ptr = with_ffi_error("all_landmarks_in_distance", |e| {
            self.inner
                .GetAllLandmarksInDistance(distance, stop_at_junction, e)
        })?;
        Ok(unsafe { LandmarkList::from_cxx(ptr).unwrap_unchecked() })
    }

    /// Returns landmarks of a specific type within a specified distance.
    ///
    /// # Arguments
    /// * `distance` - Maximum search distance in meters
    /// * `filter_type` - Landmark type to filter (e.g., "1000001" for speed limits)
    /// * `stop_at_junction` - If true, stops searching when reaching a junction
    ///
    /// # Returns
    /// A list of landmarks matching the specified type within the distance.
    pub fn landmarks_of_type_in_distance(
        &self,
        distance: f64,
        filter_type: &str,
        stop_at_junction: bool,
    ) -> crate::Result<LandmarkList> {
        let ptr = with_ffi_error("landmarks_of_type_in_distance", |e| {
            self.inner
                .GetLandmarksOfTypeInDistance(distance, filter_type, stop_at_junction, e)
        })?;
        Ok(unsafe { LandmarkList::from_cxx(ptr).unwrap_unchecked() })
    }

    /// Python-compatible alias for `all_landmarks_in_distance()`.
    ///
    /// Returns all landmarks from the current waypoint until the specified distance.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.get_landmarks](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.get_landmarks)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.get_landmarks](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.get_landmarks)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.get_landmarks](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.get_landmarks)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    ///
    /// # Arguments
    /// * `distance` - Maximum search distance in meters
    /// * `stop_at_junction` - If true, stops searching at junctions
    #[inline]
    pub fn get_landmarks(
        &self,
        distance: f64,
        stop_at_junction: bool,
    ) -> crate::Result<LandmarkList> {
        self.all_landmarks_in_distance(distance, stop_at_junction)
    }

    /// Python-compatible alias for `landmarks_of_type_in_distance()`.
    ///
    /// Returns landmarks of a specific type from the current waypoint until the specified distance.
    #[cfg_attr(
        carla_version_0916,
        doc = " See [carla.Waypoint.get_landmarks_of_type](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.Waypoint.get_landmarks_of_type)"
    )]
    #[cfg_attr(
        carla_version_0915,
        doc = " See [carla.Waypoint.get_landmarks_of_type](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.Waypoint.get_landmarks_of_type)"
    )]
    #[cfg_attr(
        carla_version_0914,
        doc = " See [carla.Waypoint.get_landmarks_of_type](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.Waypoint.get_landmarks_of_type)"
    )]
    #[cfg_attr(
        any(carla_version_0916, carla_version_0915, carla_version_0914),
        doc = " in the Python API."
    )]
    ///
    /// # Arguments
    /// * `distance` - Maximum search distance in meters
    /// * `type_` - Landmark type to filter (e.g., "1000001" for speed limits)
    /// * `stop_at_junction` - If true, stops searching at junctions
    #[inline]
    pub fn get_landmarks_of_type(
        &self,
        distance: f64,
        type_: &str,
        stop_at_junction: bool,
    ) -> crate::Result<LandmarkList> {
        self.landmarks_of_type_in_distance(distance, type_, stop_at_junction)
    }

    pub(crate) fn from_cxx(ptr: SharedPtr<FfiWaypoint>) -> Option<Self> {
        if ptr.is_null() {
            None
        } else {
            Some(Self { inner: ptr })
        }
    }
}

assert_impl_all!(Waypoint: Send, Sync);