Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
d862a5e0
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d862a5e0
编写于
6月 06, 2018
作者:
L
Liangliang Zhang
提交者:
Jiangtao Hu
6月 06, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Driver: added check angle function in velodyne driver.
上级
3beb41eb
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
57 addition
and
36 deletion
+57
-36
modules/drivers/velodyne/velodyne_driver/CMakeLists.txt
modules/drivers/velodyne/velodyne_driver/CMakeLists.txt
+1
-1
modules/drivers/velodyne/velodyne_driver/src/driver/CMakeLists.txt
...rivers/velodyne/velodyne_driver/src/driver/CMakeLists.txt
+8
-6
modules/drivers/velodyne/velodyne_driver/src/driver/driver.cpp
...es/drivers/velodyne/velodyne_driver/src/driver/driver.cpp
+21
-2
modules/drivers/velodyne/velodyne_driver/src/driver/driver.h
modules/drivers/velodyne/velodyne_driver/src/driver/driver.h
+21
-16
modules/drivers/velodyne/velodyne_driver/src/driver/driver32.cpp
.../drivers/velodyne/velodyne_driver/src/driver/driver32.cpp
+5
-8
modules/drivers/velodyne/velodyne_driver/src/driver/driver64.cpp
.../drivers/velodyne/velodyne_driver/src/driver/driver64.cpp
+1
-3
未找到文件。
modules/drivers/velodyne/velodyne_driver/CMakeLists.txt
浏览文件 @
d862a5e0
modules/drivers/velodyne/velodyne_driver/src/driver/CMakeLists.txt
浏览文件 @
d862a5e0
...
...
@@ -12,14 +12,16 @@ target_link_libraries(driver_node
)
# build the nodelet version
add_library
(
driver_nodelet
add_library
(
driver_nodelet
driver_nodelet.cpp
driver.cpp
driver16.cpp
driver32.cpp
driver64.cpp
)
target_link_libraries
(
driver_nodelet
target_link_libraries
(
driver_nodelet
velodyne_input
${
catkin_LIBRARIES
}
)
...
...
modules/drivers/velodyne/velodyne_driver/src/driver/driver.cpp
浏览文件 @
d862a5e0
...
...
@@ -16,11 +16,12 @@
#include "driver.h"
#include <ros/ros.h>
#include <time.h>
#include <cmath>
#include <ctime>
#include <string>
#include <ros/ros.h>
namespace
apollo
{
namespace
drivers
{
namespace
velodyne
{
...
...
@@ -106,6 +107,24 @@ void VelodyneDriver::update_gps_top_hour(uint32_t current_time) {
last_gps_time_
=
current_time
;
}
bool
VelodyneDriver
::
check_angle
(
velodyne_msgs
::
VelodynePacket
&
packet
)
{
// check the angel in every packet
// for each model of velodyne 64 the data struct is same ,
// so we don't need to check the lidar model
const
unsigned
char
*
raw_ptr
=
(
const
unsigned
char
*
)
&
packet
.
data
[
0
];
for
(
int
i
=
0
;
i
<
BLOCKS_PER_PACKET
;
++
i
)
{
uint16_t
angle
=
raw_ptr
[
i
*
BLOCK_SIZE
+
3
]
*
256
+
raw_ptr
[
i
*
BLOCK_SIZE
+
2
];
// for the velodyne64 angle resolution is 0.17~0.2 , so take the angle diff
// at 0.2~0.3 should be a good choice
if
(
angle
>
config_
.
prefix_angle
&&
std
::
abs
(
angle
-
config_
.
prefix_angle
)
<
30
)
{
return
true
;
}
}
return
false
;
}
VelodyneDriver
*
VelodyneDriverFactory
::
create_driver
(
ros
::
NodeHandle
private_nh
)
{
Config
config
;
...
...
modules/drivers/velodyne/velodyne_driver/src/driver/driver.h
浏览文件 @
d862a5e0
...
...
@@ -14,8 +14,8 @@
* limitations under the License.
*****************************************************************************/
#ifndef VELODYNE_DRIVER_H
#define VELODYNE_DRIVER_H
#ifndef VELODYNE_DRIVER_H
_
#define VELODYNE_DRIVER_H
_
#include <ros/ros.h>
#include <string>
...
...
@@ -27,17 +27,19 @@ namespace apollo {
namespace
drivers
{
namespace
velodyne
{
constexpr
int
BLOCKS_PER_PACKET
=
12
;
constexpr
int
BLOCK_SIZE
=
100
;
// configuration parameters
struct
Config
{
Config
()
:
npackets
(
0
),
rpm
(
0.0
),
firing_data_port
(
0
),
positioning_data_port
(
0
)
{}
std
::
string
frame_id
;
///< tf frame ID
std
::
string
model
;
///< device model name
std
::
string
topic
;
int
npackets
;
///< number of packets to collect
double
rpm
;
///< device rotation rate (RPMs)
int
firing_data_port
;
int
positioning_data_port
;
int
npackets
=
0
;
///< number of packets to collect
double
rpm
=
0.0
;
///< device rotation rate (RPMs)
int
firing_data_port
=
0
;
int
positioning_data_port
=
0
;
int
prefix_angle
=
0
;
// prefix angle to recv
};
class
VelodyneDriver
{
...
...
@@ -61,6 +63,8 @@ class VelodyneDriver {
void
set_base_time_from_nmea_time
(
NMEATimePtr
nmea_time
,
uint64_t
&
basetime
);
void
update_gps_top_hour
(
unsigned
int
current_time
);
bool
check_angle
(
velodyne_msgs
::
VelodynePacket
&
packet
);
};
class
Velodyne64Driver
:
public
VelodyneDriver
{
...
...
@@ -75,13 +79,14 @@ class Velodyne64Driver : public VelodyneDriver {
};
class
Velodyne32Driver
:
public
VelodyneDriver
{
public:
public:
explicit
Velodyne32Driver
(
const
Config
&
config
);
virtual
~
Velodyne32Driver
()
{}
void
init
(
ros
::
NodeHandle
&
node
);
bool
poll
(
void
);
void
poll_positioning_packet
();
private:
private:
std
::
shared_ptr
<
Input
>
positioning_input_
;
};
...
...
@@ -107,4 +112,4 @@ class VelodyneDriverFactory {
}
// namespace drivers
}
// namespace apollo
#endif // VELODYNE_DRIVER_H_
_
#endif // VELODYNE_DRIVER_H_
modules/drivers/velodyne/velodyne_driver/src/driver/driver32.cpp
浏览文件 @
d862a5e0
...
...
@@ -15,26 +15,23 @@
*****************************************************************************/
#include "driver.h"
#include <ros/ros.h>
#include <tf/transform_listener.h>
#include <time.h>
#include <unistd.h>
#include <cmath>
#include <string>
#include <thread>
#include <ros/ros.h>
#include <tf/transform_listener.h>
namespace
apollo
{
namespace
drivers
{
namespace
velodyne
{
Velodyne32Driver
::
Velodyne32Driver
(
const
Config
&
config
)
{
config_
=
config
;
}
Velodyne32Driver
::
Velodyne32Driver
(
const
Config
&
config
)
{
config_
=
config
;
}
void
Velodyne32Driver
::
init
(
ros
::
NodeHandle
&
node
)
{
double
packet_rate
=
0.0
;
// packet frequency (Hz)
packet_rate
=
1808.0
;
double
packet_rate
=
1808.0
;
// packet frequency (Hz)
double
frequency
=
(
config_
.
rpm
/
60.0
);
// expected Hz rate
// default number of packets for each scan is a single revolution
...
...
modules/drivers/velodyne/velodyne_driver/src/driver/driver64.cpp
浏览文件 @
d862a5e0
...
...
@@ -25,9 +25,7 @@ namespace apollo {
namespace
drivers
{
namespace
velodyne
{
Velodyne64Driver
::
Velodyne64Driver
(
const
Config
&
config
)
{
config_
=
config
;
}
Velodyne64Driver
::
Velodyne64Driver
(
const
Config
&
config
)
{
config_
=
config
;
}
void
Velodyne64Driver
::
init
(
ros
::
NodeHandle
&
node
)
{
double
packet_rate
=
0
;
// packet frequency (Hz)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录