Closed bradley-harden-apl closed 2 years ago
The command count synchronization between C2 and vehicle is a common requirement. I think a custom write protocol is probably the best solution. Create a class instance variable @counter
in your protocol and simply increment it on command. Custom protocols have both a write_data
and write_packet
and for this you want to override write_packet
and then set the field in the packet: packet.write('CCSDSSEQCNT', @counter)
.
I'm not sure how the synchronization between C2 and vehicle works. Perhaps you could write out your local variable to a file to persist it. If the current counter is just broadcast you can simply pull it from telemetry.
We have discussions: https://github.com/BallAerospace/COSMOS/discussions if that feels like a better fit.
If the current counter is just broadcast you can simply pull it from telemetry.
I was going to ask about that. How can you access existing telemetry from a custom protocol? I haven't seen anything in the documentation that discusses that.
We have discussions: https://github.com/BallAerospace/COSMOS/discussions if that feels like a better fit.
Ah, ok. I didn't realize that existed. That's one more place I can search as well. Thanks
I searched through the documentation and existing issues. I think I know how to implement this, but I wanted to double check before actually attempting it.
We would like to use the CCSDS sequence number when sending commands to an instrument, to make sure commands aren't received out of order. This issue discusses checking sequence numbers on the telemetry side, but there doesn't seem to be any equivalent to Processors on the command side. That makes sense to me, because I don't think Processors are intended to modify packets. They seem to be for generating new telemetry items from existing packets (sort of like a more-complicated option for
DERIVED
items).I think the proper way to implement this is with a custom write protocol. Each command packet would leave the sequence number field blank. The protocol would be responsible for tracking the current sequence number for each APID and inserting the correct value into each respective packet type. Is that how you would approach it?
If so, how would you synchronize sequence numbers with a remote instrument? For instance, if either COSMOS or the instrument has to be reset, how do I tell the protocol to update its internally tracked sequence number? Would it make sense to define a dummy packet that is used to pass information from the user to the protocol? That seems like a hack to me. Is there a better way?
Thanks for your help.
By the way, have you considered creating a Matrix channel, IRC channel or the like? That seems like a more appropriate venue for a question like this, but I don't see any mention of a chat platform on your README page.