This repository was archived by the owner on Nov 13, 2023. It is now read-only.
This repository was archived by the owner on Nov 13, 2023. It is now read-only.
SmartDashboard.putData fails with custom Sendable subclasses #630
Description
robot.py:
import wpilib
class Test(wpilib.Sendable):
def __init__(self):
super().__init__()
wpilib.SendableRegistry.getInstance().add(self, "Test", 1)
def initSendable(self, builder):
pass
class Robot(wpilib.TimedRobot):
def robotInit(self):
self.test = Test()
wpilib.SmartDashboard.putData("test", self.test)
if __name__ == "__main__":
wpilib.run(Robot)
Traceback:
Traceback (most recent call last):
File "~/.local/share/virtualenvs/rpy-dev/lib/python3.8/site-packages/wpilib/_impl/start.py", line 106, in start
self.robot.startCompetition()
File "robot.py", line 16, in robotInit
wpilib.SmartDashboard.putData("test", self.test)
RuntimeError: return_value_policy = copy, but type frc::SendableBuilderImpl is non-copyable!
It looks like it's the call to initSendable
that causes this. If the method is deleted:
Traceback (most recent call last):
File "~/.local/share/virtualenvs/rpy-dev/lib/python3.8/site-packages/wpilib/_impl/start.py", line 106, in start
self.robot.startCompetition()
File "robot.py", line 14, in robotInit
wpilib.SmartDashboard.putData("test", self.test)
RuntimeError: <__main__.Test object at 0x63b424da04a0> does not override required function "Sendable::initSendable"
From the tracebacks I got, it looks like it throws up in frc::SendableRegistry::Publish
.