Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
MotionHook Class ReferenceInterface for connections to remote hosts and hardware devices which should be polled with output values. More...
Inheritance diagram for MotionHook:
Detailed DescriptionInterface for connections to remote hosts and hardware devices which should be polled with output values.
You can expect to be called every FrameTime*NumFrame milliseconds in terms of simulator time. However, keep in mind this is relative to SharedGlobals::timeScale (Config.Speed) in terms of wall-clock time, and is also subject to the simulator being paused, set to full-speed mode, or hitting a breakpoint in the debugger. See enteringRealtime() and leavingRealtime() if you want updates when the user switches simulation modes, although there's still no way to get notification if a debugger breakpoint is hit. Definition at line 23 of file MotionHook.h.
Constructor & Destructor Documentation
constructor Definition at line 36 of file MotionHook.h.
no-op destructor Definition at line 39 of file MotionHook.h. Member Function Documentation
Called when the controller is going to be running in realtime mode, which is probably the normal mode you'd expect. You might be in realtime mode, but a debugger breakpoint will still pause things, or thread scheduling could hiccup, so try to be robust. Reimplemented in CreateDriver, DynamixelDriver, KobukiDriver, SkewlZoneDriver, and SSC32Driver. Definition at line 106 of file MotionHook.h. Referenced by Simulator::plistCollectionEntriesChanged(), Simulator::plistCollectionEntryAdded(), and Simulator::setMotionEnteringRealtime().
Should return true if the MotionHook is successfully connected to physical hardware. If relevant, this will only be called after motionStarting() has been called in order to initialize a connection. This is used mainly to cancel out of the WaitForSensors if all MotionHooks return false. If you are still in the process of connecting or unsure of status, be optimistic and return true. This function will be polled at a coarse rate while blocked on sensors in case of timeouts on the part of the MotionHook render it moot. Implemented in CreateDriver, DynamixelDriver, KobukiDriver, MirageDriver, SkewlZoneDriver, SSC32Driver, and IPCMotionHook. Referenced by Simulator::run().
Called when leaving realtime mode, which means you have no idea when motionCheck() is going to be called in terms of wall-clock time. Argument set to true if entering full speed mode, which may mean motionCheck will be called at a high(er) frequency, or slower the computation is overwhelming the host hardware. However, if false, almost certainly indicates updates will be sparse. May be called multiple times if changing between full-speed mode and paused A non-realtime mode might be triggered if the user wants to pause the simulator/controller to step through something... No guarantees though! The debugger might catch a breakpoint and stop things, and this won't be called! Reimplemented in CreateDriver, DynamixelDriver, KobukiDriver, SkewlZoneDriver, and SSC32Driver. Definition at line 116 of file MotionHook.h. Referenced by Simulator::plistCollectionEntriesChanged(), Simulator::plistCollectionEntryAdded(), Simulator::plistCollectionEntryRemoved(), and Simulator::setMotionLeavingRealtime().
Called each time the motion process has polled active motion commands. When in realtime mode, this should be called every FrameTime*NumFrames (defined in the RobotInfo) milliseconds if running at full speed. See enteringRealtime() and leavingRealtime(). This default implementation checks to see which outputs have changed value since the last call and passes the summary on to motionUpdated(). lastOutputs will be updated with the new values after the call to motionUpdated(). If you need to process all the outputs on every frame, you only need to override this function. Your subclass doesn't need to call the MotionHook implementation unless you want to have lastOutputs updated for you. If you only need to process the changed outputs for each frame, override motionUpdated() instead. motionUpdated() is always called for each update, even if there aren't any changes, so you can still use that if there are some outputs which need to be updated every cycle. Reimplemented in CreateDriver, DynamixelDriver, KobukiDriver, SkewlZoneDriver, SSC32Driver, and IPCMotionHook. Definition at line 69 of file MotionHook.h. Referenced by Simulator::updateMotion().
Called when motion process is starting. Reimplemented in CreateDriver, DynamixelDriver, KobukiDriver, MirageDriver, SkewlZoneDriver, SSC32Driver, and WiiMoteDriver. Definition at line 42 of file MotionHook.h. Referenced by Simulator::plistCollectionEntriesChanged(), Simulator::plistCollectionEntryAdded(), and Simulator::setMotionStarting().
Called when motion process is stopping. Reimplemented in CreateDriver, DynamixelDriver, KobukiDriver, MirageDriver, SkewlZoneDriver, SSC32Driver, and WiiMoteDriver. Definition at line 99 of file MotionHook.h. Referenced by Simulator::plistCollectionEntryRemoved(), and Simulator::setMotionStopping().
Called by motionCheck(), after comparing the new output values to lastOutputs, and before lastOutputs is updated. Override this if you only need to send commands to the hardware for values that have changed. This function is always called for each update, even though changedIndices might be empty. Reimplemented in MirageDriver, and WiiMoteDriver. Definition at line 93 of file MotionHook.h. Referenced by motionCheck().
Called by simulator thread to indicate level of verbosity for diagnostics and reporting errors. Definition at line 119 of file MotionHook.h.
Called when PID values change. Reimplemented in DynamixelDriver, and IPCMotionHook. Definition at line 96 of file MotionHook.h. Referenced by Simulator::updatePIDs(). Member Data Documentation
set to false following the first motionCheck, reset to true by motionStopping Definition at line 125 of file MotionHook.h. Referenced by SSC32Driver::advance(), SSC32Driver::motionCheck(), motionCheck(), and motionStopping().
stores the last frame of the outputs, updated by motionCheck() Definition at line 127 of file MotionHook.h. Referenced by SSC32Driver::motionCheck(), and motionCheck().
stores current verbosity Definition at line 123 of file MotionHook.h. Referenced by SSC32Driver::motionCheck(), CreateDriver::sendCommand(), and setMotionHookVerbose(). The documentation for this class was generated from the following file: |
Tekkotsu Hardware Abstraction Layer 5.1CVS |
Generated Mon May 9 05:01:41 2016 by Doxygen 1.6.3 |