Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to update a TLM item based on sending a command #1725

Open
mkalin2 opened this issue Nov 25, 2024 · 4 comments
Open

Way to update a TLM item based on sending a command #1725

mkalin2 opened this issue Nov 25, 2024 · 4 comments
Labels
question Questions about OpenC3

Comments

@mkalin2
Copy link

mkalin2 commented Nov 25, 2024

Lets say I have a stepper motor driver, and I want to keep track of the total number of steps that I have commanded to the motor. Is there a way to have the 'motor move' command packet update a TLM packet that will accumulate the number of steps across the command sender and various scripts?

It seems like I could do this using a write conversion and a virtual TLM packet. I am unsure of how I to access the TLM packet from the conversion however. I am also unsure of how I could reset this TLM value without actually sending a command to my motor driver board...

Is this possible and if so am I on the right track?

@jmthomas
Copy link
Member

You can certainly do this with "fake" telemetry packets and by calling inject_tlm to update it. However I would recommend using the Stash API which was created for just this use case. Store something internally and then retrieve it.

@jmthomas jmthomas added the question Questions about OpenC3 label Nov 25, 2024
@mkalin2
Copy link
Author

mkalin2 commented Nov 25, 2024

I would like this to work even if the command is sent via the command sender. Will I be able to update the stashed value outside of a script?

@mkalin2
Copy link
Author

mkalin2 commented Nov 25, 2024

Like is there a way to implement a custom telemetry item like RECIVED_COUNT that gets updated based on things that happen in COSMOS rather than by info in the packet.

@jmthomas
Copy link
Member

You could create a command VALIDATOR that does an inject_tlm like I mentioned above to save whatever values you want in an existing telemetry packet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions about OpenC3
Projects
None yet
Development

No branches or pull requests

2 participants