-
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
Showing
4 changed files
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/parameter_manager_node: | ||
ros__parameters: | ||
configuration_matrix: "[[ 0.70711, 0.70711, 0.70711, 0.70711], [ -0.70711, 0.70711, -0.70711, 0.70711], [ 0.27738, 0.27738, -0.27738, -0.27738]]" #NED #Surge #Sway #Yaw | ||
asv_thruster_manager_input: "thrust/desired_forces" # 3DOF thrust vector | ||
asv_thruster_manager_output: "thrust/thruster_forces" | ||
asv_thruster_manager_wrench: "thrust/wrench_input" | ||
joy_node: "joystick/joy" | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
launch: | ||
- node: | ||
pkg: test_pkg | ||
exec: test_node | ||
name: parameter_manager_node | ||
output: screen | ||
param: | ||
- from: /home/jade/ros2_ws/src/test_pkg/test_pkg/config/params.yaml | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import rclpy | ||
from rclpy.node import Node | ||
import ast | ||
|
||
|
||
class ParameterManagerNode(Node): | ||
|
||
def __init__(self): | ||
super().__init__('parameter_manager_node') | ||
|
||
self.get_logger().info("Parameter manager node is up and running") | ||
|
||
|
||
#Declaration of parameters | ||
self.declare_parameter('configuration_matrix',"") | ||
self.declare_parameter('asv_thruster_manager_output',"") | ||
self.declare_parameter('asv_thruster_manager_input',"") | ||
self.declare_parameter('asv_thruster_manager_wrench',"") | ||
|
||
self.configuration_matrix = self.get_parameter('configuration_matrix').value #Is a string because 2D Array is not supported as a ros2 param | ||
self.asv_thruster_manager_output = self.get_parameter('asv_thruster_manager_output').value | ||
self.asv_thruster_manager_input = self.get_parameter('asv_thruster_manager_input').value | ||
self.asv_thruster_manager_wrench = self.get_parameter('asv_thruster_manager_wrench').value | ||
|
||
self.configuration_matrix = StringInto2DArray(self.configuration_matrix) | ||
|
||
|
||
def StringInto2DArray(input_string): | ||
two_d_array = ast.literal_eval(input_string) | ||
if isinstance(two_d_array, list) and all(isinstance(row, list) for row in two_d_array): | ||
return two_d_array | ||
else: | ||
print("The input string is not a valid 2D array.") | ||
|
||
|
||
def main(): | ||
rclpy.init() | ||
parameter_manager_node = ParameterManagerNode() | ||
test = parameter_manager_node.asv_thruster_manager_output | ||
#rclpy.spin(joystick_interface) | ||
#parameter_manager_node.destroy_node() | ||
rclpy.shutdown() | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
main() |