Step 7: Send a robot command using SlicerROS2 publishers

  • In the python console, create a publisher for /desired_command topic:
pubCommand = rosNode.CreateAndAddPublisherNode('String', '/desired_command')
  • Send “RETRACT” message and observe the robot fully retract the needle:
pubCommand.Publish('RETRACT')

Retract command

  • Send “HOME” message and observe the robot go to its initial position:
pubCommand.Publish('HOME')

Home command

⬅️ Previous: Read needle position Back to Table of Contents ↩️