Hi!
I would like to write a function, when initiated by "PLC start mission", will take the value from "robot_id" and enter it in the appropriate place in the function. Unfortunately, he keeps throwing me an error. Anyone tell me how to correctly load a value into my function?
Your robot id is in msg.payload not msg.payload.robot_id_int
Additionally, looking at your flow, I suspect you think these 2 messages will arrive into the function at the same time. They will not! This is a fundamental point to understand if you are to be proficient with node-red.
For this you would need to store the robot ID in context or use a join node.
to avoid mistakes like these, it would be worth spending a little time learning the basics...
I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.