galactic adjustments

This commit is contained in:
Your Name
2023-07-06 17:28:34 +02:00
parent 951058e644
commit ca6945a2de
8 changed files with 93 additions and 14 deletions

View File

@ -14,7 +14,7 @@
#include "wheel.h"
#include "arduino_comms.h"
using hardware_interface::CallbackReturn;
// using hardware_interface::CallbackReturn;
using hardware_interface::return_type;
namespace diffdrive_arduino
@ -37,9 +37,11 @@ public:
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) override;
// return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) override;
return_type read() override;
return_type write(const rclcpp::Time & time, const rclcpp::Duration & period) override;
// return_type write(const rclcpp::Time & time, const rclcpp::Duration & period) override;
return_type write() override;

View File

@ -13,7 +13,7 @@
#include "config.h"
#include "wheel.h"
using hardware_interface::CallbackReturn;
//using CallbackReturn;
using hardware_interface::return_type;
class FakeRobot : public hardware_interface::SystemInterface
@ -33,9 +33,11 @@ public:
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) override;
// return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) override;
return_type read() override;
return_type write(const rclcpp::Time & time, const rclcpp::Duration & period) override;
// return_type write(const rclcpp::Time & time, const rclcpp::Duration & period) override;
return_type write() override;
private:

View File

@ -14,7 +14,6 @@ void ArduinoComms::setup(const std::string &serial_device, int32_t baud_rate, in
serial::Timeout tt = serial::Timeout::simpleTimeout(timeout_ms);
serial_conn_.setTimeout(tt); // This should be inline except setTimeout takes a reference and so needs a variable
serial_conn_.open();
}
void ArduinoComms::sendEmptyMsg()

View File

@ -90,7 +90,7 @@ CallbackReturn DiffDriveArduino::on_deactivate(const rclcpp_lifecycle::State & /
return CallbackReturn::SUCCESS;
}
return_type DiffDriveArduino::read(const rclcpp::Time & /* time */, const rclcpp::Duration & /* period */)
return_type DiffDriveArduino::read()
{
// TODO fix chrono duration
@ -114,7 +114,7 @@ return_type DiffDriveArduino::read(const rclcpp::Time & /* time */, const rclcpp
return return_type::OK;
}
return_type DiffDriveArduino::write(const rclcpp::Time & /* time */, const rclcpp::Duration & /* period */)
return_type DiffDriveArduino::write()
{
if (!arduino_.connected())
{

View File

@ -4,6 +4,7 @@
int main(int argc, char **argv)
{
RCLCPP_INFO(logger_, "STARTING FILE");
ros::init(argc, argv, "diffdrive_robot");
ros::NodeHandle n("~");
@ -17,9 +18,11 @@ int main(int argc, char **argv)
n.getParam("enc_counts_per_rev", robot_cfg.enc_counts_per_rev);
n.getParam("robot_loop_rate", robot_cfg.loop_rate);
RCLCPP_INFO(logger_, "STARTING DIFFDRIVE");
DiffDriveArduino robot(robot_cfg);
RCLCPP_INFO(logger_, "FINISHED DIFFDRIVE");
controller_manager::ControllerManager cm(&robot);
RCLCPP_INFO(logger_, "FINISHED CONTROLLER");
ros::AsyncSpinner spinner(1);
spinner.start();
@ -30,6 +33,7 @@ int main(int argc, char **argv)
while (ros::ok())
{
RCLCPP_INFO(logger_, "Entered robot read/write loop.");
robot.read();
cm.update(robot.get_time(), robot.get_period());
robot.write();

View File

@ -14,7 +14,7 @@ CallbackReturn FakeRobot::on_init(const hardware_interface::HardwareInfo & info)
return CallbackReturn::ERROR;
}
RCLCPP_INFO(logger_, "Configuring...");
RCLCPP_INFO(logger_, "Configuring Fakerobot...");
time_ = std::chrono::system_clock::now();
@ -29,7 +29,7 @@ CallbackReturn FakeRobot::on_init(const hardware_interface::HardwareInfo & info)
l_wheel_.setup(cfg_.left_wheel_name, cfg_.enc_counts_per_rev);
r_wheel_.setup(cfg_.right_wheel_name, cfg_.enc_counts_per_rev);
RCLCPP_INFO(logger_, "Finished Configuration");
RCLCPP_INFO(logger_, "Finished Configuration Fakerobot");
return CallbackReturn::SUCCESS;
}
@ -62,7 +62,8 @@ std::vector<hardware_interface::CommandInterface> FakeRobot::export_command_inte
hardware_interface::return_type FakeRobot::read(const rclcpp::Time & /* time */, const rclcpp::Duration & /* period */)
// hardware_interface::return_type FakeRobot::read(const rclcpp::Time & /* time */, const rclcpp::Duration & /* period */)
hardware_interface::return_type FakeRobot::read()
{
// TODO fix chrono duration
@ -83,7 +84,8 @@ hardware_interface::return_type FakeRobot::read(const rclcpp::Time & /* time */,
}
hardware_interface::return_type FakeRobot::write(const rclcpp::Time & /* time */, const rclcpp::Duration & /* period */)
// hardware_interface::return_type FakeRobot::write(const rclcpp::Time & /* time */, const rclcpp::Duration & /* period */)
hardware_interface::return_type FakeRobot::write()
{
// Set the wheel velocities to directly match what is commanded