diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1438a8..a2fa8c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@ find_package(catkin REQUIRED COMPONENTS
dynamic_reconfigure
)
generate_dynamic_reconfigure_options(
- cfg/DynamicParams.cfg
+ cfg/MatrixServer.cfg
)
## System dependencies are found with CMake's conventions
diff --git a/README.md b/README.md
index add697e..33214b0 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,16 @@
-# ema_stim_matrix
\ No newline at end of file
+# ema_stim_matrix
+This repository provides auxiliary code to use the hasomed rehastim electrical stimulator with an electrode matrix. It was created for Project EMA FES applications.
+
+### Structure:
+
+- **cfg:** contains dynamic reconfiguration files
+
+- **config:** keeps initial configuration files
+
+- **launch:** includes ROS launch files
+
+- **other:** out-of-date scripts, legacy code once used for testing or miscellaneous
+
+- **perspective:** group the predefined GUI perspectives/layouts
+
+- **scripts:** contains ROS node files and auxiliary modules
diff --git a/cfg/DynamicParams.cfg b/cfg/DynamicParams.cfg
deleted file mode 100755
index c3c57c4..0000000
--- a/cfg/DynamicParams.cfg
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-PACKAGE = "ema_stim_matrix"
-
-from dynamic_reconfigure.parameter_generator_catkin import *
-
-gen = ParameterGenerator()
-
-# mygroup = gen.add_group("MyGroup", type="tab") # types: 'hide', 'collapse', 'apply', 'tab'
-
-gen.add("ON_OFF", bool_t, 0, "Turns the system on/off", False)
-gen.add("Current", int_t, 0, "Stimulator current", 40, 0, 80)
-gen.add("Pulse_Width", int_t, 0, "Stimulator pulse width", 0, 0, 500)
-gen.add("Frequency", int_t, 0, "Stimulator frequency", 48, 0, 300)
-gen.add("Channels", str_t, 0, "Stimulator channels", "1,2,3,4")
-
-exit(gen.generate(PACKAGE, "server", "DynamicParams"))
-
diff --git a/cfg/MatrixServer.cfg b/cfg/MatrixServer.cfg
new file mode 100755
index 0000000..7346a57
--- /dev/null
+++ b/cfg/MatrixServer.cfg
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+"""
+
+The cfg file defines dynamic parameters, as well as their names, types,
+level, description, default values and more. It also determines how the
+reconfiguration GUI will look like. The catkin_make command has to be run
+for the changes in this file to take effect. This file is usually in the
+/cfg subdirectory of a package. More info on:
+http://wiki.ros.org/dynamic_reconfigure/Tutorials/HowToWriteYourFirstCfgFile
+
+Parameters can be grouped. Each group has a type that defines how it appears
+on the GUI. The types can be either hide, collapse, apply or tab. Here
+is an example:
+
+gen = ParameterGenerator()
+mygroup = gen.add_group("MyGroup", type="tab")
+mygroup.add("ON_OFF", bool_t, 0, "Turns the system on/off", False) ...
+
+ _________ NOTES _________
+
+Be careful when changing parameters, their attributes are used by other
+pieces of code.
+
+"""
+
+PACKAGE = "ema_stim_matrix" # pkg where the server runs
+
+from dynamic_reconfigure.parameter_generator_catkin import *
+
+gen = ParameterGenerator()
+# name type level description min,default,max
+gen.add("ON_OFF", bool_t, 1, "Turns the system on/off", False)
+gen.add("Current", int_t, 2, "Stimulator current", 40, 0, 80)
+gen.add("Pulse_Width", int_t, 3, "Stimulator pulse width", 0, 0, 500)
+gen.add("Frequency", int_t, 4, "Stimulator frequency", 48, 0, 300)
+gen.add("Channels", str_t, 5, "Stimulator channels", "1,2,3,4")
+
+exit(gen.generate(PACKAGE, PACKAGE, "MatrixServer")) # "cfgfilename"
diff --git a/config/matrix.yaml b/config/matrix.yaml
index e955d49..15d8bf1 100644
--- a/config/matrix.yaml
+++ b/config/matrix.yaml
@@ -1,8 +1,18 @@
-## Matrix config
#
-# channels: list of active channels in the matrix
-# freq: main stimulation frequency in Hz
-# NOTE: if channels 1,2,3,4 are being used in the matrix with 12 Hz each, then freq=12x4=48 Hz
+# The YAML file is a lightweight markup language file that supports all
+# ROS parameter types. It's used by rosparam to load static parameters to
+# the Parameter Server, which are commonly used to initialize part of a
+# system and rarely change on run-time. Sometimes the user modifies this
+# file before starting a node. This file is usually in the /config subdirectory
+# of a package. Note that when dynamic reconfiguration is implemented for
+# a package, most parameters will be dynamic, making this file barely used.
+#
+# _________ NOTES _________
+#
+# If the stimulation channels 1,2,3,4 are used in a matrix with the desired
+# frequency of 12Hz for each channel, then the overall stimulation frequency
+# will be 12x4 = 48Hz.
+#
-channels: [1,2,3,4]
-freq: 48
\ No newline at end of file
+channels: [1,2,3,4] # List of active channels in the matrix
+freq: 48 # Overall stimulation frequency in Hz
diff --git a/launch/matrix.launch b/launch/matrix.launch
index bf2f917..c6f60ec 100644
--- a/launch/matrix.launch
+++ b/launch/matrix.launch
@@ -1,14 +1,30 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/other/analysis/PlotForce.m b/other/analysis/PlotForce.m
new file mode 100644
index 0000000..606d646
--- /dev/null
+++ b/other/analysis/PlotForce.m
@@ -0,0 +1,32 @@
+%%
+ExcludeIdx = [];
+MidStimTimes = FileStruct.E1_SUBX0_1C_Left.MidStimTimes;
+AreasVec = FileStruct.E1_SUBX0_1C_Left.AreasVec;
+ForceNorm = FileStruct.E1_SUBX0_1C_Left.ForceNorm;
+CurveFitData = FileStruct.E1_SUBX0_1C_Left.CurveFitData;
+CurveFitStats = FileStruct.E1_SUBX0_1C_Left.CurveFitStats;
+
+%%
+figure
+hold on
+yyaxis left % Left Y axis
+plot(ForceNorm)
+ylabel('Normalized Force'), xlim([-10 380])
+title(' ')
+LimitsL = [-0.09 1.2]; ylim(LimitsL); box on;
+yyaxis right % Right Y axis
+
+if ~isempty(ExcludeIdx)
+ ExcludeVec = false(1,length(AreasVec));
+ ExcludeVec(ExcludeIdx) = true;
+ plot(CurveFitData,MidStimTimes,AreasVec,'o',ExcludeVec,'x')
+ legend('Force','FTI','Excluded','FTI Fit','Location','Best')
+else
+ plot(CurveFitData,MidStimTimes,AreasVec,'o')
+ legend('Force','FTI','FTI Fit','Location','Best')
+end
+
+LimitsR = [0 4];
+ylim([LimitsL(1)*LimitsR(2)/LimitsL(2) LimitsR(2)])
+ylabel('Normalized Force ? Time (FTI)'), xlabel('Time (s)')
+hold off
\ No newline at end of file
diff --git a/other/analysis/PlotForceNewton.m b/other/analysis/PlotForceNewton.m
new file mode 100644
index 0000000..314e94f
--- /dev/null
+++ b/other/analysis/PlotForceNewton.m
@@ -0,0 +1,38 @@
+%%
+g = 9.8067;
+
+ExcludeIdx = [];
+MidStimTimes = FileStruct.E1_SUBX0_1M_Left.MidStimTimes;
+AreasVec = FileStruct.E1_SUBX0_1M_Left.AreasVec;
+ForceNorm = FileStruct.E1_SUBX0_1M_Left.ForceNorm;
+
+AreasVec = g*AreasVec;
+ForceNorm.Data = g*ForceNorm.Data;
+
+[CurveFitData,CurveFitStats,~] = fit(MidStimTimes,AreasVec,'poly1',...
+ 'Exclude', ExcludeIdx);
+
+%%
+figure
+hold on
+yyaxis left % Left Y axis
+plot(ForceNorm)
+ylabel('Force (N)'), xlim([-10 380])
+title(' ')
+LimitsL = [-1.9 12]; ylim(LimitsL); box on;
+yyaxis right % Right Y axis
+
+if ~isempty(ExcludeIdx)
+ ExcludeVec = false(1,length(AreasVec));
+ ExcludeVec(ExcludeIdx) = true;
+ plot(CurveFitData,MidStimTimes,AreasVec,'o',ExcludeVec,'x')
+ legend('Force','FTI','Excluded','FTI Fit','Location','Best')
+else
+ plot(CurveFitData,MidStimTimes,AreasVec,'o')
+ legend('Force','FTI','FTI Fit','Location','Best')
+end
+
+LimitsR = [0 40];
+ylim([LimitsL(1)*LimitsR(2)/LimitsL(2) LimitsR(2)])
+ylabel('Force-Time Integral (N.s)'), xlabel('Time (s)')
+hold off
\ No newline at end of file
diff --git a/other/analysis/PlotFromMatData.m b/other/analysis/PlotFromMatData.m
index fc19859..2b2a6f1 100644
--- a/other/analysis/PlotFromMatData.m
+++ b/other/analysis/PlotFromMatData.m
@@ -5,7 +5,7 @@
%
% Plot the stimulator and force data from mat files.
%
-%
+% 9.8067
clear; close all;
diff --git a/package.xml b/package.xml
index 20bc67c..cc93fe4 100644
--- a/package.xml
+++ b/package.xml
@@ -1,61 +1,72 @@
+
+
- ema_stim_matrix
- 0.0.2
-
- The ema_stim_matrix package provides auxiliary code to use the hasomed
- rehastim electrical stimulator with an electrode matrix. It was created
- for the Project EMA FES applications.
-
- Lucas De Macedo
-
-
-
-
- Lucas De Macedo
-
-
-
-
-
- UnB
-
-
-
-
-
-
- https://github.com/lara-unb/ema_stim_matrix
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ema_common_msgs
- catkin
- rospy
- std_msgs
- dynamic_reconfigure
-
-
-
-
-
-
-
\ No newline at end of file
+ ema_stim_matrix
+ 0.0.2
+
+ The ema_stim_matrix package provides auxiliary code to use the hasomed
+ rehastim electrical stimulator with an electrode matrix. It was created
+ for the Project EMA FES applications.
+
+ Lucas De Macedo
+
+
+
+
+ Lucas De Macedo
+
+
+
+
+
+ UnB
+
+
+
+
+
+
+ https://github.com/lara-unb/ema_stim_matrix
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ema_common_msgs
+ catkin
+ rospy
+ std_msgs
+ dynamic_reconfigure
+
+
+
+
+
+
+
diff --git a/perspective/Stim_Matrix.perspective b/perspective/EMA_Matrix_Force.perspective
similarity index 89%
rename from perspective/Stim_Matrix.perspective
rename to perspective/EMA_Matrix_Force.perspective
index 322bc49..91bb197 100644
--- a/perspective/Stim_Matrix.perspective
+++ b/perspective/EMA_Matrix_Force.perspective
@@ -5,7 +5,7 @@
"keys": {
"running-plugins": {
"type": "repr",
- "repr": "{u'rqt_reconfigure/Param': [1], u'rqt_plot/Plot': [2, 1], u'rqt_topic/TopicPlugin': [1], u'rqt_bag/Bag': [1]}"
+ "repr": "{u'rqt_reconfigure/Param': [1], u'rqt_plot/Plot': [2, 1], u'rqt_topic/TopicPlugin': [1]}"
}
},
"groups": {
@@ -215,7 +215,7 @@
},
"topics": {
"type": "repr",
- "repr": "u'/ema/forcesensor/loadcell_fsignal/data'"
+ "repr": "u''"
},
"y_limits": {
"type": "repr",
@@ -262,7 +262,7 @@
},
"topics": {
"type": "repr",
- "repr": "[u'/ema/matrix/channel_vec/data[1]', u'/ema/matrix/channel_vec/data[2]', u'/ema/matrix/channel_vec/data[3]', u'/ema/matrix/channel_vec/data[4]']"
+ "repr": "u''"
},
"y_limits": {
"type": "repr",
@@ -452,8 +452,8 @@
"keys": {
"tree_widget_header_state": {
"type": "repr(QByteArray.hex)",
- "repr(QByteArray.hex)": "QtCore.QByteArray('000000ff000000000000000100000000000000000100000000000000000000000000000000000003e7000000050101000100000000000000000000000064ffffffff0000008100000000000000050000012f0000000100000000000000f000000001000000000000007200000001000000000000003d0000000100000000000001190000000100000000000003e800')",
- "pretty-print": " d / r = "
+ "repr(QByteArray.hex)": "QtCore.QByteArray('000000ff0000000000000001000000000000000001000000000000000000000000000000000000040a000000050101000100000000000000000000000064ffffffff0000008100000000000000050000012f0000000100000000000000f000000001000000000000007200000001000000000000003d00000001000000000000013c0000000100000000000003e800')",
+ "pretty-print": " d / r = < "
}
},
"groups": {}
@@ -602,13 +602,13 @@
"keys": {
"geometry": {
"type": "repr(QByteArray.hex)",
- "repr(QByteArray.hex)": "QtCore.QByteArray('01d9d0cb000200000000003f000000180000077f000004370000003f000000180000077f0000043700000000000000000780')",
- "pretty-print": " ? 7 ? 7 "
+ "repr(QByteArray.hex)": "QtCore.QByteArray('01d9d0cb0002000000000000000000000000077f0000049700000000000000190000077f0000049700000000000000000780')",
+ "pretty-print": " "
},
"state": {
"type": "repr(QByteArray.hex)",
- "repr(QByteArray.hex)": "QtCore.QByteArray('000000ff00000000fd0000000100000003000007410000040afc0100000014fc00000000000003400000017800fffffffc0200000002fb00000042007200710074005f0070006c006f0074005f005f0050006c006f0074005f005f0032005f005f00440061007400610050006c006f00740057006900640067006500740100000000000001f1000000a700fffffffb00000042007200710074005f0070006c006f0074005f005f0050006c006f0074005f005f0031005f005f00440061007400610050006c006f007400570069006400670065007401000001f700000213000000a700fffffffc00000350000003ef0000000000fffffffc0200000001fb0000006c007200710074005f007200650063006f006e006600690067007500720065005f005f0050006100720061006d005f005f0032005f005f005f0070006c007500670069006e0063006f006e007400610069006e00650072005f0074006f0070005f00770069006400670065007401000000000000015a0000000000000000fc00000346000003fb0000022000fffffffc0200000003fc000000000000018e0000010f00fffffffa000000010200000002fb00000044007200710074005f00670072006100700068005f005f0052006f007300470072006100700068005f005f0031005f005f0052006f0073004700720061007000680055006903000000bb0000005a00000641000003adfb0000006c007200710074005f007200650063006f006e006600690067007500720065005f005f0050006100720061006d005f005f0031005f005f005f0070006c007500670069006e0063006f006e007400610069006e00650072005f0074006f0070005f0077006900640067006500740100000000000001c10000010f00fffffffb0000004c007200710074005f0074006f007000690063005f005f0054006f0070006900630050006c007500670069006e005f005f0031005f005f0054006f0070006900630057006900640067006500740100000194000001d80000007200fffffffb00000034007200710074005f006200610067005f005f004200610067005f005f0031005f005f0042006100670057006900640067006500740100000372000000980000009400fffffffb00000022007200710074005f0074006f0070005f005f0054004f0050005f005f0031005f005f01000004bf000002800000000000000000fb00000062007200710074005f0072006f0062006f0074005f006d006f006e00690074006f0072005f005f0052006f0062006f0074004d006f006e00690074006f0072005f005f0031005f005f0052006f0062006f00740020004d006f006e00690074006f00720100000662000000dd0000000000000000fb0000004c007200710074005f0074006f007000690063005f005f0054006f0070006900630050006c007500670069006e005f005f0032005f005f0054006f0070006900630057006900640067006500740100000651000000ee0000000000000000fb00000050007200710074005f0061006300740069006f006e005f005f0041006300740069006f006e0050006c007500670069006e005f005f0031005f005f006d0065007300730061006700650073002e0075006901000004d6000002690000000000000000fb00000064007200710074005f006c00610075006e00630068005f005f004c00610075006e00630068005f005f0031005f005f005f0070006c007500670069006e0063006f006e007400610069006e00650072005f0074006f0070005f00770069006400670065007401000004310000030e0000000000000000fb00000050007200710074005f006400650070005f005f0052006f0073005000610063006b00470072006100700068005f005f0031005f005f0052006f0073005000610063006b0047007200610070006800550069010000042e000003110000000000000000fb00000066007200710074005f006c006f0067006700650072005f006c006500760065006c005f005f004c006f0067006700650072004c006500760065006c005f005f0031005f005f004c006f0067006700650072004c006500760065006c00570069006400670065007401000005130000022c0000000000000000fb00000064007200710074005f006d006f0076006500690074005f005f004d006f0076006500690074005f005f0031005f005f005f0070006c007500670069006e0063006f006e007400610069006e00650072005f0074006f0070005f0077006900640067006500740100000563000001dc0000000000000000fb00000078007200710074005f00720075006e00740069006d0065005f006d006f006e00690074006f0072005f005f00520075006e00740069006d0065004d006f006e00690074006f0072005f005f0031005f005f00520075006e00740069006d0065004d006f006e00690074006f007200570069006400670065007401000005af000001900000000000000000fb00000072007200710074005f0073006500720076006900630065005f00630061006c006c00650072005f005f005300650072007600690063006500430061006c006c00650072005f005f0031005f005f005300650072007600690063006500430061006c006c0065007200570069006400670065007401000005320000020d0000000000000000fb00000042007200710074005f007300720076005f005f00530065007200760069006300650073005f005f0031005f005f006d0065007300730061006700650073002e0075006901000004e10000025e0000000000000000fb00000058007200710074005f007000750062006c00690073006800650072005f005f005000750062006c00690073006800650072005f005f0031005f005f005000750062006c0069007300680065007200570069006400670065007401000004da000002650000000000000000fb00000042007200710074005f006d00730067005f005f004d0065007300730061006700650073005f005f0031005f005f006d0065007300730061006700650073002e0075006901000004d6000002690000000000000000fb0000005a007200710074005f0069006d006100670065005f0076006900650077005f005f0049006d0061006700650056006900650077005f005f0031005f005f0049006d006100670065005600690065007700570069006400670065007401000005a40000019b0000000000000000fb00000042007200710074005f006e00610076005f0076006900650077005f005f004e0061007600690067006100740069006f006e0056006900650077005f005f0031005f005f010000064a000000f50000000000000000fb00000050007200710074005f0070006f00730065005f0076006900650077005f005f0050006f007300650056006900650077005f005f0031005f005f0047004c00560069006500770057006900640067006500740100000681000000be0000000000000000fb0000004c007200710074005f00740066005f0074007200650065005f005f0052006f0073005400660054007200650065005f005f0031005f005f0052006f0073005400660054007200650065005500690100000592000001ad0000000000000000000007410000000000000004000000040000000800000008fc00000002000000010000000100000036004d0069006e0069006d0069007a006500640044006f0063006b00570069006400670065007400730054006f006f006c0062006100720200000000ffffffff00000000000000000000000300000000')",
- "pretty-print": " @ x lrqt_reconfigure__Param__2___plugincontainer_top_widget F Drqt_graph__RosGraph__1__RosGraphUi lrqt_reconfigure__Param__1___plugincontainer_top_widget Lrqt_topic__TopicPlugin__1__TopicWidget 4rqt_bag__Bag__1__BagWidget \"rqt_top__TOP__1__ brqt_robot_monitor__RobotMonitor__1__Robot Monitor Lrqt_topic__TopicPlugin__2__TopicWidget Prqt_action__ActionPlugin__1__messages.ui drqt_launch__Launch__1___plugincontainer_top_widget Prqt_dep__RosPackGraph__1__RosPackGraphUi frqt_logger_level__LoggerLevel__1__LoggerLevelWidget drqt_moveit__Moveit__1___plugincontainer_top_widget xrqt_runtime_monitor__RuntimeMonitor__1__RuntimeMonitorWidget rrqt_service_caller__ServiceCaller__1__ServiceCallerWidget Brqt_srv__Services__1__messages.ui Xrqt_publisher__Publisher__1__PublisherWidget Brqt_msg__Messages__1__messages.ui Zrqt_image_view__ImageView__1__ImageViewWidget Brqt_nav_view__NavigationView__1__ Prqt_pose_view__PoseView__1__GLViewWidget Lrqt_tf_tree__RosTfTree__1__RosTfTreeUi 6MinimizedDockWidgetsToolbar "
+ "repr(QByteArray.hex)": "QtCore.QByteArray('000000ff00000000fd00000001000000030000078000000456fc0100000014fc000000000000035c0000011300fffffffc0200000002fb00000042007200710074005f0070006c006f0074005f005f0050006c006f0074005f005f0032005f005f00440061007400610050006c006f00740057006900640067006500740100000013000002160000009e00fffffffb00000042007200710074005f0070006c006f0074005f005f0050006c006f0074005f005f0031005f005f00440061007400610050006c006f0074005700690064006700650074010000022f0000023a0000009e00fffffffc00000350000003ef0000000000fffffffc0200000001fb0000006c007200710074005f007200650063006f006e006600690067007500720065005f005f0050006100720061006d005f005f0032005f005f005f0070006c007500670069006e0063006f006e007400610069006e00650072005f0074006f0070005f00770069006400670065007401000000000000015a0000000000000000fc000003620000041e000000f900fffffffc0200000003fc00000013000001f90000010e00fffffffa000000010200000002fb00000044007200710074005f00670072006100700068005f005f0052006f007300470072006100700068005f005f0031005f005f0052006f0073004700720061007000680055006903000000bb0000005a00000641000003adfb0000006c007200710074005f007200650063006f006e006600690067007500720065005f005f0050006100720061006d005f005f0031005f005f005f0070006c007500670069006e0063006f006e007400610069006e00650072005f0074006f0070005f0077006900640067006500740100000000000001c10000010e00fffffffb0000004c007200710074005f0074006f007000690063005f005f0054006f0070006900630050006c007500670069006e005f005f0031005f005f0054006f0070006900630057006900640067006500740100000212000002570000006c00fffffffb00000034007200710074005f006200610067005f005f004200610067005f005f0031005f005f0042006100670057006900640067006500740100000375000000950000000000000000fb00000022007200710074005f0074006f0070005f005f0054004f0050005f005f0031005f005f01000004bf000002800000000000000000fb00000062007200710074005f0072006f0062006f0074005f006d006f006e00690074006f0072005f005f0052006f0062006f0074004d006f006e00690074006f0072005f005f0031005f005f0052006f0062006f00740020004d006f006e00690074006f00720100000662000000dd0000000000000000fb0000004c007200710074005f0074006f007000690063005f005f0054006f0070006900630050006c007500670069006e005f005f0032005f005f0054006f0070006900630057006900640067006500740100000651000000ee0000000000000000fb00000050007200710074005f0061006300740069006f006e005f005f0041006300740069006f006e0050006c007500670069006e005f005f0031005f005f006d0065007300730061006700650073002e0075006901000004d6000002690000000000000000fb00000064007200710074005f006c00610075006e00630068005f005f004c00610075006e00630068005f005f0031005f005f005f0070006c007500670069006e0063006f006e007400610069006e00650072005f0074006f0070005f00770069006400670065007401000004310000030e0000000000000000fb00000050007200710074005f006400650070005f005f0052006f0073005000610063006b00470072006100700068005f005f0031005f005f0052006f0073005000610063006b0047007200610070006800550069010000042e000003110000000000000000fb00000066007200710074005f006c006f0067006700650072005f006c006500760065006c005f005f004c006f0067006700650072004c006500760065006c005f005f0031005f005f004c006f0067006700650072004c006500760065006c00570069006400670065007401000005130000022c0000000000000000fb00000064007200710074005f006d006f0076006500690074005f005f004d006f0076006500690074005f005f0031005f005f005f0070006c007500670069006e0063006f006e007400610069006e00650072005f0074006f0070005f0077006900640067006500740100000563000001dc0000000000000000fb00000078007200710074005f00720075006e00740069006d0065005f006d006f006e00690074006f0072005f005f00520075006e00740069006d0065004d006f006e00690074006f0072005f005f0031005f005f00520075006e00740069006d0065004d006f006e00690074006f007200570069006400670065007401000005af000001900000000000000000fb00000072007200710074005f0073006500720076006900630065005f00630061006c006c00650072005f005f005300650072007600690063006500430061006c006c00650072005f005f0031005f005f005300650072007600690063006500430061006c006c0065007200570069006400670065007401000005320000020d0000000000000000fb00000042007200710074005f007300720076005f005f00530065007200760069006300650073005f005f0031005f005f006d0065007300730061006700650073002e0075006901000004e10000025e0000000000000000fb00000058007200710074005f007000750062006c00690073006800650072005f005f005000750062006c00690073006800650072005f005f0031005f005f005000750062006c0069007300680065007200570069006400670065007401000004da000002650000000000000000fb00000042007200710074005f006d00730067005f005f004d0065007300730061006700650073005f005f0031005f005f006d0065007300730061006700650073002e0075006901000004d6000002690000000000000000fb0000005a007200710074005f0069006d006100670065005f0076006900650077005f005f0049006d0061006700650056006900650077005f005f0031005f005f0049006d006100670065005600690065007700570069006400670065007401000005a40000019b0000000000000000fb00000042007200710074005f006e00610076005f0076006900650077005f005f004e0061007600690067006100740069006f006e0056006900650077005f005f0031005f005f010000064a000000f50000000000000000fb00000050007200710074005f0070006f00730065005f0076006900650077005f005f0050006f007300650056006900650077005f005f0031005f005f0047004c00560069006500770057006900640067006500740100000681000000be0000000000000000fb0000004c007200710074005f00740066005f0074007200650065005f005f0052006f0073005400660054007200650065005f005f0031005f005f0052006f0073005400660054007200650065005500690100000592000001ad0000000000000000000007800000000000000004000000040000000800000008fc00000002000000010000000100000036004d0069006e0069006d0069007a006500640044006f0063006b00570069006400670065007400730054006f006f006c0062006100720200000000ffffffff00000000000000000000000300000000')",
+ "pretty-print": " \\ / : lrqt_reconfigure__Param__2___plugincontainer_top_widget b Drqt_graph__RosGraph__1__RosGraphUi lrqt_reconfigure__Param__1___plugincontainer_top_widget Lrqt_topic__TopicPlugin__1__TopicWidget 4rqt_bag__Bag__1__BagWidget \"rqt_top__TOP__1__ brqt_robot_monitor__RobotMonitor__1__Robot Monitor Lrqt_topic__TopicPlugin__2__TopicWidget Prqt_action__ActionPlugin__1__messages.ui drqt_launch__Launch__1___plugincontainer_top_widget Prqt_dep__RosPackGraph__1__RosPackGraphUi frqt_logger_level__LoggerLevel__1__LoggerLevelWidget drqt_moveit__Moveit__1___plugincontainer_top_widget xrqt_runtime_monitor__RuntimeMonitor__1__RuntimeMonitorWidget rrqt_service_caller__ServiceCaller__1__ServiceCallerWidget Brqt_srv__Services__1__messages.ui Xrqt_publisher__Publisher__1__PublisherWidget Brqt_msg__Messages__1__messages.ui Zrqt_image_view__ImageView__1__ImageViewWidget Brqt_nav_view__NavigationView__1__ Prqt_pose_view__PoseView__1__GLViewWidget Lrqt_tf_tree__RosTfTree__1__RosTfTreeUi 6MinimizedDockWidgetsToolbar "
}
},
"groups": {
diff --git a/scripts/matrix_node.py b/scripts/matrix_node.py
index 740c72e..ab089b3 100755
--- a/scripts/matrix_node.py
+++ b/scripts/matrix_node.py
@@ -1,7 +1,22 @@
#!/usr/bin/env python
+"""
+
+Particularly, this code defines the electrode matrix force experiments: a
+6min trial of 36 stim sequences spaced by 5sec with 0.5sec ascending and
+descending current ramp.
+
+The ROS node runs this code. It should make all the necessary
+communication/interaction with ROS and it shouldn't deal with minor details.
+For example, it would be used to publish a filtered sensor measurement as
+a ROS message to other ROS nodes instead of establishing the serial comm
+and treating that raw measurement. For more info, check:
+http://wiki.ros.org/Nodes
+
+"""
+
import rospy
-import dynamic_reconfigure.client as reconfig
+import dynamic_reconfigure.client
# import ros msgs
from std_msgs.msg import String, Int8, UInt16, Int8MultiArray
@@ -56,10 +71,11 @@ def main():
global progressive_steps
# init matrix node
- rospy.init_node('matrix', anonymous=False)
+ rospy.init_node('matrix') # overwritten by launch file name
- # communicate with the dynamic server
- dyn_params = reconfig.Client('server', config_callback = server_callback)
+ # communicate with the dynamic reconfigure server
+ dyn_params = dynamic_reconfigure.client.Client(
+ 'reconfig', config_callback=server_callback) # 'server node name'
# list published topics
pub = {}
diff --git a/scripts/matrix_server_node.py b/scripts/matrix_server_node.py
new file mode 100755
index 0000000..cebadf5
--- /dev/null
+++ b/scripts/matrix_server_node.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+"""
+
+Particularly, this code establishes the dynamic reconfiguration server: it
+watches and defines rules for dynamic parameter changes.
+
+The ROS node runs this code. It should make all the necessary
+communication/interaction with ROS and it shouldn't deal with minor details.
+For example, it would be used to publish a filtered sensor measurement as
+a ROS message to other ROS nodes instead of stablishing the serial comm
+and treating that raw measurement. For more information, check:
+http://wiki.ros.org/dynamic_reconfigure/Tutorials/SettingUpDynamicReconfigureForANode%28python%29
+
+"""
+
+import rospy
+import dynamic_reconfigure.server
+from ema_stim_matrix.cfg import MatrixServerConfig # pkgname.cfg, cfgfilenameConfig
+
+# global variables
+global prev_config
+
+# used to compare past values
+prev_config = {'Current': 40, 'Pulse_Width': 0}
+
+
+# defines the rules for parameter changes
+def callback(config, level):
+ global prev_config
+
+ # prevents the user from abruptly increasing the current
+ if config['Current'] - prev_config['Current'] > 2:
+ config['Current'] = prev_config['Current'] + 2
+
+ prev_config['Current'] = config['Current']
+
+ return config
+
+
+def main():
+ # init dynamic reconfigure server node
+ rospy.init_node('reconfig')
+
+ srv = dynamic_reconfigure.server.Server(
+ MatrixServerConfig, callback) # cfgfilenameConfig, callback name
+
+ rospy.spin()
+
+if __name__ == '__main__':
+ try:
+ main()
+ except rospy.ROSInterruptException:
+ pass
diff --git a/scripts/server_node.py b/scripts/server_node.py
deleted file mode 100755
index 54bf2b4..0000000
--- a/scripts/server_node.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-
-import rospy
-
-from dynamic_reconfigure.server import Server
-from ema_stim_matrix.cfg import DynamicParamsConfig
-
-global prev_config
-
-# used to compare past values
-prev_config = {'Current': 40, 'Pulse_Width': 0}
-
-def callback(config, level):
- global prev_config
-
- # prevents the user from abruptly increasing the current
- if config['Current'] - prev_config['Current'] > 2:
- config['Current'] = prev_config['Current'] + 2
-
- prev_config['Current'] = config['Current']
-
- return config
-
-if __name__ == "__main__":
- rospy.init_node('server', anonymous=False)
-
- srv = Server(DynamicParamsConfig, callback)
- rospy.spin()