robotpy / robotpy/mostrobotpy

SendableRegistry Add/AddLW/AddChild are broken

Open
#83 0 comments 0 reactions 0 assignees View on GitHub
bug package: wpiutil
Dominant language
Python
Stars
27
Forks
29
Avg merge
4d 6h
Merged PRs (30d)
12

Description

They are trying to use keep alives to keep the pointers alive but it's not the right solution.

Probably need to do the same thing we do for SmartDashboard with a separate hash map to hold references.

```python
import wpilib
import wpilib.drive
import wpiutil

leftLeader = wpilib.PWMSparkMax(1)
rightLeader = wpilib.PWMSparkMax(2)
drive = wpilib.drive.DifferentialDrive(
leftLeader,
rightLeader,
)

wpiutil.SendableRegistry.addChild(drive, leftLeader)
```

```sh
$ python ../../t.py
Traceback (most recent call last):
File "../../t.py", in
wpiutil.SendableRegistry.addChild(drive, leftLeader)
RuntimeError: Could not activate keep_alive!
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.