Skip to content

Conversation

@caluap
Copy link

@caluap caluap commented Dec 17, 2024

Hi all, this PR introduces the triple-handle controller plugin, enabling continuous three-dimensional affective ratings (e.g., valence, arousal, dominance) in jsPsych experiments. It lets participants adjust three separate handles in real time, providing dynamic affective data during stimulus presentation.

Included:

  • Plugin code
  • README
  • package.json
  • Extras: /docs with documentation, /examples with a working demo, and a test suite.

How to verify:

You will need a handle controller. We developed and tested the plugin using a Logitech Flight Throttle Quadrant.

  • Try the Demo: Open the provided example file and interact with the three handles to see real-time ratings.
  • Check Data: Inspect the console or saved data to confirm that ratings and timestamps are recorded as expected.

Feedback is welcome, especially on code clarity and documentation. Thanks for reviewing!

@changeset-bot
Copy link

changeset-bot bot commented Dec 17, 2024

⚠️ No Changeset found

Latest commit: 8f58e76

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@jadeddelta jadeddelta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey there, thank you so much for the submission! i was unable to test the triple handle controller part itself, but we trust your periphery. here's just some simple things to change (especially updating the package.json( before we can add it on, along with some suggestions if you'd like to implement them to make it easier for other researchers to work with the plugin.

@@ -0,0 +1,8 @@
{
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to flesh this out in line with other packages, so it can be integrated via npm

/* Set up constants */
const info = {
name: "3-axis video annotation",
version: "0.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we're in a js file, the version will have to be updated manually: so just make it 1.0.0 for the first release

"Indices of the game controller axis that will control measurement axis 3.",
},
axis_location: {
type: jspsych.ParameterType.COMPLEX,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be more exact, we can set type: jspsych.ParameterType.STRING, and add array: true

description:
"The location of the axes on the screen. L = left, H = hidden, R = right.",
},
mode: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like mode can only be 'DEBUG' or not: wondering if there is more planned for this or if debug mode should just be a true/false parameter?

* This plugin collects responses to an video file in real time
* using a game controller.
*
* @author YOUR NAME
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget to credit yourself here!

0,
this.mapValue(axis3Meter, this.zeroThreshold, 1, 0, 1)
);
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to wrap all of these in try catch/have them separate?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this part of the code displays the values captured from the gamepad to the UI.

Separate try-catch statements are there so that if one of the UI elements creates an error, it does not cause that element to ruin the experiment or freeze the UI of the other elements.

This does not affect actual data collected during the experiment.

window.clearInterval(this.interval);
this.animate = false;
// end trial
this.jsPsych.finishTrial({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note, if you'd like, you can add to the info property at the top the data provided by this plugin, which you can find here: link

<div id="thc-overlay">
<p>
A controller with throttles has not been detected.
If you have already plugged one in, please try pressing any
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for people trying to make this plugin but for another language, it would be nice to make this a parameter and have what you have as the default

}"></video>
<div id="thc-video-toolbar">
<div class="thc-toolbar-group">
<button id="play-btn" class="jspsych-btn player-btn">► Play</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with these button labels too

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants