Compare commits

..

No commits in common. "71dbeb6b85b7e8c1b5a8a9cd2a9c311352346d5e" and "62ad6e683b007d26aed706c1dfa82b6560b1e777" have entirely different histories.

5 changed files with 2 additions and 66 deletions

View File

@ -35,8 +35,7 @@ add_executable(ros2aria
src/cmd_vel.cpp src/cmd_vel.cpp
src/publish.cpp src/publish.cpp
src/sonar.cpp src/sonar.cpp
src/pose.cpp src/pose.cpp)
src/gripper.cpp)
ament_target_dependencies(ros2aria rclcpp) ament_target_dependencies(ros2aria rclcpp)
ament_target_dependencies(ros2aria std_srvs) ament_target_dependencies(ros2aria std_srvs)

View File

@ -1,34 +0,0 @@
#include "./ros2aria.hpp"
void Ros2Aria::gripper_open_callback(const std_srvs::srv::Empty::Request::SharedPtr request, std_srvs::srv::Empty::Response::SharedPtr response) const
{
UNUSED(request);
UNUSED(response);
std::lock_guard<RAIIBot> lock(*robot.get());
auto g = robot->getGripper();
g->gripOpen();
}
void Ros2Aria::gripper_close_callback(const std_srvs::srv::Empty::Request::SharedPtr request, std_srvs::srv::Empty::Response::SharedPtr response) const
{
UNUSED(request);
UNUSED(response);
std::lock_guard<RAIIBot> lock(*robot.get());
auto g = robot->getGripper();
g->gripClose();
}
void Ros2Aria::gripper_up_callback(const std_srvs::srv::Empty::Request::SharedPtr request, std_srvs::srv::Empty::Response::SharedPtr response) const
{
UNUSED(request);
UNUSED(response);
std::lock_guard<RAIIBot> lock(*robot.get());
auto g = robot->getGripper();
g->liftUp();
}
void Ros2Aria::gripper_down_callback(const std_srvs::srv::Empty::Request::SharedPtr request, std_srvs::srv::Empty::Response::SharedPtr response) const
{
UNUSED(request);
UNUSED(response);
std::lock_guard<RAIIBot> lock(*robot.get());
auto g = robot->getGripper();
g->liftDown();
}

View File

@ -15,7 +15,6 @@ public:
RAIIBot(rclcpp::Node *node, std::string port) RAIIBot(rclcpp::Node *node, std::string port)
{ {
this->robot = new ArRobot(); this->robot = new ArRobot();
this->gripper = new ArGripper(this->robot);
this->node = node; this->node = node;
this->clock = rclcpp::Clock::make_shared(); this->clock = rclcpp::Clock::make_shared();
@ -77,11 +76,6 @@ public:
return this->robot; return this->robot;
} }
ArGripper *getGripper()
{
return this->gripper;
}
rclcpp::Clock::SharedPtr getClock() rclcpp::Clock::SharedPtr getClock()
{ {
return this->clock; return this->clock;
@ -110,7 +104,6 @@ private:
ArRobotConnector *robotConn = nullptr; ArRobotConnector *robotConn = nullptr;
ArArgumentBuilder *args = nullptr; ArArgumentBuilder *args = nullptr;
ArArgumentParser *argparser = nullptr; ArArgumentParser *argparser = nullptr;
ArGripper *gripper = nullptr;
rclcpp::Node *node = nullptr; rclcpp::Node *node = nullptr;
rclcpp::TimerBase::SharedPtr watchdogTimer; rclcpp::TimerBase::SharedPtr watchdogTimer;
rclcpp::Time lastWatchdogPoke; rclcpp::Time lastWatchdogPoke;

View File

@ -12,19 +12,13 @@ Ros2Aria::Ros2Aria()
RCLCPP_INFO(this->get_logger(), "starting subscribers and services"); RCLCPP_INFO(this->get_logger(), "starting subscribers and services");
cmd_vel_sub_ = this->create_subscription<geometry_msgs::msg::Twist>( cmd_vel_sub_ = this->create_subscription<geometry_msgs::msg::Twist>(
"cmd_vel", 10, std::bind(&Ros2Aria::cmd_vel_callback, this, _1)); "cmd_vel", 10, std::bind(&Ros2Aria::cmd_vel_callback, this, _1));
stop_service_ = this->create_service<std_srvs::srv::Empty>("stop", std::bind(&Ros2Aria::stop, this, _1, _2));
sonar_pub_ = this->create_publisher<sensor_msgs::msg::PointCloud>("sonar", 10); sonar_pub_ = this->create_publisher<sensor_msgs::msg::PointCloud>("sonar", 10);
sonar_pointcloud2_pub_ = this->create_publisher<sensor_msgs::msg::PointCloud2>("sonar_pointcloud2", 10); sonar_pointcloud2_pub_ = this->create_publisher<sensor_msgs::msg::PointCloud2>("sonar_pointcloud2", 10);
pose_pub_ = this->create_publisher<nav_msgs::msg::Odometry>("pose", 1000); pose_pub_ = this->create_publisher<nav_msgs::msg::Odometry>("pose", 1000);
// services
stop_service_ = this->create_service<std_srvs::srv::Empty>("stop", std::bind(&Ros2Aria::stop, this, _1, _2));
gripper_open_service_ = this->create_service<std_srvs::srv::Empty>("gripper_open", std::bind(&Ros2Aria::gripper_open_callback, this, _1, _2));
gripper_close_service_ = this->create_service<std_srvs::srv::Empty>("gripper_close", std::bind(&Ros2Aria::gripper_close_callback, this, _1, _2));
gripper_up_service_ = this->create_service<std_srvs::srv::Empty>("gripper_up", std::bind(&Ros2Aria::gripper_up_callback, this, _1, _2));
gripper_down_service_ = this->create_service<std_srvs::srv::Empty>("gripper_down", std::bind(&Ros2Aria::gripper_down_callback, this, _1, _2));
// listen to sensors // listen to sensors
auto r = robot->getRobot(); auto r = robot->getRobot();
r->addSensorInterpTask("ROSPublishingTask", 100, &this->sensorCb); r->addSensorInterpTask("ROSPublishingTask", 100, &this->sensorCb);
@ -40,8 +34,6 @@ Ros2Aria::~Ros2Aria()
void Ros2Aria::stop(const std::shared_ptr<std_srvs::srv::Empty::Request> request, std::shared_ptr<std_srvs::srv::Empty::Response> response) const void Ros2Aria::stop(const std::shared_ptr<std_srvs::srv::Empty::Request> request, std::shared_ptr<std_srvs::srv::Empty::Response> response) const
{ {
UNUSED(request);
UNUSED(response);
RCLCPP_INFO(this->get_logger(), "stop"); RCLCPP_INFO(this->get_logger(), "stop");
rclcpp::shutdown(); rclcpp::shutdown();
} }

View File

@ -9,8 +9,6 @@
#include "./raiibot.cpp" #include "./raiibot.cpp"
#define UNUSED(x) (void)(x)
class Ros2Aria : public rclcpp::Node class Ros2Aria : public rclcpp::Node
{ {
public: public:
@ -45,16 +43,4 @@ private:
// services // services
rclcpp::Service<std_srvs::srv::Empty>::SharedPtr stop_service_; rclcpp::Service<std_srvs::srv::Empty>::SharedPtr stop_service_;
void stop(const std::shared_ptr<std_srvs::srv::Empty::Request> request, std::shared_ptr<std_srvs::srv::Empty::Response> response) const; void stop(const std::shared_ptr<std_srvs::srv::Empty::Request> request, std::shared_ptr<std_srvs::srv::Empty::Response> response) const;
rclcpp::Service<std_srvs::srv::Empty>::SharedPtr gripper_open_service_;
void gripper_open_callback(const std_srvs::srv::Empty::Request::SharedPtr request, std_srvs::srv::Empty::Response::SharedPtr response) const;
rclcpp::Service<std_srvs::srv::Empty>::SharedPtr gripper_close_service_;
void gripper_close_callback(const std_srvs::srv::Empty::Request::SharedPtr request, std_srvs::srv::Empty::Response::SharedPtr response) const;
rclcpp::Service<std_srvs::srv::Empty>::SharedPtr gripper_up_service_;
void gripper_up_callback(const std_srvs::srv::Empty::Request::SharedPtr request, std_srvs::srv::Empty::Response::SharedPtr response) const;
rclcpp::Service<std_srvs::srv::Empty>::SharedPtr gripper_down_service_;
void gripper_down_callback(const std_srvs::srv::Empty::Request::SharedPtr request, std_srvs::srv::Empty::Response::SharedPtr response) const;
}; };