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

Change event messages to hold the old and new state #5

Open
bit-pirate opened this issue Aug 29, 2013 · 4 comments
Open

Change event messages to hold the old and new state #5

bit-pirate opened this issue Aug 29, 2013 · 4 comments
Assignees
Milestone

Comments

@bit-pirate
Copy link
Contributor

Currently each program receiving event messages needs to store the old state of the sensor(s) internally to understand what has changed. This means each of them needs to implement this logic to parse the message, store the old state and compare it with the new sate.

Let's move this logic into the kobuki_node and always publish the old and new state to make the life easier for developers creating apps/programs on top of Kobuki (node).

Also, let's use this change to design new messages, which are more suitable for general use, so that they may get integrated into standard ROS message packages in the future (or at least serve as a design seed).

@ghost ghost assigned bit-pirate Aug 29, 2013
@bit-pirate
Copy link
Contributor Author

Here is a proposal for general state messages, which could be used for the bumper, cliff and wheel drop events.:

BoolStateChange

bool UNSET = 0
bool SET   = 1

bool new_state
bool old_state

BoolStateChangeStamped

# contains time stamp of the message creation (ideally state data creation)
# and frame_id holds the object's name, which we are tracking
# (ideally corresponds with the tf frame name)
std_msgs/Header header

bool UNSET = 0
bool SET   = 1

bool new_state
bool old_state

BoolStatesChange

BoolStateChange[] state_changes

BoolStatesChangeStamped

BoolStateChangeStamped[] state_changes

@stonier
Copy link
Member

stonier commented Aug 29, 2013

I suspect if you make arrays of msgs like this though, you won't get bit packing. Is that important to us?

The roswiki has a decent page about how different data types are handled. Probably what is important to note there is that message arrays won't be bit packed, but for c++, bool[] won't even be bit packed (defaults to std::vector<uint8_t>).

So, if we wanted bit packing, the only way you'd get that is if you represented the plurality of those sensors with int32 or similar and parsed them as bitfields.

@bit-pirate
Copy link
Contributor Author

I suspect if you make arrays of msgs like this though, you won't get bit packing. Is that important to us?

Only except in cases in which you like to track a huge amount of states, e.g. track the state of a building's 18932 light bulbs. Also, when using the stamped versions, the strings are the heavy part.

I guess, the slim versions would be:

BoolStateChanges (slim)

bool UNSET = 0
bool SET   = 1

Int64 new_state # or Bool, Byte, Int8, Int32,...
Int64 old_state # or Bool, Byte, Int8, Int32,...

BoolStateChangesStamped (slim)

bool UNSET = 0
bool SET   = 1

Time[] stamps 
String[] object_names
Int64 new_state # or Bool, Byte, Int8, Int32,...
Int64 old_state # or Bool, Byte, Int8, Int32,...

Time array is used for case in which the each object's state change may happen at a different time (e.g. message used for low frequency updates).

@corot
Copy link
Collaborator

corot commented Aug 29, 2013

I'm uneasy with the idea.

  • First because the old state of a boolean sounds estrange, if we receive these messages to signal events (because are booleans, no bit-masks, right?.
  • Second, the BoolStatesChange array don't tell you who's state changes, so you need to check the code or documentation.

Am I missing something?

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

No branches or pull requests

3 participants