Skip to content

Commit

Permalink
Merge pull request #1 from tier4/feature/nodelet
Browse files Browse the repository at this point in the history
Feature/nodelet
  • Loading branch information
0x126 authored Mar 25, 2021
2 parents 565aef9 + 7cdebc8 commit f9fa995
Show file tree
Hide file tree
Showing 68 changed files with 2,405 additions and 4,151 deletions.
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

118 changes: 0 additions & 118 deletions CMakeLists.txt

This file was deleted.

41 changes: 0 additions & 41 deletions config/correction.csv

This file was deleted.

29 changes: 0 additions & 29 deletions launch/hesai_lidar.launch

This file was deleted.

22 changes: 0 additions & 22 deletions package.xml

This file was deleted.

93 changes: 93 additions & 0 deletions pandar_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
cmake_minimum_required(VERSION 3.0.2)
project(pandar_driver)

add_compile_options(-std=c++14)


find_package(catkin REQUIRED COMPONENTS
roscpp
roslib
nodelet
pluginlib
pandar_msgs
)

catkin_package(
INCLUDE_DIRS
include
CATKIN_DEPENDS
pandar_msgs
LIBRARIES
pandar_input
)

include_directories(
include
${catkin_INCLUDE_DIRS}
)

# Target
add_library(pandar_input
src/lib/socket_input.cpp
src/lib/pcap_input.cpp
)
target_link_libraries(pandar_input
pcap
${catkin_LIBRARIES}
)

## add node
add_executable(pandar_driver_node
src/driver/node.cpp
src/driver/pandar_driver.cpp
)

target_link_libraries(pandar_driver_node
pandar_input
${catkin_LIBRARIES}
)

## add nodelet
add_library(pandar_driver_nodelet
src/driver/nodelet.cpp
src/driver/pandar_driver.cpp
)

target_link_libraries(pandar_driver_nodelet
pandar_input
${catkin_LIBRARIES}
)


# Install
## executables and libraries
install(
TARGETS
pandar_driver_node
pandar_driver_nodelet
pandar_input
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

## files
install(
FILES
nodelet_pandar_driver.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

## project namespaced headers
install(
DIRECTORY
include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

## directories
install(
DIRECTORY
launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
12 changes: 12 additions & 0 deletions pandar_driver/include/pandar_driver/input.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once
#include <pandar_msgs/PandarPacket.h>

namespace pandar_driver
{
class Input
{
public:
virtual ~Input(){};
virtual int getPacket(pandar_msgs::PandarPacket* pkt) = 0;
};
} // namespace pandar_driver
31 changes: 31 additions & 0 deletions pandar_driver/include/pandar_driver/pandar_driver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include <ros/ros.h>

namespace pandar_driver
{
class Input;
class PandarDriver
{
public:
PandarDriver(ros::NodeHandle node, ros::NodeHandle private_nh);
~PandarDriver(){};
bool poll(void);

private:
std::string device_ip_;
int lidar_port_;
int gps_port_;
double scan_phase_;
size_t azimuth_index_;

std::string model_;
std::string frame_id_;
std::string pcap_path_;

ros::Publisher pandar_packet_pub_;
std::shared_ptr<Input> input_;

std::function<bool(size_t)> is_valid_packet_;
};
} // namespace pandar_driver
Loading

0 comments on commit f9fa995

Please sign in to comment.