Skip to content

Commit

Permalink
Robot: Code clean. (#7655)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxq authored and ycool committed Apr 4, 2019
1 parent d4189ba commit 606690c
Show file tree
Hide file tree
Showing 47 changed files with 152 additions and 152 deletions.
8 changes: 4 additions & 4 deletions modules/canbus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ The major components in canbus module are:

* **CAN Client** - CAN client has been moved to `/modules/drivers/canbus` since it is shared by different sensors utilizing the canbus protocol

You can implement your own CAN client in the folder `can_client` by inheriting from the `CanClient` class.
You can implement your own CAN client in the folder `can_client` by inheriting from the `CanClient` class.

```
Note:
Do not forget to register your CAN client in `CanClientFactory`.
```

You can also implement your own vehicle controller and message manager in the folder `vehicle` by inheriting from `VehicleController` and `MessageManager`.
You can also implement your own vehicle controller and message manager in the folder `vehicle` by inheriting from `VehicleController` and `MessageManager`.

```
Note:
Do not forget to register your vehicle in `VehicleFactory`.
Expand Down
4 changes: 2 additions & 2 deletions modules/dreamview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Dreamview

## Introduction
Dreamview or Apollo's HMI module provides a web application that helps developers visualize the output of other relevant autonomous driving modules, e.g. the vehicle's planning trajectory, car localization, chassis status etc.
Dreamview or Apollo's HMI module provides a web application that helps developers visualize the output of other relevant autonomous driving modules, e.g. the vehicle's planning trajectory, car localization, chassis status etc.

## Input
Currently Dreamview monitors the following messages:
Expand All @@ -13,7 +13,7 @@ Dreamview or Apollo's HMI module provides a web application that helps developer
* Perception Obstacles, defined by Protobuf message `PerceptionObstacles`, which can be found in file `perception/proto/perception_obstacle.proto`.
* Prediction, defined by Protobuf message `PredictionObstacles`, which can be found in file `prediction/proto/prediction_obstacle.proto`.
* Routing, defined by Protobuf message `RoutingResponse`, which can be found in file `routing/proto/routing.proto`.

## Output
A web-based dynamic 3D rendering of the monitored messages in a simulated world.

Expand Down
6 changes: 3 additions & 3 deletions modules/localization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
In the provided RTK localization method, there are two inputs:
- GPS - The Global Positioning System
- IMU - Inertial Measurement Unit

In the multi-sensor fusion localization method, there are three inputs:
- GPS - The Global Positioning System
- IMU - Inertial Measurement Unit
Expand All @@ -20,7 +20,7 @@
Guowei Wan, Xiaolong Yang, Renlan Cai, Hao Li, Yao Zhou, Hao Wang, Shiyu Song. "Robust and Precise Vehicle Localization Based on Multi-Sensor Fusion in Diverse City Scenes," 2018 IEEE International Conference on Robotics and Automation (ICRA), Brisbane, QLD, 2018, pp. 4670-4677.
doi: 10.1109/ICRA.2018.8461224. [link](https://ieeexplore.ieee.org/document/8461224)

## Output
## Output
An object instance defined by Protobuf message `LocalizationEstimate`, which can be found in file `localization/proto/localization.proto`.

## Implementing Localization
Expand All @@ -35,7 +35,7 @@ An object instance defined by Protobuf message `LocalizationEstimate`, which can
```
localization_factory_.Register(LocalizationConfig::FOO, []()->LocalizationBase* { return new FooLocalization(); });
```

4. Make sure your code compiles by including the header files that defines class `FooLocalization`

1. Now you can go back to the `apollo` root directory and build your code with command `bash apollo.sh build`
2 changes: 1 addition & 1 deletion modules/localization/README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
1.`proto/localization_config.proto``LocalizationType enum type`中添加Foo。

1. 转到`modules/localization`目录,并创建一个Foo目录。在Foo目录中,根据rtk目录中的`RTKLocalization`类增加`FooLocalization`类。`FooLocalization`必须是`LocalizationBase`的子类。根据`rtk/BUILD`还需创建文件`foo/BUILD`

1. 您需要在函数`Localization::RegisterLocalizationMethods()`中注册`FooLocalization`,它位于CPP文件`localization.cc`中。您可以通过在函数的末尾插入以下代码来注册:
```
localization_factory_.Register(LocalizationConfig::FOO, []()->LocalizationBase* { return new FooLocalization(); });
Expand Down
2 changes: 1 addition & 1 deletion modules/localization/msf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
The goal of multi-sensor localization is to provide a robust method which can achieve high localization accuracy and resilience in challenging scenes, such as urban downtown, highways, and tunnels. It adaptively uses information from complementary sensors such as GNSS, LiDAR and IMU. If you want to know more details, please refer to our paper
*Guowei Wan, Xiaolong Yang, Renlan Cai, Hao Li, Yao Zhou, Hao Wang, Shiyu Song. "Robust and Precise Vehicle Localization Based on Multi-Sensor Fusion in Diverse City Scenes," 2018 IEEE International Conference on Robotics and Automation (ICRA), Brisbane, QLD, 2018, pp. 4670-4677.
doi: 10.1109/ICRA.2018.8461224.* [link](https://ieeexplore.ieee.org/document/8461224)


Currently this localization method only works for x86_64 platform

Expand Down
4 changes: 2 additions & 2 deletions modules/localization/msf/common/util/frame_transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool FrameTransform::LatlonToUtmXY(double lon_rad, double lat_rad,
}
double longitude = lon_rad;
double latitude = lat_rad;
pj_transform(pj_latlon, pj_utm, 1, 1, &longitude, &latitude, NULL);
pj_transform(pj_latlon, pj_utm, 1, 1, &longitude, &latitude, nullptr);
utm_xy->x = longitude;
utm_xy->y = latitude;
pj_free(pj_latlon);
Expand All @@ -61,7 +61,7 @@ bool FrameTransform::UtmXYToLatlon(double x, double y, int zone, bool southhemi,
if (!(pj_utm = pj_init_plus(utm_dst.str().c_str()))) {
return false;
}
pj_transform(pj_utm, pj_latlon, 1, 1, &x, &y, NULL);
pj_transform(pj_utm, pj_latlon, 1, 1, &x, &y, nullptr);
latlon->log = x;
latlon->lat = y;
pj_free(pj_latlon);
Expand Down
4 changes: 2 additions & 2 deletions modules/localization/msf/local_map/ndt_map/ndt_map_matrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void NdtMapCells::Reduce(NdtMapCells* cell, const NdtMapCells& cell_new) {
NdtMapMatrix::NdtMapMatrix() {
rows_ = 0;
cols_ = 0;
map3d_cells_ = NULL;
map3d_cells_ = nullptr;
}

NdtMapMatrix::~NdtMapMatrix() {
Expand Down Expand Up @@ -352,7 +352,7 @@ void NdtMapMatrix::Init(unsigned int rows, unsigned int cols) {
if (map3d_cells_) {
delete[] map3d_cells_;
}
map3d_cells_ = NULL;
map3d_cells_ = nullptr;
map3d_cells_ = new NdtMapCells[rows * cols];
rows_ = rows;
cols_ = cols;
Expand Down
2 changes: 1 addition & 1 deletion modules/localization/ndt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Localization result defined by Protobuf message `LocalizationEstimate`, which can be found in file `localization/proto/localization.proto`. ( `/apollo/localization/pose`)

### NDT Localization Setting
under some circumstance, we need to balance the speed and accuracy of the algorithm. So we expose some parameters of NDT matching process, It includes `online_resolution` for online pointcloud, `ndt_max_iterations` for iterative optimization of NDT matching, `ndt_target_resolution` for target resolution, `ndt_line_search_step_size` for searching step size of iteration and `ndt_transformation_epsilon` for convergence condition.
under some circumstance, we need to balance the speed and accuracy of the algorithm. So we expose some parameters of NDT matching process, It includes `online_resolution` for online pointcloud, `ndt_max_iterations` for iterative optimization of NDT matching, `ndt_target_resolution` for target resolution, `ndt_line_search_step_size` for searching step size of iteration and `ndt_transformation_epsilon` for convergence condition.

## Generate NDT Localization Map
NDT Localization map is used for NDT-based localization, which is a voxel-grid representation of the environment. Each cell stores the centroid and relative covariance of the points in the cell. The map is organized as a group of map nodes. For more information, please refer to `apollo/modules/localization/msf/local_map/ndt_map`.
Expand Down
2 changes: 1 addition & 1 deletion modules/localization/ndt/ndt_locator/lidar_locator_ndt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ void LidarLocatorNdt::ComposeMapCells(
if (map_nodes_zones[y * 3 + x][2] - map_nodes_zones[y * 3 + x][0] >= 0 &&
map_nodes_zones[y * 3 + x][3] - map_nodes_zones[y * 3 + x][1] >= 0) {
// get map node
NdtMapNode* map_node_ptr = NULL;
NdtMapNode* map_node_ptr = nullptr;
if (x == 0 && y == 0) {
map_node_ptr = map_node_lt;
} else {
Expand Down
2 changes: 1 addition & 1 deletion modules/localization/ndt/ndt_locator/ndt_solver_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ TEST_F(NdtSolverTestSuite, NdtSolver) {
for (auto itr = buf.begin(); itr != buf.end(); ++itr, ++index) {
msf::NdtMapNode* ndt_map_node =
static_cast<msf::NdtMapNode*>(ndt_map.GetMapNodeSafe(*itr));
if (ndt_map_node == NULL) {
if (ndt_map_node == nullptr) {
AERROR << "index: " << index << " is a NULL pointer!" << std::endl;
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class VoxelGridCovariance {
inline LeafConstPtr GetLeaf(int index) {
typename std::map<size_t, Leaf>::iterator leaf_iter = leaves_.find(index);
if (leaf_iter == leaves_.end()) {
return NULL;
return nullptr;
}
LeafConstPtr ret(&(leaf_iter->second));
return ret;
Expand Down Expand Up @@ -189,7 +189,7 @@ class VoxelGridCovariance {
// Find leaf associated with index
typename std::map<size_t, Leaf>::iterator leaf_iter = leaves_.find(idx);
if (leaf_iter == leaves_.end()) {
return NULL;
return nullptr;
}
// If such a leaf exists return the pointer to the leaf structure
LeafConstPtr ret(&(leaf_iter->second));
Expand All @@ -216,7 +216,7 @@ class VoxelGridCovariance {
// Find leaf associated with index
typename std::map<size_t, Leaf>::iterator leaf_iter = leaves_.find(idx);
if (leaf_iter == leaves_.end()) {
return NULL;
return nullptr;
}
// If such a leaf exists return the pointer to the leaf structure
LeafConstPtr ret(&(leaf_iter->second));
Expand Down
4 changes: 2 additions & 2 deletions modules/perception/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The perception module outputs are:
1. Set up the general settings in the configuration file `modules/perception/conf/perception_lowcost.conf`.
2. Run the command `./scripts/bootstrap.sh` to launch the web GUI.
3. Select the vehicle model in the web GUI.
4. Launch the perception module using the command `./scripts/perception_lowcost_vis.sh start` or by enabling the perception button on the *Module Controller* page of the web GUI. The command for stopping perception is `./scripts/perception_lowcost_vis.sh stop`. Note: please do not try to use GUI to enable perception but use script to stop it, vice versa.
4. Launch the perception module using the command `./scripts/perception_lowcost_vis.sh start` or by enabling the perception button on the *Module Controller* page of the web GUI. The command for stopping perception is `./scripts/perception_lowcost_vis.sh stop`. Note: please do not try to use GUI to enable perception but use script to stop it, vice versa.
5. Download the demo data from the Apollo [Open Data Platform](http://data.apollo.auto).

```
Expand All @@ -59,7 +59,7 @@ Note:

See [How to Run Perception Module on Your Local Computer](https://github.com/ApolloAuto/apollo/blob/master/docs/howto/how_to_run_perception_module_on_your_local_computer.md).

3. This module contains a redistribution in binary form of a modified version of [caffe](https://github.com/BVLC/caffe).
3. This module contains a redistribution in binary form of a modified version of [caffe](https://github.com/BVLC/caffe).
A copy of the caffe's original copyright statement is included below:

```
Expand Down
4 changes: 2 additions & 2 deletions modules/perception/camera/common/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ namespace camera {
class Timer {
public:
Timer() { Tic(); }
void Tic() { gettimeofday(&start_tv_, NULL); }
void Tic() { gettimeofday(&start_tv_, nullptr); }
uint64_t Toc() {
struct timeval end_tv;
gettimeofday(&end_tv, NULL);
gettimeofday(&end_tv, nullptr);
uint64_t elapsed = (end_tv.tv_sec - start_tv_.tv_sec) * 1000000 +
(end_tv.tv_usec - start_tv_.tv_usec);
Tic();
Expand Down
4 changes: 2 additions & 2 deletions modules/perception/camera/lib/lane/common/common_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool PolyFit(const std::vector<Eigen::Matrix<Dtype, 2, 1>>& pos_vec,
const int& order,
Eigen::Matrix<Dtype, max_poly_order + 1, 1>* coeff,
const bool& is_x_axis = true) {
if (coeff == NULL) {
if (coeff == nullptr) {
AERROR << "The coefficient pointer is NULL.";
return false;
}
Expand Down Expand Up @@ -110,7 +110,7 @@ template <typename Dtype>
bool RansacFitting(std::vector<Eigen::Matrix<Dtype, 2, 1>>* pos_vec,
Eigen::Matrix<Dtype, 4, 1>* coeff, const int max_iters = 100,
const int N = 5, Dtype inlier_thres = 0.1) {
if (coeff == NULL) {
if (coeff == nullptr) {
AERROR << "The coefficient pointer is NULL.";
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions modules/perception/camera/test/camera_common_undistortion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,19 @@ int ImageGpuPreprocessHandler::handle(uint8_t *src, uint8_t *dst) {
int ImageGpuPreprocessHandler::release(void) {
if (_d_mapy) {
BASE_CUDA_CHECK(cudaFree(_d_mapy));
_d_mapy = NULL;
_d_mapy = nullptr;
}
if (_d_mapx) {
BASE_CUDA_CHECK(cudaFree(_d_mapx));
_d_mapx = NULL;
_d_mapx = nullptr;
}
if (_d_dst) {
BASE_CUDA_CHECK(cudaFree(_d_dst));
_d_dst = NULL;
_d_dst = nullptr;
}
if (_d_rgb) {
BASE_CUDA_CHECK(cudaFree(_d_rgb));
_d_rgb = NULL;
_d_rgb = nullptr;
}
_inited = false;
return 0;
Expand Down
8 changes: 4 additions & 4 deletions modules/perception/camera/test/camera_common_undistortion.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class ImageGpuPreprocessHandler {
int *height, std::vector<double> *D,
std::vector<double> *K);

float *_d_mapx = NULL;
float *_d_mapy = NULL;
uint8_t *_d_rgb = NULL;
uint8_t *_d_dst = NULL;
float *_d_mapx = nullptr;
float *_d_mapy = nullptr;
uint8_t *_d_rgb = nullptr;
uint8_t *_d_dst = nullptr;

int _width = 0; // image cols
int _height = 0; // image rows
Expand Down
Loading

0 comments on commit 606690c

Please sign in to comment.