diff --git a/asv_setup/config/freya.yaml b/asv_setup/config/freya.yaml new file mode 100644 index 00000000..e0702db2 --- /dev/null +++ b/asv_setup/config/freya.yaml @@ -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" + + diff --git a/asv_setup/launch/launch_to_erase.yaml b/asv_setup/launch/launch_to_erase.yaml new file mode 100644 index 00000000..3ee807f6 --- /dev/null +++ b/asv_setup/launch/launch_to_erase.yaml @@ -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 + + diff --git a/asv_setup/scripts/parameter_manager_node.py b/asv_setup/scripts/parameter_manager_node.py new file mode 100644 index 00000000..30fb80b4 --- /dev/null +++ b/asv_setup/scripts/parameter_manager_node.py @@ -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() \ No newline at end of file diff --git a/git b/git new file mode 100644 index 00000000..e69de29b