Skip to content

change: allow to build in galactic #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/build/*
/install/*
/log/*
/include/*
12 changes: 5 additions & 7 deletions include/diffdrive_arduino/diffdrive_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,34 @@
#include <cstring>
#include "rclcpp/rclcpp.hpp"

#include "hardware_interface/base_interface.hpp"
#include "hardware_interface/system_interface.hpp"
#include "hardware_interface/handle.hpp"
#include "hardware_interface/hardware_info.hpp"
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "hardware_interface/types/hardware_interface_status_values.hpp"
#include "rclcpp_lifecycle/state.hpp"

#include "config.h"
#include "wheel.h"
#include "arduino_comms.h"


using hardware_interface::return_type;

class DiffDriveArduino : public hardware_interface::BaseInterface<hardware_interface::SystemInterface>
class DiffDriveArduino : public hardware_interface::SystemInterface
{


public:
DiffDriveArduino();

return_type configure(const hardware_interface::HardwareInfo & info) override;
CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;

std::vector<hardware_interface::StateInterface> export_state_interfaces() override;

std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;

return_type start() override;
CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;

return_type stop() override;
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;

return_type read() override;

Expand Down
11 changes: 5 additions & 6 deletions include/diffdrive_arduino/fake_robot.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,33 @@

#include "rclcpp/rclcpp.hpp"

#include "hardware_interface/base_interface.hpp"
#include "hardware_interface/system_interface.hpp"
#include "hardware_interface/handle.hpp"
#include "hardware_interface/hardware_info.hpp"
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "hardware_interface/types/hardware_interface_status_values.hpp"
#include "rclcpp_lifecycle/state.hpp"

#include "config.h"
#include "wheel.h"

using hardware_interface::return_type;

class FakeRobot : public hardware_interface::BaseInterface<hardware_interface::SystemInterface>
class FakeRobot : public hardware_interface::SystemInterface
{


public:
FakeRobot();

return_type configure(const hardware_interface::HardwareInfo & info) override;
CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;

std::vector<hardware_interface::StateInterface> export_state_interfaces() override;

std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;

return_type start() override;
CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;

return_type stop() override;
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;

return_type read() override;

Expand Down
25 changes: 9 additions & 16 deletions src/diffdrive_arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@




DiffDriveArduino::DiffDriveArduino()
: logger_(rclcpp::get_logger("DiffDriveArduino"))
{}





return_type DiffDriveArduino::configure(const hardware_interface::HardwareInfo & info)
CallbackReturn DiffDriveArduino::on_init(const hardware_interface::HardwareInfo & info)
{
if (configure_default(info) != return_type::OK) {
return return_type::ERROR;
if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS)
{
return CallbackReturn::ERROR;
}

RCLCPP_INFO(logger_, "Configuring...");
Expand All @@ -41,8 +38,7 @@ return_type DiffDriveArduino::configure(const hardware_interface::HardwareInfo &

RCLCPP_INFO(logger_, "Finished Configuration");

status_ = hardware_interface::status::CONFIGURED;
return return_type::OK;
return CallbackReturn::SUCCESS;
}

std::vector<hardware_interface::StateInterface> DiffDriveArduino::export_state_interfaces()
Expand Down Expand Up @@ -72,7 +68,7 @@ std::vector<hardware_interface::CommandInterface> DiffDriveArduino::export_comma
}


return_type DiffDriveArduino::start()
CallbackReturn DiffDriveArduino::on_activate(const rclcpp_lifecycle::State & /*previous_state*/)
{
RCLCPP_INFO(logger_, "Starting Controller...");

Expand All @@ -81,17 +77,14 @@ return_type DiffDriveArduino::start()
// arduino.setPidValues(14,7,0,100);
arduino_.setPidValues(30, 20, 0, 100);

status_ = hardware_interface::status::STARTED;

return return_type::OK;
return CallbackReturn::SUCCESS;
}

return_type DiffDriveArduino::stop()
CallbackReturn DiffDriveArduino::on_deactivate(const rclcpp_lifecycle::State & /*previous_state*/)
{
RCLCPP_INFO(logger_, "Stopping Controller...");
status_ = hardware_interface::status::STOPPED;

return return_type::OK;
return CallbackReturn::SUCCESS;
}

hardware_interface::return_type DiffDriveArduino::read()
Expand Down
20 changes: 9 additions & 11 deletions src/fake_robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ FakeRobot::FakeRobot()



return_type FakeRobot::configure(const hardware_interface::HardwareInfo & info)
CallbackReturn FakeRobot::on_init(const hardware_interface::HardwareInfo & info)
{
if (configure_default(info) != return_type::OK) {
return return_type::ERROR;
if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS)
{
return CallbackReturn::ERROR;
}

RCLCPP_INFO(logger_, "Configuring...");
Expand All @@ -33,8 +34,7 @@ return_type FakeRobot::configure(const hardware_interface::HardwareInfo & info)

RCLCPP_INFO(logger_, "Finished Configuration");

status_ = hardware_interface::status::CONFIGURED;
return return_type::OK;
return CallbackReturn::SUCCESS;
}

std::vector<hardware_interface::StateInterface> FakeRobot::export_state_interfaces()
Expand Down Expand Up @@ -64,20 +64,18 @@ std::vector<hardware_interface::CommandInterface> FakeRobot::export_command_inte
}


return_type FakeRobot::start()
CallbackReturn FakeRobot::on_activate(const rclcpp_lifecycle::State & /*previous_state*/)
{
RCLCPP_INFO(logger_, "Starting Controller...");
status_ = hardware_interface::status::STARTED;

return return_type::OK;
return CallbackReturn::SUCCESS;
}

return_type FakeRobot::stop()
CallbackReturn FakeRobot::on_deactivate(const rclcpp_lifecycle::State & /*previous_state*/)
{
RCLCPP_INFO(logger_, "Stopping Controller...");
status_ = hardware_interface::status::STOPPED;

return return_type::OK;
return CallbackReturn::SUCCESS;;
}

hardware_interface::return_type FakeRobot::read()
Expand Down