Error create_subscriber is not a method of Node
I have been trying to create a node which has the following description:
import sys
import os
import numpy as np
import rclpy
from rclpy.node import Node
from std_msgs.msg import Float32MultiArray
from std_msgs.msg import Bool
dataArray = Float32MultiArray
class controllerNode(Node):
''' Class definition of the controller node'''
def __init__(self):
super().__init__("controller")
self.q = np.zeros((6,1))
self.dq = np.zeros((6,1))
self.q = np.zeros((6,1))
self.dq = np.zeros((6,1))
self.tau = np.zeros((6,1))
self.first = True
# Declare publishers and subscribers
self.input_subscriber = self.create_subscriber(dataArray, 'robot_input', self.input_callback, 10)
self.reset_subscriber = self.create_subscriber(Bool, 'first_input', self.reset_callback, 10)
self.action_publisher = self.create_publisher(dataArray, 'action', 10)
When I build the node and try to execute it an error appears with the following description: AttributeError: 'controllerNode' object has no attribute 'create_subscriber'
. I cannot think where this error is coming from, since I have another node where I just copied and paste and put different parameters and it is working.