BallAerospace / python-ballcosmos

Python Support for Ball Aerospace COSMOS v4
Other
18 stars 4 forks source link

Dynamic class creation on python api #25

Open thesamprice opened 2 years ago

thesamprice commented 2 years ago

Would you be open to dynamic class creation in the ball cosmos python api? This would let tab completion work in ipython, and it makes scripting easier.

ie in python .

cosmos = CosmosSystem()

print(cosmos.Targets.TargetName.Tlm.TlmPacketName.TlmPacketPoint.value)

# Wait for packet
cosmos.Targets.TargetName.Tlm.TlmPacketName.Wait()

# Command example
cmd = cosmos.Targets.TargetName.Cmd.CmdPacketName()
cmd.cmd_value = 3
cmd.Send()
ghost commented 2 years ago

Hello thanks for your interest in the ballcosmos library for cosmos. Currently the deign of the library is to be as similar to the ruby library so users can read both without having to know major differences. I think this is a good idea, but I think this is better for a separate library . Something we can expand on going into cosmosc2 for cosmos v5.

thesamprice commented 2 years ago

Ok, i have something prototyped that does this using dynamic class creation / setattr / getattr calls. Ping me when / if this would be useful. Feel free to close the issue.