Skip to content
Merged
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
7 changes: 3 additions & 4 deletions include/sas_force_sensor/sas_force_sensor_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <geometry_msgs/msg/wrench_stamped.hpp>
#include <sas_core/sas_object.hpp>

using namespace rclcpp;
using namespace DQ_robotics;

namespace sas
Expand All @@ -47,12 +46,12 @@ namespace sas
class ForceSensorClient: private sas::Object
{
private:
std::shared_ptr<Node> node_;
std::shared_ptr<rclcpp::Node> node_;

std::atomic_bool enabled_;
const std::string topic_prefix_;

Subscription<geometry_msgs::msg::WrenchStamped>::SharedPtr subscriber_wrench_;
rclcpp::Subscription<geometry_msgs::msg::WrenchStamped>::SharedPtr subscriber_wrench_;
DQ force_;
DQ torque_;

Expand All @@ -68,7 +67,7 @@ class ForceSensorClient: private sas::Object
* @param topic_prefix Prefix used to compose the ROS topic name (defaults to "GET_FROM_NODE",
* in which case the node name is used).
*/
ForceSensorClient(const std::shared_ptr<Node>& node, const std::string& topic_prefix="GET_FROM_NODE");
ForceSensorClient(const std::shared_ptr<rclcpp::Node>& node, const std::string& topic_prefix="GET_FROM_NODE");

/**
* @brief Check whether the client has received at least one force/torque reading.
Expand Down
7 changes: 3 additions & 4 deletions include/sas_force_sensor/sas_force_sensor_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <geometry_msgs/msg/wrench_stamped.hpp>
#include <sas_core/sas_object.hpp>

using namespace rclcpp;
using namespace DQ_robotics;

namespace sas
Expand All @@ -46,11 +45,11 @@ namespace sas
class ForceSensorServer: private sas::Object
{
private:
std::shared_ptr<Node> node_;
std::shared_ptr<rclcpp::Node> node_;

const std::string topic_prefix_;

Publisher<geometry_msgs::msg::WrenchStamped>::SharedPtr publisher_wrench_;
rclcpp::Publisher<geometry_msgs::msg::WrenchStamped>::SharedPtr publisher_wrench_;
public:
ForceSensorServer() = delete;
ForceSensorServer(const ForceSensorServer&) = delete;
Expand All @@ -62,7 +61,7 @@ class ForceSensorServer: private sas::Object
* @param topic_prefix Prefix used to compose the ROS topic name (defaults to "GET_FROM_NODE",
* in which case the node name is used).
*/
ForceSensorServer(const std::shared_ptr<Node>& node, const std::string& topic_prefix="GET_FROM_NODE");
ForceSensorServer(const std::shared_ptr<rclcpp::Node>& node, const std::string& topic_prefix="GET_FROM_NODE");

/**
* @brief Publish the current force/torque reading.
Expand Down
8 changes: 4 additions & 4 deletions src/examples/sinusoidal_force_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ class SinusoidalForceSensorNode : public rclcpp::Node
{
public:
SinusoidalForceSensorNode()
: Node("sinusoidal_force_sensor")
: rclcpp::Node("sinusoidal_force_sensor")
{
}

void attach_server()
{
server_ = std::make_shared<sas::ForceSensorServer>(
std::shared_ptr<Node>(shared_from_this()), "sinusoidal_force_sensor");
std::shared_ptr<rclcpp::Node>(shared_from_this()), "sinusoidal_force_sensor");
timer_ = this->create_wall_timer(
std::chrono::milliseconds(static_cast<int>(1000.0 / tick_rate_hz)),
std::bind(&SinusoidalForceSensorNode::on_timer, this));
Expand All @@ -61,8 +61,8 @@ class SinusoidalForceSensorNode : public rclcpp::Node
force_reading_ = value;
torque_reading_ = value;

DQ force(Vector3d(value, 0.0, 0.0));
DQ torque(Vector3d(0.0, value, 0.0));
DQ force(Eigen::Vector3d(value, 0.0, 0.0));
DQ torque(Eigen::Vector3d(0.0, value, 0.0));

server_->send_force_torque(force, torque);
}
Expand Down
2 changes: 1 addition & 1 deletion src/sas_force_sensor_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void ForceSensorClient::_callback_wrench(const geometry_msgs::msg::WrenchStamped
}
}

ForceSensorClient::ForceSensorClient(const std::shared_ptr<Node>& node, const std::string& topic_prefix):
ForceSensorClient::ForceSensorClient(const std::shared_ptr<rclcpp::Node>& node, const std::string& topic_prefix):
sas::Object("sas::ForceSensorClient"),
node_(node),
enabled_(false),
Expand Down
2 changes: 1 addition & 1 deletion src/sas_force_sensor_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
namespace sas
{

ForceSensorServer::ForceSensorServer(const std::shared_ptr<Node>& node, const std::string& topic_prefix):
ForceSensorServer::ForceSensorServer(const std::shared_ptr<rclcpp::Node>& node, const std::string& topic_prefix):
sas::Object("sas::ForceSensorServer"),
node_(node),
topic_prefix_(topic_prefix == "GET_FROM_NODE"? node->get_name() : topic_prefix)
Expand Down
Loading