I have the following lines in my program-
lcm = DrakeLcm()
lcm_command_sender = builder.AddSystem(IiwaCommandSender())
lcm_publisher = builder.AddSystem(LcmPublisherSystem.Make(channel="IIWA_COMMAND", lcm_type=lcmt_iiwa_command, lcm=lcm, publish_period=0.01))
//Connect controller to command sender
builder.Connect(controller.GetOutputPort("joint_positions"), lcm_command_sender.get_position_input_port())
//Connect lcm command sender to publisher
builder.Connect(lcm_command_sender.GetOutputPort("lcmt_iiwa_command"), lcm_publisher.get_input_port())
Upon running, the last line gives the following runtime error-
RuntimeError: DiagramBuilder::Connect: Mismatched value types while connecting output port lcmt_iiwa_command of System lcm_command_sender (type drake::lcmt_iiwa_command) to input port lcm_message of System LcmPublisherSystem(IIWA_COMMAND) (type drake::pydrake::Object)
I am not sure why this happens, since the documentation specifically says that the output port of IiwaCommandSender
should be connected to the input port of LcmPublisherSystem
, and both of them are of the type AbstractValue
. What is it that I'm missing?