Skip to content

Commit

Permalink
Add git action to build package
Browse files Browse the repository at this point in the history
  • Loading branch information
raultapia committed Apr 5, 2024
1 parent 18b8464 commit 3048b92
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 19 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build ROS package

on:
push:
branches: [ main ]

jobs:
build-package:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: noetic
- run: |
sudo add-apt-repository ppa:inivation-ppa/inivation
sudo apt update
sudo apt install libcaer-dev
git clone https://github.com/raultapia/openev
mkdir -p openev/build
cd openev/build
cmake ..
make
sudo make install
- uses: ros-tooling/[email protected]
with:
package-name: asap
target-ros1-distro: noetic
vcs-repo-file-url: https://raw.githubusercontent.com/raultapia/asap/main/dependencies.yaml
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ add_service_files(FILES Configuration.srv)
add_service_files(FILES Roi.srv)
generate_messages(DEPENDENCIES sensor_msgs std_msgs)
generate_dynamic_reconfigure_options(config/parameters.cfg)
catkin_package(CATKIN_DEPENDS message_runtime sensor_msgs std_msgs)
catkin_package(CATKIN_DEPENDS dynamic_reconfigure message_runtime sensor_msgs std_msgs)

add_executable(asap src/asap_node.cpp src/configuration.cpp src/main_thread.cpp src/publishers.cpp src/services.cpp)
add_dependencies(asap asap_gencfg)
add_dependencies(asap ${asap_EXPORTED_TARGETS})
target_link_libraries(asap ${catkin_LIBRARIES})
target_link_libraries(asap ${OpenCV_LIBRARIES})
target_link_libraries(asap openev)
5 changes: 4 additions & 1 deletion config/parameters.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ from dynamic_reconfigure.parameter_generator_catkin import double_t
from dynamic_reconfigure.parameter_generator_catkin import int_t
from dynamic_reconfigure.parameter_generator_catkin import str_t

PACKAGE_NAME = "asap"
NODE_NAME = "asap"
PREFIX = "parameters"
INIT_YAML = os.path.realpath(__file__).replace('parameters.cfg', 'asap.yaml')

try:
Expand Down Expand Up @@ -35,4 +38,4 @@ else:
dvs.add("dvs_size", int_t, 0, "help", data['dvs']['size'], 1, 10000)
imu.add("imu_enabled", bool_t, 0, "help", data['imu']['enabled'])

exit(gen.generate("asap", "asap", "asap"))
exit(gen.generate(PACKAGE_NAME, NODE_NAME, PREFIX))
5 changes: 5 additions & 0 deletions dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repositories:
rpg_dvs_ros:
type: git
url: https://github.com/uzh-rpg/rpg_dvs_ros
version: master
26 changes: 11 additions & 15 deletions include/asap/asap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <asap/Configuration.h>
#include <asap/Feedback.h>
#include <asap/Roi.h>
#include <asap/asapConfig.h>
#include <asap/parametersConfig.h>
#include <cv_bridge/cv_bridge.h>
#include <dvs_msgs/EventArray.h>
#include <dynamic_reconfigure/server.h>
Expand All @@ -28,6 +28,7 @@ constexpr size_t EVENT_RATE_QUEUE_MAX_SIZE = 500;
constexpr size_t DVS_BUFFER_WARNING_SIZE = 1e8;
constexpr size_t APS_BUFFER_WARNING_SIZE = 50;
constexpr size_t IMU_BUFFER_WARNING_SIZE = 300;
constexpr int THREAD_SLEEP_TIME_NSEC = 10;

constexpr int APS_DEFAULT_EXPOSURE = 6500;
constexpr double APS_DEFAULT_RATE = 50;
Expand All @@ -36,34 +37,29 @@ constexpr double DVS_DEFAULT_RATE = 50;
constexpr int DVS_DEFAULT_SIZE = 1000;
constexpr Mode DVS_DEFAULT_MODE = Mode::SIZE;

constexpr int DVS_CONFIGURATION_ALIGNED = 32;
constexpr int APS_CONFIGURATION_ALIGNED = 16;
constexpr int CONFIGURATION_ALIGNED = 128;
constexpr int THREAD_SLEEP_TIME_NSEC = 10;

using DvsConfiguration = struct {
struct DvsConfiguration {
bool enabled{true};
Mode mode{DVS_DEFAULT_MODE};
int size{DVS_DEFAULT_SIZE};
double rate{DVS_DEFAULT_RATE};
double gamma{DVS_DEFAULT_GAMMA};
} __attribute__((aligned(DVS_CONFIGURATION_ALIGNED)));
} __attribute__((aligned(32)));

using ApsConfiguration = struct {
struct ApsConfiguration {
bool enabled{true};
double rate{APS_DEFAULT_RATE};
int exposure{APS_DEFAULT_EXPOSURE};
} __attribute__((aligned(APS_CONFIGURATION_ALIGNED)));
} __attribute__((aligned(16)));

using ImuConfiguration = struct {
struct ImuConfiguration {
bool enabled{true};
};

using Configuration = struct {
struct Configuration {
DvsConfiguration dvs;
ApsConfiguration aps;
ImuConfiguration imu;
} __attribute__((aligned(CONFIGURATION_ALIGNED)));
} __attribute__((aligned(128)));

class Asap {
public:
Expand All @@ -87,7 +83,7 @@ class Asap {
std::thread dvsThread_, apsThread_, imuThread_, cameraInfoThread_;
ros::Publisher dvsPub_{}, apsPub_{}, imuPub_{}, cameraInfoPub_{};
ros::ServiceServer feedbackSrv_{}, configurationSrv_{}, roiSrv_{};
dynamic_reconfigure::Server<asap::asapConfig> server_{};
dynamic_reconfigure::Server<asap::parametersConfig> server_{};
std::array<double, 3> autoModeRecall_{0, 0, 0};
std::queue<double> timeQueue_{};
double gammaMax_{};
Expand All @@ -111,7 +107,7 @@ class Asap {
bool feedbackCallback(asap::Feedback::Request &, asap::Feedback::Response &);
bool setConfigurationCallback(asap::Configuration::Request &, asap::Configuration::Response &);
bool setRoiCallback(asap::Roi::Request &, asap::Roi::Response &);
void dynamicReconfigureCallback(asap::asapConfig &config, uint32_t level);
void dynamicReconfigureCallback(asap::parametersConfig &config, uint32_t level);
};

inline double saturation(const double x, const double xmax, const double xmin) {
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<license>GPLv3</license>
<buildtool_depend>catkin</buildtool_depend>
<depend>dvs_msgs</depend>
<depend>dynamic_reconfigure</depend>
<depend>roscpp</depend>
<depend>sensor_msgs</depend>
<depend>std_msgs</depend>
Expand Down
2 changes: 1 addition & 1 deletion src/services.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool Asap::setRoiCallback(asap::Roi::Request &req, asap::Roi::Response &res) {
return res.success;
}

void Asap::dynamicReconfigureCallback(asap::asapConfig &config, uint32_t level) {
void Asap::dynamicReconfigureCallback(asap::parametersConfig &config, uint32_t level) {
if(static_cast<int>(level) < 0) {
return;
}
Expand Down

0 comments on commit 3048b92

Please sign in to comment.