diff --git a/scenarios/GamepadControlUnit/GamepadControlUnit.scx b/scenarios/GamepadControlUnit/GamepadControlUnit.scx new file mode 100644 index 0000000000000000000000000000000000000000..65fb5e9578f7cc759af2a8e3a9460b5fccaaeeb9 --- /dev/null +++ b/scenarios/GamepadControlUnit/GamepadControlUnit.scx @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<scenario name="GamepadControlUnit" lastChange="2017-03-10.11:31:35" creation="2017-03-10.11:31:30" globalConfigName="./config/global.cfg" package="RobotAPI"> + <application name="GamepadControlUnitApp" instance="" package="RobotAPI"/> +</scenario> + diff --git a/scenarios/GamepadControlUnit/config/GamepadControlUnitApp.cfg b/scenarios/GamepadControlUnit/config/GamepadControlUnitApp.cfg new file mode 100644 index 0000000000000000000000000000000000000000..3b8084595a3adb135f9a348bde18abb1d9a22649 --- /dev/null +++ b/scenarios/GamepadControlUnit/config/GamepadControlUnitApp.cfg @@ -0,0 +1,172 @@ +# ================================================================== +# GamepadControlUnitApp properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files +# Attributes: +# - Default: ${HOME}/.armarx/mongo/.cache +# - Case sensitivity: no +# - Required: no +# ArmarX.CachePath = ${HOME}/.armarx/mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: no +# - Required: no +# ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.DisableLogging = 0 + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.EnableProfiling = 0 + + +# ArmarX.GamepadControlUnit.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadControlUnit.EnableProfiling = 0 + + +# ArmarX.GamepadControlUnit.GamepadTopicName: Name of the Gamepad Topic +# Attributes: +# - Default: GamepadValues +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadControlUnit.GamepadTopicName = GamepadValues + + +# ArmarX.GamepadControlUnit.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadControlUnit.MinimumLoggingLevel = Undefined + + +# ArmarX.GamepadControlUnit.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadControlUnit.ObjectName = "" + + +# ArmarX.GamepadControlUnit.PlatformUnitName: Name of the platform unit to use +# Attributes: +# - Default: Armar6IcePlatformUnit +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadControlUnit.PlatformUnitName = Armar6IcePlatformUnit + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: 1 +# - Case sensitivity: no +# - Required: no +# ArmarX.RedirectStdout = 1 + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: no +# - Required: no +# ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.StartDebuggerOnCrash = 0 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.UseTimeServer = 0 + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: no +# - Required: no +# ArmarX.Verbosity = Info + + +# Ice.Config: Custom Property +# Attributes: +# - Default: ::NOT_DEFINED:: +# - Case sensitivity: no +# - Required: no +# Ice.Config = ::NOT_DEFINED:: + + diff --git a/scenarios/GamepadControlUnit/config/global.cfg b/scenarios/GamepadControlUnit/config/global.cfg new file mode 100644 index 0000000000000000000000000000000000000000..63a93840d45c08bf2b7cb8f46f8baff8bb30848e --- /dev/null +++ b/scenarios/GamepadControlUnit/config/global.cfg @@ -0,0 +1,7 @@ +# ================================================================== +# Global Config from Scenario GamepadControlUnit +# ================================================================== + + + + diff --git a/scenarios/GamepadUnit/GamepadUnit.scx b/scenarios/GamepadUnit/GamepadUnit.scx new file mode 100644 index 0000000000000000000000000000000000000000..2efba7e186f770a1dba19d2476bb1ae739283560 --- /dev/null +++ b/scenarios/GamepadUnit/GamepadUnit.scx @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<scenario name="GamepadUnit" lastChange="2017-03-20.19:33:52" creation="2017-03-09.11:59:13" globalConfigName="./config/global.cfg" package="RobotAPI"> + <application name="GamepadUnitApp" instance="" package="RobotAPI"/> + <application name="GamepadUnitObserverApp" instance="" package="RobotAPI"/> + <application name="GamepadControlUnitApp" instance="" package="RobotAPI"/> +</scenario> + diff --git a/scenarios/GamepadUnit/config/GamepadControlUnitApp.cfg b/scenarios/GamepadUnit/config/GamepadControlUnitApp.cfg new file mode 100644 index 0000000000000000000000000000000000000000..2773927c3ee324f8da4a5589bdf3a61955bfa41f --- /dev/null +++ b/scenarios/GamepadUnit/config/GamepadControlUnitApp.cfg @@ -0,0 +1,191 @@ +# ================================================================== +# GamepadControlUnitApp properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files +# Attributes: +# - Default: ${HOME}/.armarx/mongo/.cache +# - Case sensitivity: no +# - Required: no +ArmarX.CachePath = ${HOME}/.armarx/mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: no +# - Required: no +ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +ArmarX.DisableLogging = 0 + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +ArmarX.EnableProfiling = 0 + + +# ArmarX.GamepadControlUnit.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadControlUnit.EnableProfiling = 0 + + +# ArmarX.GamepadControlUnit.GamepadTopicName: Name of the Gamepad Topic +# Attributes: +# - Default: GamepadValues +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadControlUnit.GamepadTopicName = GamepadValues + + +# ArmarX.GamepadControlUnit.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadControlUnit.MinimumLoggingLevel = Undefined + + +# ArmarX.GamepadControlUnit.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadControlUnit.ObjectName = "" + + +# ArmarX.GamepadControlUnit.PlatformUnitName: Name of the platform unit to use +# Attributes: +# - Default: Armar6IcePlatformUnit +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadControlUnit.PlatformUnitName = Armar6IcePlatformUnit + + +# ArmarX.GamepadControlUnit.ScaleAngle: scaling factor in radian per second +# Attributes: +# - Default: 1 +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadControlUnit.ScaleAngle = -1 + + +# ArmarX.GamepadControlUnit.ScaleX: scaling factor in mm per second +# Attributes: +# - Default: 1000 +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadControlUnit.ScaleX = 500 + + +# ArmarX.GamepadControlUnit.ScaleY: scaling factor in mm per second +# Attributes: +# - Default: 1000 +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadControlUnit.ScaleY = -500 + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: 1 +# - Case sensitivity: no +# - Required: no +ArmarX.RedirectStdout = 1 + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: no +# - Required: no +ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +ArmarX.StartDebuggerOnCrash = 0 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +ArmarX.UseTimeServer = 0 + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: no +# - Required: no +ArmarX.Verbosity = Info + + + + + diff --git a/scenarios/GamepadUnit/config/GamepadUnitApp.cfg b/scenarios/GamepadUnit/config/GamepadUnitApp.cfg new file mode 100644 index 0000000000000000000000000000000000000000..d30f64a82a57fbeee68ffb22fff372adb32e50ac --- /dev/null +++ b/scenarios/GamepadUnit/config/GamepadUnitApp.cfg @@ -0,0 +1,167 @@ +# ================================================================== +# GamepadUnitApp properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files +# Attributes: +# - Default: ${HOME}/.armarx/mongo/.cache +# - Case sensitivity: no +# - Required: no +# ArmarX.CachePath = ${HOME}/.armarx/mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: no +# - Required: no +# ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.DisableLogging = 0 + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.EnableProfiling = 0 + + +# ArmarX.GamepadUnit.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnit.EnableProfiling = 0 + + +# ArmarX.GamepadUnit.GamepadDeviceName: device that will be opened as a gamepad +# Attributes: +# - Default: /dev/input/js2 +# - Case sensitivity: no +# - Required: no +ArmarX.GamepadUnit.GamepadDeviceName = /dev/input/js0 + + +# ArmarX.GamepadUnit.GamepadTopicName: Name of the Gamepad Topic +# Attributes: +# - Default: GamepadValues +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnit.GamepadTopicName = GamepadValues + + +# ArmarX.GamepadUnit.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnit.MinimumLoggingLevel = Undefined + + +# ArmarX.GamepadUnit.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnit.ObjectName = "" + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: 1 +# - Case sensitivity: no +# - Required: no +# ArmarX.RedirectStdout = 1 + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: no +# - Required: no +# ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.StartDebuggerOnCrash = 0 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.UseTimeServer = 0 + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: no +# - Required: no +# ArmarX.Verbosity = Info + + + + + diff --git a/scenarios/GamepadUnit/config/GamepadUnitObserverApp.cfg b/scenarios/GamepadUnit/config/GamepadUnitObserverApp.cfg new file mode 100644 index 0000000000000000000000000000000000000000..27e3b329d9da2b63b3aae94b4dac95ea7ec55c4a --- /dev/null +++ b/scenarios/GamepadUnit/config/GamepadUnitObserverApp.cfg @@ -0,0 +1,183 @@ +# ================================================================== +# GamepadUnitObserverApp properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files +# Attributes: +# - Default: ${HOME}/.armarx/mongo/.cache +# - Case sensitivity: no +# - Required: no +# ArmarX.CachePath = ${HOME}/.armarx/mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: no +# - Required: no +# ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.DisableLogging = 0 + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.EnableProfiling = 0 + + +# ArmarX.GamepadUnitObserver.DebugDrawerTopic: Name of the DebugDrawerTopic +# Attributes: +# - Default: DebugDrawerUpdates +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnitObserver.DebugDrawerTopic = DebugDrawerUpdates + + +# ArmarX.GamepadUnitObserver.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnitObserver.EnableProfiling = 0 + + +# ArmarX.GamepadUnitObserver.GamepadTopicName: Name of the Gamepad Topic +# Attributes: +# - Default: GamepadValues +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnitObserver.GamepadTopicName = GamepadValues + + +# ArmarX.GamepadUnitObserver.MaxHistoryRecordFrequency: The Observer history is written with this maximum frequency. Everything faster is being skipped. +# Attributes: +# - Default: 50 +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnitObserver.MaxHistoryRecordFrequency = 50 + + +# ArmarX.GamepadUnitObserver.MaxHistorySize: Maximum number of entries in the Observer history +# Attributes: +# - Default: 5000 +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnitObserver.MaxHistorySize = 5000 + + +# ArmarX.GamepadUnitObserver.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnitObserver.MinimumLoggingLevel = Undefined + + +# ArmarX.GamepadUnitObserver.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.GamepadUnitObserver.ObjectName = "" + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: 1 +# - Case sensitivity: no +# - Required: no +# ArmarX.RedirectStdout = 1 + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: no +# - Required: no +# ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.StartDebuggerOnCrash = 0 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.UseTimeServer = 0 + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: no +# - Required: no +# ArmarX.Verbosity = Info + + + + + diff --git a/scenarios/GamepadUnit/config/global.cfg b/scenarios/GamepadUnit/config/global.cfg new file mode 100644 index 0000000000000000000000000000000000000000..887b1b11ae6ed26dd58ab544801bfe93bda04422 --- /dev/null +++ b/scenarios/GamepadUnit/config/global.cfg @@ -0,0 +1,7 @@ +# ================================================================== +# Global Config from Scenario GamepadUnit +# ================================================================== + + + + diff --git a/source/RobotAPI/applications/CMakeLists.txt b/source/RobotAPI/applications/CMakeLists.txt index bf014d1e57376f3b1d8b369bd654fcfbdfefe863..a0b259ba1c6dd4e5339dc390f5e6de6e3a138a5e 100644 --- a/source/RobotAPI/applications/CMakeLists.txt +++ b/source/RobotAPI/applications/CMakeLists.txt @@ -24,9 +24,11 @@ add_subdirectory(ViewSelection) add_subdirectory(HokuyoLaserUnit) add_subdirectory(LaserScannerUnitObserver) - add_subdirectory(OrientedTactileSensorUnit) add_subdirectory(OrientedTactileSensorUnitObserver) add_subdirectory(OptoForceUnit) -add_subdirectory(OptoForceUnitObserver) \ No newline at end of file +add_subdirectory(OptoForceUnitObserver) +add_subdirectory(GamepadUnit) +add_subdirectory(GamepadUnitObserver) +add_subdirectory(GamepadControlUnit) \ No newline at end of file diff --git a/source/RobotAPI/applications/GamepadControlUnit/CMakeLists.txt b/source/RobotAPI/applications/GamepadControlUnit/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..350d81c8d49983e6715352eaf358d1bf9091f698 --- /dev/null +++ b/source/RobotAPI/applications/GamepadControlUnit/CMakeLists.txt @@ -0,0 +1,20 @@ +armarx_component_set_name("GamepadControlUnitApp") + +#find_package(MyLib QUIET) +#armarx_build_if(MyLib_FOUND "MyLib not available") +# +# all include_directories must be guarded by if(Xyz_FOUND) +# for multiple libraries write: if(X_FOUND AND Y_FOUND).... +#if(MyLib_FOUND) +# include_directories(${MyLib_INCLUDE_DIRS}) +#endif() + +set(COMPONENT_LIBS + ArmarXCoreInterfaces + ArmarXCore + GamepadControlUnit +) + +set(EXE_SOURCE main.cpp) + +armarx_add_component_executable("${EXE_SOURCE}") diff --git a/source/RobotAPI/applications/GamepadControlUnit/main.cpp b/source/RobotAPI/applications/GamepadControlUnit/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a2c5a7e4296a36c3012bbd7bb720120ef3e72c3d --- /dev/null +++ b/source/RobotAPI/applications/GamepadControlUnit/main.cpp @@ -0,0 +1,32 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::application::GamepadControlUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include <RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h> + +#include <ArmarXCore/core/application/Application.h> +#include <ArmarXCore/core/Component.h> +#include <ArmarXCore/core/logging/Logging.h> + +int main(int argc, char* argv[]) +{ + return armarx::runSimpleComponentApp < armarx::GamepadControlUnit > (argc, argv, "GamepadControlUnit"); +} diff --git a/source/RobotAPI/applications/GamepadUnit/CMakeLists.txt b/source/RobotAPI/applications/GamepadUnit/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..872a8d4bf5d9199150c5d2eab9af6c6645c2a918 --- /dev/null +++ b/source/RobotAPI/applications/GamepadUnit/CMakeLists.txt @@ -0,0 +1,20 @@ +armarx_component_set_name("GamepadUnitApp") + +#find_package(MyLib QUIET) +#armarx_build_if(MyLib_FOUND "MyLib not available") +# +# all include_directories must be guarded by if(Xyz_FOUND) +# for multiple libraries write: if(X_FOUND AND Y_FOUND).... +#if(MyLib_FOUND) +# include_directories(${MyLib_INCLUDE_DIRS}) +#endif() + +set(COMPONENT_LIBS + ArmarXCoreInterfaces + ArmarXCore + GamepadUnit +) + +set(EXE_SOURCE main.cpp) + +armarx_add_component_executable("${EXE_SOURCE}") diff --git a/source/RobotAPI/applications/GamepadUnit/main.cpp b/source/RobotAPI/applications/GamepadUnit/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ec81535eb54772ade3b176f8d0842aa7dabc3b14 --- /dev/null +++ b/source/RobotAPI/applications/GamepadUnit/main.cpp @@ -0,0 +1,32 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::application::GamepadUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include <RobotAPI/drivers/GamepadUnit/GamepadUnit.h> + +#include <ArmarXCore/core/application/Application.h> +#include <ArmarXCore/core/Component.h> +#include <ArmarXCore/core/logging/Logging.h> + +int main(int argc, char* argv[]) +{ + return armarx::runSimpleComponentApp < armarx::GamepadUnit > (argc, argv, "GamepadUnit"); +} diff --git a/source/RobotAPI/applications/GamepadUnitObserver/CMakeLists.txt b/source/RobotAPI/applications/GamepadUnitObserver/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4054e905323788be9fb171b6bedc53e5c5ed5fa3 --- /dev/null +++ b/source/RobotAPI/applications/GamepadUnitObserver/CMakeLists.txt @@ -0,0 +1,20 @@ +armarx_component_set_name("GamepadUnitObserverApp") + +#find_package(MyLib QUIET) +#armarx_build_if(MyLib_FOUND "MyLib not available") +# +# all include_directories must be guarded by if(Xyz_FOUND) +# for multiple libraries write: if(X_FOUND AND Y_FOUND).... +#if(MyLib_FOUND) +# include_directories(${MyLib_INCLUDE_DIRS}) +#endif() + +set(COMPONENT_LIBS + ArmarXCoreInterfaces + ArmarXCore + RobotAPIUnits +) + +set(EXE_SOURCE main.cpp) + +armarx_add_component_executable("${EXE_SOURCE}") diff --git a/source/RobotAPI/applications/GamepadUnitObserver/main.cpp b/source/RobotAPI/applications/GamepadUnitObserver/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3cf8db15df21ea270e29f6c09f5a55358cc0b876 --- /dev/null +++ b/source/RobotAPI/applications/GamepadUnitObserver/main.cpp @@ -0,0 +1,32 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::application::GamepadUnitObserver + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include <RobotAPI/components/units/GamepadUnitObserver.h> + +#include <ArmarXCore/core/application/Application.h> +#include <ArmarXCore/core/Component.h> +#include <ArmarXCore/core/logging/Logging.h> + +int main(int argc, char* argv[]) +{ + return armarx::runSimpleComponentApp < armarx::GamepadUnitObserver > (argc, argv, "GamepadUnitObserver"); +} diff --git a/source/RobotAPI/components/CMakeLists.txt b/source/RobotAPI/components/CMakeLists.txt index 09e360143f92067237016c1c5a6469a759d79ded..34d20721211360b9ae6ff8d53be9827537cdc4f6 100644 --- a/source/RobotAPI/components/CMakeLists.txt +++ b/source/RobotAPI/components/CMakeLists.txt @@ -4,3 +4,5 @@ add_subdirectory(RobotState) add_subdirectory(EarlyVisionGraph) add_subdirectory(ViewSelection) + +add_subdirectory(GamepadControlUnit) \ No newline at end of file diff --git a/source/RobotAPI/components/GamepadControlUnit/CMakeLists.txt b/source/RobotAPI/components/GamepadControlUnit/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b78b5d099502863dd04939d761be6d745c36a5bb --- /dev/null +++ b/source/RobotAPI/components/GamepadControlUnit/CMakeLists.txt @@ -0,0 +1,26 @@ +armarx_component_set_name("GamepadControlUnit") + +#find_package(MyLib QUIET) +#armarx_build_if(MyLib_FOUND "MyLib not available") +# +# all include_directories must be guarded by if(Xyz_FOUND) +# for multiple libraries write: if(X_FOUND AND Y_FOUND).... +#if(MyLib_FOUND) +# include_directories(${MyLib_INCLUDE_DIRS}) +#endif() + +set(COMPONENT_LIBS ArmarXCoreInterfaces ArmarXCore ArmarXCoreObservers RobotAPIInterfaces ) + +set(SOURCES +./GamepadControlUnit.cpp +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.cpp +) +set(HEADERS +./GamepadControlUnit.h +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.h +) + +armarx_add_component("${SOURCES}" "${HEADERS}") + +# add unit tests +add_subdirectory(test) diff --git a/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.cpp b/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d29b0a42699884b5f5d1aba07e5c534269030cf --- /dev/null +++ b/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.cpp @@ -0,0 +1,76 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::GamepadControlUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "GamepadControlUnit.h" + +#include <ArmarXCore/observers/variant/TimestampVariant.h> + + + +using namespace armarx; + + +void GamepadControlUnit::onInitComponent() +{ + ARMARX_INFO << "oninit GamepadControlUnit"; + usingProxy(getProperty<std::string>("PlatformUnitName").getValue()); + usingTopic(getProperty<std::string>("GamepadTopicName").getValue()); + + + scaleX = getProperty<float>("ScaleX").getValue(); + scaleY = getProperty<float>("ScaleY").getValue(); + scaleRotation = getProperty<float>("ScaleAngle").getValue(); + ARMARX_INFO << "oninit GamepadControlUnit end"; +} + + +void GamepadControlUnit::onConnectComponent() +{ + ARMARX_INFO << "onConnect GamepadControlUnit"; + platformUnitPrx = getProxy<PlatformUnitInterfacePrx>(getProperty<std::string>("PlatformUnitName").getValue()); +} + + +void GamepadControlUnit::onDisconnectComponent() +{ + +} + + +void GamepadControlUnit::onExitComponent() +{ + ARMARX_INFO << "exit GamepadControlUnit"; +} + +armarx::PropertyDefinitionsPtr GamepadControlUnit::createPropertyDefinitions() +{ + return armarx::PropertyDefinitionsPtr(new GamepadControlUnitPropertyDefinitions( + getConfigIdentifier())); +} + +void GamepadControlUnit::reportGamepadState(const std::string& device, const std::string& name, const GamepadData& data, const TimestampBasePtr& timestamp, const Ice::Current& c) +{ + //scales are for the robot axis + platformUnitPrx->move(data.leftStickY * scaleX, data. leftStickX * scaleY, data.rightStickX * scaleRotation); + //ARMARX_INFO << "sending targets" << data.leftStickX* scaleX << " " << data.leftStickY* scaleY << " " << data.rightStickX* scaleRotation; +} + diff --git a/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h b/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h new file mode 100644 index 0000000000000000000000000000000000000000..a4b0f6c99f16afbc02e60b80f178ec91d6267ce5 --- /dev/null +++ b/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h @@ -0,0 +1,117 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::GamepadControlUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_COMPONENT_RobotAPI_GamepadControlUnit_H +#define _ARMARX_COMPONENT_RobotAPI_GamepadControlUnit_H + + +#include <ArmarXCore/core/Component.h> + +#include <RobotAPI/interface/units/GamepadUnit.h> + +namespace armarx +{ + /** + * @class GamepadControlUnitPropertyDefinitions + * @brief + */ + class GamepadControlUnitPropertyDefinitions: + public armarx::ComponentPropertyDefinitions + { + public: + GamepadControlUnitPropertyDefinitions(std::string prefix): + armarx::ComponentPropertyDefinitions(prefix) + { + //defineRequiredProperty<std::string>("PropertyName", "Description"); + //defineOptionalProperty<std::string>("PropertyName", "DefaultValue", "Description"); + defineOptionalProperty<std::string>("PlatformUnitName", "Armar6IcePlatformUnit", "Name of the platform unit to use"); + defineOptionalProperty<std::string>("GamepadTopicName", "GamepadValues", "Name of the Gamepad Topic"); + defineOptionalProperty<float>("ScaleX", 1000.0f, "scaling factor in mm per second"); + defineOptionalProperty<float>("ScaleY", 1000.0f, "scaling factor in mm per second"); + defineOptionalProperty<float>("ScaleAngle", 1.0f, "scaling factor in radian per second"); + } + }; + + /** + * @defgroup Component-GamepadControlUnit GamepadControlUnit + * @ingroup RobotAPI-Components + * A description of the component GamepadControlUnit. + * + * @class GamepadControlUnit + * @ingroup Component-GamepadControlUnit + * @brief Brief description of class GamepadControlUnit. + * + * Detailed description of class GamepadControlUnit. + */ + class GamepadControlUnit : + virtual public armarx::Component, + virtual public GamepadUnitListener + { + public: + /** + * @see armarx::ManagedIceObject::getDefaultName() + */ + virtual std::string getDefaultName() const + { + return "GamepadControlUnit"; + } + + protected: + /** + * @see armarx::ManagedIceObject::onInitComponent() + */ + virtual void onInitComponent(); + + /** + * @see armarx::ManagedIceObject::onConnectComponent() + */ + virtual void onConnectComponent(); + + /** + * @see armarx::ManagedIceObject::onDisconnectComponent() + */ + virtual void onDisconnectComponent(); + + /** + * @see armarx::ManagedIceObject::onExitComponent() + */ + virtual void onExitComponent(); + + /** + * @see PropertyUser::createPropertyDefinitions() + */ + virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions(); + + private: + PlatformUnitInterfacePrx platformUnitPrx; + float scaleX; + float scaleY; + float scaleRotation; + + public: + void reportGamepadState(const std::string& device, const std::string& name, const GamepadData& data, + const TimestampBasePtr& timestamp, const Ice::Current& c) override; + + }; +} + +#endif diff --git a/source/RobotAPI/components/GamepadControlUnit/test/CMakeLists.txt b/source/RobotAPI/components/GamepadControlUnit/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c79f86b6ad42bf2e1318560e8414d52be98057ed --- /dev/null +++ b/source/RobotAPI/components/GamepadControlUnit/test/CMakeLists.txt @@ -0,0 +1,5 @@ + +# Libs required for the tests +SET(LIBS ${LIBS} ArmarXCore GamepadControlUnit) + +armarx_add_test(GamepadControlUnitTest GamepadControlUnitTest.cpp "${LIBS}") \ No newline at end of file diff --git a/source/RobotAPI/components/GamepadControlUnit/test/GamepadControlUnitTest.cpp b/source/RobotAPI/components/GamepadControlUnit/test/GamepadControlUnitTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c5a6caa4e4d4cecf3f707750164a6a0f9826e025 --- /dev/null +++ b/source/RobotAPI/components/GamepadControlUnit/test/GamepadControlUnitTest.cpp @@ -0,0 +1,37 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::GamepadControlUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#define BOOST_TEST_MODULE RobotAPI::ArmarXObjects::GamepadControlUnit + +#define ARMARX_BOOST_TEST + +#include <RobotAPI/Test.h> +#include <RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h> + +#include <iostream> + +BOOST_AUTO_TEST_CASE(testExample) +{ + armarx::GamepadControlUnit instance; + + BOOST_CHECK_EQUAL(true, true); +} diff --git a/source/RobotAPI/components/units/CMakeLists.txt b/source/RobotAPI/components/units/CMakeLists.txt index 0608c7c1b30df78dc00e91b8bd13c7cf1542d8e2..46c0b32ee4f4f9b85f253cf93b493524960d9670 100644 --- a/source/RobotAPI/components/units/CMakeLists.txt +++ b/source/RobotAPI/components/units/CMakeLists.txt @@ -35,6 +35,7 @@ set(LIB_HEADERS LaserScannerUnitObserver.h OptoForceUnitObserver.h OrientedTactileSensorUnitObserver.h + GamepadUnitObserver.h TCPControlUnit.h TCPControlUnitObserver.h @@ -63,6 +64,7 @@ set(LIB_FILES LaserScannerUnitObserver.cpp OptoForceUnitObserver.cpp OrientedTactileSensorUnitObserver.cpp + GamepadUnitObserver.cpp TCPControlUnit.cpp TCPControlUnitObserver.cpp diff --git a/source/RobotAPI/components/units/GamepadUnitObserver.cpp b/source/RobotAPI/components/units/GamepadUnitObserver.cpp new file mode 100644 index 0000000000000000000000000000000000000000..437648beec8d783aab61b99a424537e0b6a548ee --- /dev/null +++ b/source/RobotAPI/components/units/GamepadUnitObserver.cpp @@ -0,0 +1,111 @@ +/* + * This file is part of ArmarX. + * + * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package + * @author + * @date + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ +#include "GamepadUnitObserver.h" + + +#include <ArmarXCore/observers/checks/ConditionCheckEquals.h> +#include <ArmarXCore/observers/checks/ConditionCheckLarger.h> +#include <ArmarXCore/observers/checks/ConditionCheckSmaller.h> +#include <ArmarXCore/observers/checks/ConditionCheckUpdated.h> + +#include <RobotAPI/libraries/core/Pose.h> + +#include <ArmarXCore/observers/variant/TimestampVariant.h> + + + +using namespace armarx; + + +void GamepadUnitObserver::onInitObserver() +{ + usingTopic(getProperty<std::string>("GamepadTopicName").getValue()); + + offerConditionCheck("updated", new ConditionCheckUpdated()); + offerConditionCheck("larger", new ConditionCheckLarger()); + offerConditionCheck("equals", new ConditionCheckEquals()); + offerConditionCheck("smaller", new ConditionCheckSmaller()); + + offeringTopic(getProperty<std::string>("DebugDrawerTopic").getValue()); +} + + + +void GamepadUnitObserver::onConnectObserver() +{ + debugDrawerPrx = getTopic<DebugDrawerInterfacePrx>(getProperty<std::string>("DebugDrawerTopic").getValue()); +} + + +void GamepadUnitObserver::onExitObserver() +{ + debugDrawerPrx->removePoseVisu("IMU", "orientation"); + debugDrawerPrx->removeLineVisu("IMU", "acceleration"); +} + + +PropertyDefinitionsPtr GamepadUnitObserver::createPropertyDefinitions() +{ + return PropertyDefinitionsPtr(new GamepadUnitObserverPropertyDefinitions(getConfigIdentifier())); +} + +void GamepadUnitObserver::reportGamepadState(const std::string& device, const std::string& name, const GamepadData& data, const TimestampBasePtr& timestamp, const Ice::Current& c) +{ + ScopedLock lock(dataMutex); + + TimestampVariantPtr timestampPtr = TimestampVariantPtr::dynamicCast(timestamp); + + if (!existsChannel(device)) + { + offerChannel(device, "Gamepad data"); + } + + //ARMARX_IMPORTANT << deactivateSpam(1) << "observed " << device << " with name " << name; + + //axis + offerOrUpdateDataField(device, "leftStickX", Variant(data.leftStickX), "X value of the left analog stick"); + offerOrUpdateDataField(device, "leftStickY", Variant(data.leftStickY), "Y value of the left analog stick"); + offerOrUpdateDataField(device, "rightStickX", Variant(data.rightStickX), "X value of the right analog stick"); + offerOrUpdateDataField(device, "rightStickY", Variant(data.rightStickY), "Y value of the right analog stick"); + offerOrUpdateDataField(device, "dPadX", Variant(data.dPadX), "X value of the digital pad"); + offerOrUpdateDataField(device, "dPadY", Variant(data.dPadY), "y value of the digital pad"); + offerOrUpdateDataField(device, "leftTrigger", Variant(data.leftTrigger), "value of the left analog trigger"); + offerOrUpdateDataField(device, "rightTrigger", Variant(data.rightTrigger), "value of the right analog trigger"); + //buttons + offerOrUpdateDataField(device, "aButton", Variant(data.aButton), "A button pressed"); + offerOrUpdateDataField(device, "backButton", Variant(data.backButton), "Back button pressed"); + offerOrUpdateDataField(device, "bButton", Variant(data.bButton), "B button pressed"); + offerOrUpdateDataField(device, "leftButton", Variant(data.leftButton), "Left shoulder button pressed"); + offerOrUpdateDataField(device, "leftStickButton", Variant(data.leftStickButton), "Left stick button pressed"); + offerOrUpdateDataField(device, "rightButton", Variant(data.rightButton), "Right shoulder button pressed"); + offerOrUpdateDataField(device, "rightStickButton", Variant(data.rightStickButton), "Right stick button pressed"); + offerOrUpdateDataField(device, "startButton", Variant(data.startButton), "Start button pressed"); + offerOrUpdateDataField(device, "theMiddleButton", Variant(data.theMiddleButton), "The middle button pressed"); + offerOrUpdateDataField(device, "xButton", Variant(data.xButton), "X button pressed"); + offerOrUpdateDataField(device, "yButton", Variant(data.yButton), "Y button pressed"); + + updateChannel(device); +} + + diff --git a/source/RobotAPI/components/units/GamepadUnitObserver.h b/source/RobotAPI/components/units/GamepadUnitObserver.h new file mode 100644 index 0000000000000000000000000000000000000000..0120cfc09547d6b75c211fbd169b452fe729b4d8 --- /dev/null +++ b/source/RobotAPI/components/units/GamepadUnitObserver.h @@ -0,0 +1,93 @@ +/* + * This file is part of ArmarX. + * + * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::units + * @author David Schiebener <schiebener at kit dot edu> + * @date 2014 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_ROBOTAPI_GAMEPAD_OBSERVER_H +#define _ARMARX_ROBOTAPI_GAMEPAD_OBSERVER_H + +#include <RobotAPI/interface/units/GamepadUnit.h> +#include <ArmarXCore/observers/Observer.h> +#include <RobotAPI/interface/visualization/DebugDrawerInterface.h> +#include <RobotAPI/libraries/core/Pose.h> + + +namespace armarx +{ + /** + * \class GamepadUnitObserverPropertyDefinitions + * \brief + */ + class GamepadUnitObserverPropertyDefinitions: + public ObserverPropertyDefinitions + { + public: + GamepadUnitObserverPropertyDefinitions(std::string prefix): + ObserverPropertyDefinitions(prefix) + { + defineOptionalProperty<std::string>("GamepadTopicName", "GamepadValues", "Name of the Gamepad Topic"); + defineOptionalProperty<std::string>("DebugDrawerTopic", "DebugDrawerUpdates", "Name of the DebugDrawerTopic"); + } + }; + + + /** + * \class GamepadUnitObserver + * \ingroup RobotAPI-SensorActorUnits-observers + * \brief Observer monitoring @IMU sensor values + * + * The GamepadUnitObserver monitors @IMU sensor values published by GamepadUnit-implementations and offers condition checks on these values. + * Available condition checks are: *updated*, *larger*, *equals* and *smaller*. + */ + class GamepadUnitObserver : + virtual public Observer, + virtual public GamepadUnitObserverInterface + { + public: + GamepadUnitObserver() {} + + virtual std::string getDefaultName() const + { + return "GamepadUnitObserver"; + } + virtual void onInitObserver(); + virtual void onConnectObserver(); + virtual void onExitObserver(); + + /** + * @see PropertyUser::createPropertyDefinitions() + */ + virtual PropertyDefinitionsPtr createPropertyDefinitions(); + + + private: + Mutex dataMutex; + DebugDrawerInterfacePrx debugDrawerPrx; + + + // GamepadUnitListener interface + public: + void reportGamepadState(const std::string& device, const std::string& name, const GamepadData& data, const TimestampBasePtr& timestamp, const Ice::Current& c); + }; +} + +#endif diff --git a/source/RobotAPI/drivers/CMakeLists.txt b/source/RobotAPI/drivers/CMakeLists.txt index 54b6eb0980c9a369739a0470715e74d2c7a8f71f..b2807bcf363219b251eefa62ac8455ce51761664 100644 --- a/source/RobotAPI/drivers/CMakeLists.txt +++ b/source/RobotAPI/drivers/CMakeLists.txt @@ -3,4 +3,5 @@ add_subdirectory(XsensIMU) add_subdirectory(HokuyoLaserUnit) add_subdirectory(OptoForceUnit) add_subdirectory(OrientedTactileSensor) +add_subdirectory(GamepadUnit) diff --git a/source/RobotAPI/drivers/GamepadUnit/CMakeLists.txt b/source/RobotAPI/drivers/GamepadUnit/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..bef4ab3ed50a56d19b1c067f2c785eb6de6fee04 --- /dev/null +++ b/source/RobotAPI/drivers/GamepadUnit/CMakeLists.txt @@ -0,0 +1,27 @@ +armarx_component_set_name("GamepadUnit") + +#find_package(MyLib QUIET) +#armarx_build_if(MyLib_FOUND "MyLib not available") +# +# all include_directories must be guarded by if(Xyz_FOUND) +# for multiple libraries write: if(X_FOUND AND Y_FOUND).... +#if(MyLib_FOUND) +# include_directories(${MyLib_INCLUDE_DIRS}) +#endif() + +set(COMPONENT_LIBS ArmarXCoreInterfaces ArmarXCore ArmarXCoreEigen3Variants RobotAPIInterfaces) + +set(SOURCES +./GamepadUnit.cpp +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.cpp +) +set(HEADERS +./Joystick.h +./GamepadUnit.h +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.h +) + +armarx_add_component("${SOURCES}" "${HEADERS}") + +# add unit tests +add_subdirectory(test) diff --git a/source/RobotAPI/drivers/GamepadUnit/GamepadUnit.cpp b/source/RobotAPI/drivers/GamepadUnit/GamepadUnit.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a840e0c0663fdc3746f717712a8cc98edd73f423 --- /dev/null +++ b/source/RobotAPI/drivers/GamepadUnit/GamepadUnit.cpp @@ -0,0 +1,123 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::GamepadUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "GamepadUnit.h" + +#include <ArmarXCore/observers/variant/TimestampVariant.h> +#include <linux/joystick.h> + +using namespace armarx; + +void GamepadUnit::onInitComponent() +{ + offeringTopic(getProperty<std::string>("GamepadTopicName").getValue()); + deviceName = getProperty<std::string>("GamepadDeviceName").getValue(); + readTask = new RunningTask<GamepadUnit>(this, &GamepadUnit::run, "GamepadUnit"); +} + +void GamepadUnit::onConnectComponent() +{ + topicPrx = getTopic<GamepadUnitListenerPrx>(getProperty<std::string>("GamepadTopicName").getValue()); + if (js.open(deviceName)) + { + ARMARX_INFO << "opened a gamepad named " << js.name << " with " << js.numberOfAxis << " axis and " << js.numberOfButtons << " buttons."; + if (js.numberOfAxis == 8 && js.numberOfButtons == 11) + { + readTask->start(); + } + else + { + ARMARX_WARNING << "this is not our trusty logitech gamepad you moron."; + } + } + else + { + ARMARX_WARNING << "Could not open gamepad device " << deviceName; + } +} + +void GamepadUnit::run() +{ + while (readTask->isRunning()) + { + GamepadData data; + + if (!js.pollEvent()) + { + ARMARX_WARNING << "failed to read gamepad data"; + break; + } + + IceUtil::Time now = IceUtil::Time::now(); + TimestampVariantPtr nowTimestamp = new TimestampVariant(now); + + //mapping found with command line tool jstest <device file> + + float axisFactor = 1.0f / 32768.f; + + data.leftStickY = js.axis[0] * axisFactor; + data.leftStickX = js.axis[1] * axisFactor; + data.rightStickX = js.axis[3] * axisFactor; + data.rightStickY = js.axis[4] * axisFactor; + data.dPadX = js.axis[7] * axisFactor; + data.dPadY = js.axis[6] * axisFactor; + data.leftTrigger = js.axis[2] * axisFactor; + data.rightTrigger = js.axis[5] * axisFactor; + + data.leftButton = js.buttonsPressed[4]; + data.rightButton = js.buttonsPressed[5]; + data.backButton = js.buttonsPressed[6]; + data.startButton = js.buttonsPressed[7]; + data.xButton = js.buttonsPressed[2]; + data.yButton = js.buttonsPressed[3]; + data.aButton = js.buttonsPressed[0]; + data.bButton = js.buttonsPressed[1]; + data.theMiddleButton = js.buttonsPressed[8]; + data.leftStickButton = js.buttonsPressed[9]; + data.rightStickButton = js.buttonsPressed[10]; + + ARMARX_IMPORTANT << "left x (integer): " << js.axis[0] << " left x (float): " << data.leftStickX; + + topicPrx->reportGamepadState(deviceName, js.name, data, nowTimestamp); + + //usleep(1000); // 10ms + } +} + + +void GamepadUnit::onDisconnectComponent() +{ + +} + + +void GamepadUnit::onExitComponent() +{ + +} + +armarx::PropertyDefinitionsPtr GamepadUnit::createPropertyDefinitions() +{ + return armarx::PropertyDefinitionsPtr(new GamepadUnitPropertyDefinitions( + getConfigIdentifier())); +} + diff --git a/source/RobotAPI/drivers/GamepadUnit/GamepadUnit.h b/source/RobotAPI/drivers/GamepadUnit/GamepadUnit.h new file mode 100644 index 0000000000000000000000000000000000000000..96be5c1233d40a28b5c68f4c7358237132444419 --- /dev/null +++ b/source/RobotAPI/drivers/GamepadUnit/GamepadUnit.h @@ -0,0 +1,116 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::GamepadUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_COMPONENT_RobotAPI_GamepadUnit_H +#define _ARMARX_COMPONENT_RobotAPI_GamepadUnit_H + +#include<linux/joystick.h> +#include<sys/stat.h> +#include<fcntl.h> + +#include <ArmarXCore/core/Component.h> + +#include <ArmarXCore/core/services/tasks/RunningTask.h> + +#include <RobotAPI/interface/units/GamepadUnit.h> + +#include "Joystick.h" + +namespace armarx +{ + /** + * @class GamepadUnitPropertyDefinitions + * @brief + */ + class GamepadUnitPropertyDefinitions: + public armarx::ComponentPropertyDefinitions + { + public: + GamepadUnitPropertyDefinitions(std::string prefix): + armarx::ComponentPropertyDefinitions(prefix) + { + //defineRequiredProperty<std::string>("PropertyName", "Description"); + //defineOptionalProperty<std::string>("PropertyName", "DefaultValue", "Description"); + defineOptionalProperty<std::string>("GamepadTopicName", "GamepadValues", "Name of the Gamepad Topic"); + defineOptionalProperty<std::string>("GamepadDeviceName", "/dev/input/js2", "device that will be opened as a gamepad"); + } + }; + + /** + * @defgroup Component-GamepadUnit GamepadUnit + * @ingroup RobotAPI-Components + * A description of the component GamepadUnit. + * + * @class GamepadUnit + * @ingroup Component-GamepadUnit + * @brief Brief description of class GamepadUnit. + * + * Detailed description of class GamepadUnit. + */ + class GamepadUnit : + virtual public armarx::Component + { + public: + /** + * @see armarx::ManagedIceObject::getDefaultName() + */ + virtual std::string getDefaultName() const + { + return "GamepadUnit"; + } + + protected: + /** + * @see armarx::ManagedIceObject::onInitComponent() + */ + virtual void onInitComponent(); + + /** + * @see armarx::ManagedIceObject::onConnectComponent() + */ + virtual void onConnectComponent(); + + /** + * @see armarx::ManagedIceObject::onDisconnectComponent() + */ + virtual void onDisconnectComponent(); + + /** + * @see armarx::ManagedIceObject::onExitComponent() + */ + virtual void onExitComponent(); + + /** + * @see PropertyUser::createPropertyDefinitions() + */ + virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions(); + + private: + GamepadUnitListenerPrx topicPrx; + RunningTask<GamepadUnit>::pointer_type readTask; + void run(); + std::string deviceName; + Joystick js; + }; +} + +#endif diff --git a/source/RobotAPI/drivers/GamepadUnit/Joystick.h b/source/RobotAPI/drivers/GamepadUnit/Joystick.h new file mode 100644 index 0000000000000000000000000000000000000000..e8e3e4e7d9ab221b45abc72cef9c9d3761e99b81 --- /dev/null +++ b/source/RobotAPI/drivers/GamepadUnit/Joystick.h @@ -0,0 +1,94 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::GamepadUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_COMPONENT_RobotAPI_Joystick_H +#define _ARMARX_COMPONENT_RobotAPI_Joystick_H + +#include<linux/joystick.h> +#include<sys/stat.h> +#include<fcntl.h> + +#include <ArmarXCore/core/Component.h> + +namespace armarx +{ + + class Joystick + { + + private: + int fd = -1; + js_event event; + + public: + + std::vector<int16_t> axis; + std::vector<bool> buttonsPressed; + int numberOfAxis; + int numberOfButtons; + std::string name; + + bool open(std::string const& deviceName) + { + fd = ::open(deviceName.c_str(), O_RDONLY); + if (fd != -1) + { + ioctl(fd, JSIOCGAXES, &numberOfAxis); + ioctl(fd, JSIOCGBUTTONS, &numberOfButtons); + name.resize(255); + ioctl(fd, JSIOCGNAME(255), &name[0]); + axis.resize(numberOfAxis, 0); + name = name.c_str(); + buttonsPressed.resize(numberOfButtons, false); + } + return fd != -1; + } + + bool pollEvent() + { + int bytes = read(fd, &event, sizeof(event)); + + // NOTE if this condition is not met, we're probably out of sync and this + // Joystick instance is likely unusable + if (bytes == -1 || bytes != sizeof(event)) + { + return false; + } + + if (event.type & JS_EVENT_BUTTON) + { + buttonsPressed[event.number] = event.value != 0; + } + else if (event.type & JS_EVENT_AXIS) + { + axis[event.number] = event.value; + } + return true; + } + + void close() + { + ::close(fd); + } + }; +} +#endif diff --git a/source/RobotAPI/drivers/GamepadUnit/test/CMakeLists.txt b/source/RobotAPI/drivers/GamepadUnit/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..239bfad99a6cdd7b5d3e642cbc282fe8f2116972 --- /dev/null +++ b/source/RobotAPI/drivers/GamepadUnit/test/CMakeLists.txt @@ -0,0 +1,5 @@ + +# Libs required for the tests +SET(LIBS ${LIBS} ArmarXCore GamepadUnit) + +armarx_add_test(GamepadUnitTest GamepadUnitTest.cpp "${LIBS}") \ No newline at end of file diff --git a/source/RobotAPI/drivers/GamepadUnit/test/GamepadUnitTest.cpp b/source/RobotAPI/drivers/GamepadUnit/test/GamepadUnitTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..488590d87748de3a5a0f2a548ac5a00c379d9d03 --- /dev/null +++ b/source/RobotAPI/drivers/GamepadUnit/test/GamepadUnitTest.cpp @@ -0,0 +1,37 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::GamepadUnit + * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#define BOOST_TEST_MODULE RobotAPI::ArmarXObjects::GamepadUnit + +#define ARMARX_BOOST_TEST + +#include <RobotAPI/Test.h> +#include <RobotAPI/drivers/GamepadUnit/GamepadUnit.h> + +#include <iostream> + +BOOST_AUTO_TEST_CASE(testExample) +{ + armarx::GamepadUnit instance; + + BOOST_CHECK_EQUAL(true, true); +} diff --git a/source/RobotAPI/interface/CMakeLists.txt b/source/RobotAPI/interface/CMakeLists.txt index d5923006c35cafbd85f20f96e9a28ab000fa74e5..aceee62f86a1419e89993e7d9c4809111b722b18 100644 --- a/source/RobotAPI/interface/CMakeLists.txt +++ b/source/RobotAPI/interface/CMakeLists.txt @@ -23,8 +23,8 @@ set(SLICE_FILES units/ForceTorqueUnit.ice units/InertialMeasurementUnit.ice - units/LaserScannerUnit.ice units/OptoForceUnit.ice + units/LaserScannerUnit.ice units/HandUnitInterface.ice units/HapticUnit.ice units/WeissHapticUnit.ice @@ -37,6 +37,7 @@ set(SLICE_FILES units/UnitInterface.ice units/ATINetFTUnit.ice units/OrientedTactileSensorUnit.ice + units/GamepadUnit.ice components/ViewSelectionInterface.ice diff --git a/source/RobotAPI/interface/units/GamepadUnit.ice b/source/RobotAPI/interface/units/GamepadUnit.ice new file mode 100644 index 0000000000000000000000000000000000000000..255e95d281035a18d4b6df4aa0c07e12f03c557f --- /dev/null +++ b/source/RobotAPI/interface/units/GamepadUnit.ice @@ -0,0 +1,83 @@ +/* + * This file is part of ArmarX. + * + * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI + * @author Markus Grotz <markus dot grotz at kit dot edu> + * @date 2015 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_ROBOTAPI_UNITS_GAMEPAD_SLICE_ +#define _ARMARX_ROBOTAPI_UNITS_GAMEPAD_SLICE_ + + +#include <RobotAPI/interface/units/UnitInterface.ice> +#include <RobotAPI/interface/core/RobotState.ice> + +#include <ArmarXCore/interface/core/UserException.ice> +#include <ArmarXCore/interface/core/BasicTypes.ice> +#include <ArmarXCore/interface/observers/VariantBase.ice> +#include <ArmarXCore/interface/observers/Matrix.ice> +#include <ArmarXCore/interface/observers/Timestamp.ice> +#include <ArmarXCore/interface/observers/ObserverInterface.ice> + + + +module armarx +{ + struct GamepadData { + float leftStickX; + float leftStickY; + float rightStickX; + float rightStickY; + float dPadX; + float dPadY; + float leftTrigger; + float rightTrigger; + + bool leftButton; + bool rightButton; + bool backButton; + bool startButton; + bool xButton; + bool yButton; + bool aButton; + bool bButton; + bool theMiddleButton; + bool leftStickButton; + bool rightStickButton; + + }; + interface GamepadUnitInterface extends armarx::SensorActorUnitInterface + { + }; + + interface GamepadUnitListener + { + void reportGamepadState(string device, string name, GamepadData values, TimestampBase timestamp); + }; + /** + * Implements an interface to an GamepadUnitObserver. + **/ + interface GamepadUnitObserverInterface extends ObserverInterface, GamepadUnitListener + { + }; + +}; + +#endif