apollo planning module c++

本文介绍了Planning模块中的关键部分,包括如何使用`std::make_shared`和`std::make_unique`创建智能指针,并强调了`override`关键字的作用。此外,还探讨了枚举常量和元组的使用。重点在于C++编程中继承和类型转换的实践应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

仅为个人记录学习用
Planning模块的主入口为:/apollo/cyber/mainboard/http://mainboard.cc

using

https://blog.youkuaiyun.com/shift_wwx/article/details/78742459

override

1.可以当注释用,方便阅读.
2.告诉阅读你代码的人,这是方法的复写.
3.编译器可以给你验证 override 对应的方法名是否是你父类中所有的,如果没有则报错.

std::make_shared // make_unique

智能指针指向<>内的数据类型

injector_ = std::make_shared<DependencyInjector>();
planning_base_ = std::make_unique<NaviPlanning>(injector_);

区别:shared_ptr 和 unique_ptr 都提供了一种机制保证指针的释放,区别在于,shared_ptr所管理的对象可以多个shared_ptr共享管理权,当最后一个shared_ptr释放管理权的时候,对资源进行析构。unique_ptr保证一时刻,只有一个唯一有效的unique_ptr保持对资源的管理权。

explicit关键字

类中的构造函数如果只含有一个参数,默认情况下存在一种隐式转换,即定义了转换为此类类型的隐式转换机制。然而,这种机制并非总是合理的,甚至容易产生错误,因此,新标准增加了explicit关键字,用来限制隐式转换

static_cast

static_cast是一个强制类型转换操作符。强制类型转换,也称为显式转换,C++中强制类型转换操作符有static_cast、dynamic_cast、const_cast、reinterpert_cast四个。

enum

enum fruit_set {apple, orange, banana=1, peach, grape}
//枚举常量apple=0,orange=1, banana=1,peach=2,grape=3。

std::get(info)

提取元组中的成员,也可以进行赋值操作

### Apollo Planning Module Information #### Overview of the Planning Module The Apollo planning module is a critical component within the autonomous driving system that handles trajectory generation and decision-making based on perception inputs. This module broadcasts `ADCTrajectory` messages to the control module via `/apollo/planning`, sends routing requests through `/apollo/routing_request`, and transmits machine learning data over `/apollo/planning/learning_data`. The primary function involves processing sensor input from other modules like perception, prediction, and traffic light detection before generating optimal paths for safe navigation [^1]. #### Key Components and Workflow In terms of architecture, key files such as `planning_component.h` and `planning_component.cc` define how this process works internally by implementing algorithms responsible for pathfinding under various conditions [^2]. A detailed examination reveals an intricate pipeline where multiple stages interact sequentially: - **Perception Input Processing**: Handling raw sensory data. - **Trajectory Generation & Optimization**: Creating feasible routes considering dynamic obstacles. - **Communication with Other Modules**: Sharing computed results efficiently. This workflow ensures seamless integration between different parts while maintaining high performance standards required in real-world applications [^3]. #### Trajectory Stitching Techniques An essential aspect covered extensively concerns methods used during each frame's initialization phase when determining starting points (`p_0`) accurately. Two main strategies exist here—replanning using instantaneous vehicle status or interpolating past trajectories—to ensure continuity across successive frames without abrupt changes affecting stability negatively [^4]: ```python def get_start_point(current_state, previous_trajectory=None): if not previous_trajectory: # Replan method start_point = calculate_future_position(current_state, time_offset=0.1) else: # Interpolation method matching_index = find_closest_match(previous_trajectory, current_time_stamp=current_state.timestamp) future_index = min(matching_index + int(0.1 * frequency), len(previous_trajectory)-1) start_point = previous_trajectory[future_index] return start_point ``` --related questions-- 1. How does the perception input influence the final output generated by the planning module? 2. What specific challenges arise due to complex urban environments impacting route optimization processes? 3. Can you elaborate more on the technical details behind replanning versus interpolation techniques mentioned above? 4. Are there any particular constraints considered during trajectory stitching operations? 5. In what ways has the evolution of Apollo versions impacted improvements seen specifically within its planning capabilities?
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值