Initial commit

This commit is contained in:
2026-07-27 13:51:19 +08:00
commit 7bec56ca51
5408 changed files with 1126933 additions and 0 deletions
@@ -0,0 +1,17 @@
## Diagnostic aggregator parameters for testing Velodyne diagnostics.
#
# $ rosparam load $(rospack find velodyne_driver)/tests/diagnostic_agg.yaml
# $ rosrun diagnostic_aggregator aggregator_node
#
diagnostic_aggregator:
analyzers:
sensors:
type: diagnostic_aggregator/AnalyzerGroup
path: Sensors
analyzers:
velodyne:
type: diagnostic_aggregator/GenericAnalyzer
path: Velodyne HDL
timeout: 5.0
find_and_remove_prefix: velodyne_nodelet_manager
num_items: 1
@@ -0,0 +1,30 @@
<!-- -*- mode: XML -*- -->
<!-- rostest of reading Velodyne 32E PCAP data -->
<launch>
<!-- start read with example PCAP file -->
<node pkg="velodyne_driver" type="velodyne_node" name="velodyne_node">
<param name="model" value="32E"/>
<param name="pcap" value="$(find velodyne_driver)/tests/32e.pcap"/>
</node>
<test test-name="pcap_32e_node_hertz_test" pkg="rostest"
type="hztest" name="hztest_packets_node_32e" >
<param name="hz" value="10.0" />
<param name="hzerror" value="3.0" />
<param name="test_duration" value="5.0" />
<param name="topic" value="velodyne_packets" />
<param name="wait_time" value="2.0" />
</test>
<test test-name="node_diagnostics_test"
pkg="rostest" type="hztest" name="hztest_diag_node_32e">
<param name="hz" value="1.0" />
<param name="hzerror" value="0.5" />
<param name="test_duration" value="5.0" />
<param name="topic" value="diagnostics" />
<param name="wait_time" value="2.0" />
</test>
</launch>
@@ -0,0 +1,31 @@
<!-- -*- mode: XML -*- -->
<!-- rostest of publishing a PointCloud from 32E PCAP data. -->
<launch>
<!-- start nodelet manager, driver and pointcloud nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="model" value="32E"/>
<arg name="pcap" value="$(find velodyne_driver)/tests/32e.pcap"/>
</include>
<!-- verify PointCloud publication rate -->
<test test-name="pcap_32e_nodelet_hertz_test" pkg="rostest"
type="hztest" name="hztest_packets_nodelet_32e" >
<param name="hz" value="10.0" />
<param name="hzerror" value="3.0" />
<param name="test_duration" value="5.0" />
<param name="topic" value="velodyne_packets" />
<param name="wait_time" value="2.0" />
</test>
<test test-name="nodelet_diagnostics_test"
pkg="rostest" type="hztest" name="hztest_diag_nodelet_32e" >
<param name="hz" value="1.0" />
<param name="hzerror" value="0.5" />
<param name="test_duration" value="5.0" />
<param name="topic" value="diagnostics" />
<param name="wait_time" value="2.0" />
</test>
</launch>
@@ -0,0 +1,29 @@
<!-- -*- mode: XML -*- -->
<!-- rostest of reading Velodyne 64E PCAP files -->
<launch>
<!-- start read with example PCAP file -->
<node pkg="velodyne_driver" type="velodyne_node" name="velodyne_node">
<param name="pcap" value="$(find velodyne_driver)/tests/class.pcap"/>
</node>
<test test-name="pcap_node_hertz_test" pkg="rostest"
type="hztest" name="hztest_packets_node_64e" >
<param name="hz" value="10.0" />
<param name="hzerror" value="3.0" />
<param name="test_duration" value="5.0" />
<param name="topic" value="velodyne_packets" />
<param name="wait_time" value="2.0" />
</test>
<test test-name="node_diagnostics_test"
pkg="rostest" type="hztest" name="hztest_diag_node_64e">
<param name="hz" value="1.0" />
<param name="hzerror" value="0.5" />
<param name="test_duration" value="5.0" />
<param name="topic" value="diagnostics" />
<param name="wait_time" value="2.0" />
</test>
</launch>
@@ -0,0 +1,30 @@
<!-- -*- mode: XML -*- -->
<!-- rostest of publishing a PointCloud from 64E PCAP data. -->
<launch>
<!-- start nodelet manager, driver and pointcloud nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="pcap" value="$(find velodyne_driver)/tests/class.pcap"/>
</include>
<!-- verify PointCloud publication rate -->
<test test-name="pcap_nodelet_hertz_test" pkg="rostest"
type="hztest" name="hztest_packets_nodelet_64e" >
<param name="hz" value="10.0" />
<param name="hzerror" value="3.0" />
<param name="test_duration" value="5.0" />
<param name="topic" value="velodyne_packets" />
<param name="wait_time" value="2.0" />
</test>
<test test-name="nodelet_diagnostics_test"
pkg="rostest" type="hztest" name="hztest_diag_nodelet_64e" >
<param name="hz" value="1.0" />
<param name="hzerror" value="0.5" />
<param name="test_duration" value="5.0" />
<param name="topic" value="diagnostics" />
<param name="wait_time" value="2.0" />
</test>
</launch>
@@ -0,0 +1,30 @@
<!-- -*- mode: XML -*- -->
<!-- rostest of reading Velodyne VLP16 PCAP data -->
<launch>
<!-- start read with example PCAP file -->
<node pkg="velodyne_driver" type="velodyne_node" name="velodyne_node">
<param name="model" value="VLP16"/>
<param name="pcap" value="$(find velodyne_driver)/tests/vlp16.pcap"/>
</node>
<test test-name="pcap_vlp16_node_hertz_test" pkg="rostest"
type="hztest" name="hztest_packets_node_vlp16" >
<param name="hz" value="10.0" />
<param name="hzerror" value="3.0" />
<param name="test_duration" value="5.0" />
<param name="topic" value="velodyne_packets" />
<param name="wait_time" value="2.0" />
</test>
<test test-name="node_diagnostics_test"
pkg="rostest" type="hztest" name="hztest_diag_node_vlp16">
<param name="hz" value="1.0" />
<param name="hzerror" value="0.5" />
<param name="test_duration" value="5.0" />
<param name="topic" value="diagnostics" />
<param name="wait_time" value="2.0" />
</test>
</launch>
@@ -0,0 +1,31 @@
<!-- -*- mode: XML -*- -->
<!-- rostest of publishing a PointCloud from VLP16 PCAP data. -->
<launch>
<!-- start nodelet manager, driver and pointcloud nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="model" value="VLP16"/>
<arg name="pcap" value="$(find velodyne_driver)/tests/vlp16.pcap"/>
</include>
<!-- verify PointCloud publication rate -->
<test test-name="pcap_vlp16_nodelet_hertz_test" pkg="rostest"
type="hztest" name="hztest_packets_nodelet_vlp16" >
<param name="hz" value="10.0" />
<param name="hzerror" value="3.0" />
<param name="test_duration" value="5.0" />
<param name="topic" value="velodyne_packets" />
<param name="wait_time" value="2.0" />
</test>
<test test-name="nodelet_diagnostics_test"
pkg="rostest" type="hztest" name="hztest_diag_nodelet_vlp16" >
<param name="hz" value="1.0" />
<param name="hzerror" value="0.5" />
<param name="test_duration" value="5.0" />
<param name="topic" value="diagnostics" />
<param name="wait_time" value="2.0" />
</test>
</launch>
@@ -0,0 +1,63 @@
// Copyright (C) 2019 Matthew Pitropov, Joshua Whitley
// All rights reserved.
//
// Software License Agreement (BSD License 2.0)
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of {copyright_holder} nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "velodyne_driver/time_conversion.hpp"
#include <ros/time.h>
#include <gtest/gtest.h>
TEST(TimeConversion, BytesToTimestamp)
{
ros::Time::init();
ros::Time ros_stamp = ros::Time::now();
// get the seconds past the hour and multiply by 1million to convert to microseconds
// divide nanoseconds by 1000 to convert to microseconds
uint32_t since_the_hour = ((ros_stamp.sec % 3600) * 1000000) + ros_stamp.nsec / 1000;
uint8_t native_format[4];
native_format[0] = 0xFF & since_the_hour;
native_format[1] = 0xFF & (((uint32_t)since_the_hour) >> 8);
native_format[2] = 0xFF & (((uint32_t)since_the_hour) >> 16);
native_format[3] = 0xFF & (((uint32_t)since_the_hour) >> 24);
ros::Time ros_stamp_converted = rosTimeFromGpsTimestamp(native_format);
ASSERT_EQ(ros_stamp_converted.sec, ros_stamp.sec);
ASSERT_NEAR(ros_stamp_converted.nsec, ros_stamp.nsec, 1000);
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}