-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Clang Robot
committed
Oct 13, 2023
1 parent
0e998e5
commit 9ed9d19
Showing
4 changed files
with
58 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
motion/thruster_interface/include/thruster_interface/thruster_interface_ros.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
#pragma once | ||
|
||
#include <ament_index_cpp/get_package_share_directory.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
#include <vortex_msgs/msg/pwm.hpp> | ||
#include <vortex_msgs/msg/thruster_forces.hpp> | ||
#include <ament_index_cpp/get_package_share_directory.hpp> | ||
|
||
|
||
#include <thruster_interface/thruster_interface.hpp> | ||
using std::placeholders::_1; | ||
|
||
class ThrusterInterfaceROS : public rclcpp::Node { | ||
private: | ||
std::string mapping_file = ament_index_cpp::get_package_share_directory("thruster_interface") + | ||
"/config/ThrustMe_P1000_force_mapping.csv"; | ||
std::string mapping_file = | ||
ament_index_cpp::get_package_share_directory("thruster_interface") + | ||
"/config/ThrustMe_P1000_force_mapping.csv"; | ||
ThrusterInterface thrusterInterface{mapping_file}; | ||
|
||
rclcpp::Subscription<vortex_msgs::msg::ThrusterForces>::SharedPtr subscription_; | ||
rclcpp::Subscription<vortex_msgs::msg::ThrusterForces>::SharedPtr | ||
subscription_; | ||
rclcpp::Publisher<vortex_msgs::msg::Pwm>::SharedPtr publisher_; | ||
|
||
public: | ||
ThrusterInterfaceROS() : Node("thruster_interface") { | ||
publisher_ = this->create_publisher<vortex_msgs::msg::Pwm>("pwm", 10); | ||
subscription_ = this->create_subscription<vortex_msgs::msg::ThrusterForces>( | ||
"thrust/thruster_forces", 10, std::bind(&ThrusterInterfaceROS::thrust_callback, this, _1)); | ||
"thrust/thruster_forces", 10, | ||
std::bind(&ThrusterInterfaceROS::thrust_callback, this, _1)); | ||
} | ||
void thrust_callback(const vortex_msgs::msg::ThrusterForces::SharedPtr msg); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters