Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
SegCam Class ReferenceForwards segmented images from camera over wireless. More...
Inheritance diagram for SegCam:
Detailed DescriptionForwards segmented images from camera over wireless. The format used for serialization is basically defined by the subclass of FilterBankGenerator being used. I suggest looking at that classes's documentation to determine the format used. (Generally either SegmentedColorGenerator or RLEGenerator) However, SegCam will add a few fields at the beginning of each packet to assist in processing the image stream. I emphasize: beginning of each Vision packet, before the FilterBankGenerator header.
Alternatively, SegCam may send a "Close Connection" packet when the server is shutting down. This is to help UDP connections, which otherwise wouldn't realize that they need to start trying to reconnect.
This is exactly the same protocol that is followed by the RawCam behavior as well - the same code can parse either stream. However, one odd bit - since the RLEGenerator doesn't save the color information itself, SegCam will do it instead. So, if SegCam is using RLE compression, it will tack a footer at the end of the packet: (from SegmentedColorGenerator::encodeColors())
You can tell whether to expect the color footer by the creator string that follows the SegCam header. (The compression field listed is considering segmented color itself a type of compression, whether or not it's RLE encoded, so you can't use that to tell whether the data is RLE encoded until you get to the data section.) This is a binary protocol -- the fields listed indicate binary values in the AIBO's byte order (little endian). Strings are encoded using the LoadSave::encode(char*,unsigned int, unsigned int) method. Definition at line 58 of file SegCam.h.
Constructor & Destructor Documentation
don't call Member Function Documentation
closes and sends a packet, does nothing if no packet open Definition at line 197 of file SegCam.cc. Referenced by doEvent(), writeRLE(), and writeSeg().
Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event. Default implementation watches for 'private' text message events (those forwarded by a BehaviorSwitchControl from ControllerGUI input) and will publically rebroadcast them. The idea is that your own processEvent gets first dibs, but if the behavior doesn't handle the text message, it will be handed off for others. Reimplemented from CameraStreamBehavior.
Delegate function for subclasses to be notified when the behavior starts up. Should be overridden by subclasses to subscribe to events, install motion commands, etc. doStart() is basically a hook to allow subclasses to jump in and do some customization of behavior parameters while the behavior is starting. If you are writing a behavior class and do not expect further derivation, just override doStart() yourself. However, if you do expect further derivation of your class, consider using preStart() or postStart() instead, and leave doStart() for the 'leaf' classes. Reimplemented from BehaviorBase.
Delegate function for subclasses to be notified when the behavior starts up. May be overridden to cleanup when the behavior is shutting down. However events will automatically be unsubscribed, and by using addMotion(), motions will automatically be removed by stop(), so you may not need any cleanup. Reimplemented from BehaviorBase.
Gives a short description of what this class of behaviors does... you should override this (but don't have to). If you do override this, also consider overriding getDescription() to return it Reimplemented from CameraStreamBehavior. Definition at line 79 of file SegCam.h. Referenced by getDescription().
Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis). By default simply returns getName(), because any calls from a BehaviorBase function to getClassDescription() are going to call BehaviorBase::getClassDescription(), not ~YourSubClass~getClassDescription(), because static functions can't be virtual in C++ (doh!) This means that getDescription called on a pointer to a BehaviorBase of unknown subtype would always return an empty string, which is pretty useless. So instead we return the name in this situation. If you want getDescription to return getClassDescription, you'll have to override it in your subclass to do so. Reimplemented from CameraStreamBehavior.
function for network data to be sent to -- forwards to theOne's receiveData() Definition at line 89 of file SegCam.h. Referenced by setupServer().
opens a new packet, writes header info; returns true if open, false if otherwise open (check cur==NULL for error) see the class documentation for SegCam for the protocol documentation Definition at line 129 of file SegCam.cc. Referenced by writeRLE(), and writeSeg().
sends a packet signaling the server is closing the connection (good for UDP connections) Definition at line 207 of file SegCam.cc. Referenced by closeServer().
Member Data Documentation
number of bytes remaining in packet Definition at line 107 of file SegCam.h. Referenced by closePacket(), openPacket(), writeRLE(), and writeSeg().
current location in packet Definition at line 106 of file SegCam.h. Referenced by closePacket(), doEvent(), openPacket(), writeRLE(), and writeSeg().
the time that the last event was processed Reimplemented from CameraStreamBehavior. Definition at line 109 of file SegCam.h. Referenced by closePacket(), and doEvent().
the buffer size requested from Wireless when the socket was allocated Definition at line 108 of file SegCam.h. Referenced by openPacket(), and setupServer().
buffer being filled out to be sent Definition at line 105 of file SegCam.h. Referenced by closePacket(), doEvent(), and openPacket().
300KB for use up to 640x480 pixels / 8 min expected runs * 5 bytes per run + some padding Definition at line 69 of file SegCam.h. Referenced by setupServer().
64KB is the max udp packet size Definition at line 71 of file SegCam.h. Referenced by setupServer().
socket to send image stream over Definition at line 104 of file SegCam.h. Referenced by closePacket(), closeServer(), doEvent(), openPacket(), sendCloseConnectionPacket(), and setupServer(). The documentation for this class was generated from the following files: |
Tekkotsu v5.1CVS |
Generated Mon May 9 04:59:15 2016 by Doxygen 1.6.3 |