Failure to create ros2 publisher: too many input arguments

32 visualizaciones (últimos 30 días)
Alyssa
Alyssa el 4 de Sept. de 2025 a las 13:23
Comentada: Alyssa el 5 de Sept. de 2025 a las 7:26
Hi all
I'm having trouble creating a ros2 publisher (ROS2 Humble, Matlab 2024b), and feel like I'm going crazy. I'm trying to reuse some old code, which I believed was working. Now, however, it fails at the second step: creating the publisher. I've stripped down my script completely, and believe it matches the syntax in the documentation:
p3pNode = ros2node('p3p_node', 2);
p3pPub = ros2publisher(p3pNode,"/p3p","geometry_msgs/Pose");
When I run this, I get the error below:
Error using ros2publisher
Too many input arguments
The node is created successfully, and /geometry_msgs/Pose is a defined message type. What am i doing wrong?
  4 comentarios
Abhishek
Abhishek el 5 de Sept. de 2025 a las 5:04
Hi Alyssa,
Based on the error message, it seems there may be another function with the same name as ros2publisher located higher in your path. Could you please run the following command and share the output:
which -all ros2publisher
Alyssa
Alyssa el 5 de Sept. de 2025 a las 7:26
You were both right - thank you! I'd accidentally created a higher-level function called ros2publisher (facepalm). The command
which -all ros2publisher
tracked it down.
Thanks for your time on my silly mistake!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Specialized Messages en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by