Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added balance board support #125

Merged
merged 13 commits into from
Oct 26, 2017

Conversation

sanjay900
Copy link
Contributor

@sanjay900 sanjay900 commented Oct 24, 2017

As always, dolphiimote changes are in this pr: maxmalmgren/DolphiiMote#2
Raw sensor values are exposed via Raw, and calibration data is exposed via CalibrationKG0, CalibrationKG17 and CalibrationKG34.
The values are converted to their equivalent weights using this data, and exposed as SensorsKG and SensorsLB, and the Total Weight is exposed via TotalWeightKG and TotalWeightLB. The center of gravity is also calculated and exposed via CenterOfGravityX and CenterOfGravityY.

@sanjay900
Copy link
Contributor Author

Do we want to change the AccelerationGlobal's file name to ControllerGlobal or something? because at this point it has all the global classes and not just Acceleration.

@zelmon64
Copy link
Collaborator

@sanjay900 great work but there's a few issues. I agree AccelerationGlobal should probably be renamed ControllerGlobal unless you (@AndersMalmgren) world prefer something else.

I used the following script to test the board:

def log_balance_board():
	diagnostics.watch(wiimote[0].balance_board.raw.topLeft)
	diagnostics.watch(wiimote[0].balance_board.raw.topRight)
	diagnostics.watch(wiimote[0].balance_board.raw.bottomLeft)
	diagnostics.watch(wiimote[0].balance_board.raw.bottomRight)
	diagnostics.watch(wiimote[0].balance_board.sensorsKG.topLeft)
	diagnostics.watch(wiimote[0].balance_board.sensorsKG.topRight)
	diagnostics.watch(wiimote[0].balance_board.sensorsKG.bottomLeft)
	diagnostics.watch(wiimote[0].balance_board.sensorsKG.bottomRight)
	diagnostics.watch(wiimote[0].balance_board.totalWeightKG)
	diagnostics.watch(wiimote[0].balance_board.centerOfGravityX)
	diagnostics.watch(wiimote[0].balance_board.centerOfGravityY)

if starting:
	wiimote[0].balance_board.update += log_balance_board
  • centerOfGravityX(Y) should probably use the joystick convention of centerOfGravity.x(y)
  • centerOfGravityX world only give me 0 or -7 and centerOfGravityX always gave 12
  • totalWeightKG didn't give a stable value but was roughly correct
  • The spread of sensorsKG doesn't seem right.
    • Typically a pair of values world be around 0 and the others around 70-120. As I shifted my weight about the transition jumps between 0 and 70.
    • I would also expect the totalWeightKG to be the sum of sensorsKG but instead the components of sensorsKG were typically larger than (roughly double) totalWeightKG

Are you happy to look into these issues?

@AndersMalmgren
Copy link
Owner

@zelmon64 How about keeping only acc functions in that global and seperate the new behaviour to a new global? Wiimote is a bit more modular than the other plugins, since its so complex

@zelmon64
Copy link
Collaborator

@AndersMalmgren Yes that makes more sense.

@sanjay900 are you happy to add that into this PR? I can do it after if not.

@sanjay900
Copy link
Contributor Author

sanjay900 commented Oct 25, 2017

So i have fixed sensors reporting incorrectly. I have also fixed COG so that it works correctly.

@sanjay900
Copy link
Contributor Author

sanjay900 commented Oct 25, 2017

Center of gravity seems to work well enough that i can bind it to mouse.deltaX(Y) and its smooth to move the mouse around.

@sanjay900
Copy link
Contributor Author

@zelmon64 I have moved the code from AccelerationGlobal to ExtensionGlobal.

@zelmon64
Copy link
Collaborator

@sanjay900 thanks for continuing with this. Are you using vs 2017? I'm still on 2015 - I suppose I should upgrade.

I think the totalWeight_ is supposed to be the sum of the components, not the average. What it says on WiiBrew supports this. It's like if you stand on two scales (one under each foot) you would have to add their values to get your weight.

Thanks for moving to the new Global file.

@sanjay900
Copy link
Contributor Author

@zelmon64 Yeah i realised the code i was looking at was just completly wrong. Now that its fixed, summing the components is working fine.

@sanjay900
Copy link
Contributor Author

Also yeah, i am currently using 2017. This isn't causing you issues is it?

@zelmon64
Copy link
Collaborator

Yes it is. I have to change some lines in the .vcxproj files to get it to work with 2015. I'm not sure what's best for DolphiiMote: keeping 2015 compatibility or upgrading to 2017. Might as well upgrade I suppose.

@zelmon64
Copy link
Collaborator

@sanjay900 I tried it out and it seems to work perfectly now! Congratulations!

Now that centerOfGravity is split into x and y, I'm wondering if the rest would benefit from something similar like:

  • centerOfGravity
    • x
    • y
  • weight
    • kg
    • lb
    • raw
  • sensors
    • topLeft
      • kg
      • lb
      • raw
    • topRight
      • kg
      • lb
      • raw
    • bottomLeft
      • kg
      • lb
      • raw
    • bottomLeft
      • kg
      • lb
      • raw
  • calibration
    • kg00
      • topLeft
      • topRight
      • bottomLeft
      • bottomLeft
    • kg17
      • topLeft
      • topRight
      • bottomLeft
      • bottomLeft
    • kg34
      • topLeft
      • topRight
      • bottomLeft
      • bottomLeft

or even put the calibrations under the sensor corner selection like:

  • centerOfGravity
    • x
    • y
  • weight
    • kg
    • lb
    • raw
  • sensors
    • topLeft
      • kg
      • lb
      • raw
      • calibration
        • kg00
        • kg17
        • kg34
    • topRight
      • kg
      • lb
      • raw
      • calibration
        • kg00
        • kg17
        • kg34
    • bottomLeft
      • kg
      • lb
      • raw
      • calibration
        • kg00
        • kg17
        • kg34
    • bottomLeft
      • kg
      • lb
      • raw
      • calibration
        • kg00
        • kg17
        • kg34

@AndersMalmgren what do you think? The current layout is:

  • centerOfGravity
    • x
    • y
  • totalWeightKG
  • totalWeightLB
  • sensorsKG
    • topLeft
    • topRight
    • bottomLeft
    • bottomLeft
  • sensorsLB
    • topLeft
    • topRight
    • bottomLeft
    • bottomLeft
  • calibrationKG0
    • topLeft
    • topRight
    • bottomLeft
    • bottomLeft
  • calibrationKG17
    • topLeft
    • topRight
    • bottomLeft
    • bottomLeft
  • calibrationK34
    • topLeft
    • topRight
    • bottomLeft
    • bottomLeft

@sanjay900
Copy link
Contributor Author

Ill start adding this in, since its easy enough to do either layout

@AndersMalmgren
Copy link
Owner

@zelmon64 I don't have stand point on it, do what you think is best

@zelmon64
Copy link
Collaborator

@AndersMalmgren okay thanks ;)

@sanjay900 thanks. I think the second layout would best. Here it is again just to clarify:

  • centerOfGravity
    • x
    • y
  • weight
    • kg
    • lb
    • raw
  • sensors
    • topLeft
      • kg
      • lb
      • raw
      • calibration
        • kg00
        • kg17
        • kg34
    • topRight
      • kg
      • lb
      • raw
      • calibration
        • kg00
        • kg17
        • kg34
    • bottomLeft
      • kg
      • lb
      • raw
      • calibration
        • kg00
        • kg17
        • kg34
    • bottomLeft
      • kg
      • lb
      • raw
      • calibration
        • kg00
        • kg17
        • kg34

@sanjay900
Copy link
Contributor Author

sanjay900 commented Oct 26, 2017 via email

@sanjay900
Copy link
Contributor Author

@zelmon64 So i wonder if for debugging purposes it would be worth it to put toStrings on things. Just for me i currently have them on some of the balance board sensors, but i wonder if thats something that should be applied to more things?

@sanjay900
Copy link
Contributor Author

For example, now I can do testing with:

def log_balance_board():
	diagnostics.watch(wiimote[0].balance_board.sensors.bottomLeft)
	diagnostics.watch(wiimote[0].balance_board.sensors.bottomRight)
	diagnostics.watch(wiimote[0].balance_board.sensors.topLeft)
	diagnostics.watch(wiimote[0].balance_board.sensors.topRight)
	diagnostics.watch(wiimote[0].balance_board.weight)
	diagnostics.watch(wiimote[0].balance_board.centerOfGravity)

	diagnostics.watch(wiimote[0].buttons.button_down(WiimoteButtons.A))

if starting:
	wiimote[0].balance_board.update += log_balance_board

image

@zelmon64
Copy link
Collaborator

@sanjay900 this looks great! That's really cool about the toStrings, I haven't seen that defore. I can see it would be useful but I'm hesitant about adding it to everything else.

One last thing to make this perfect. I think the names should be in lowerCamelCase. Currently some are but not all. I'm not certain how lowerCamelCase is supposed to be applied to names with numbers at the start but the kilogram symbol is normally supposed to be lower case so I think that would bo best (same with lb).

@zelmon64
Copy link
Collaborator

@sanjay900 Thank you! :D

Have you changed your github account email? Your username is showing as @invalid-email-address.

@sanjay900
Copy link
Contributor Author

I guess something wasn't set up right when i reinstalled.

@sanjay900
Copy link
Contributor Author

Ah i see, a tool i ran appears to have changed my git username and email

@sanjay900
Copy link
Contributor Author

image
Cool, i have changed the toString output a little bit so that it formats nicer when printing the balance_board object.

@zelmon64
Copy link
Collaborator

@sanjay900 ooh very nice! I'm getting ready to merge this unless there's more you want to tweak.

Could you also post your board to mouse script please? I'm having some difficulty.

@sanjay900
Copy link
Contributor Author

sanjay900 commented Oct 26, 2017

mouse.deltaX = wiimote[0].balanceBoard.centerOfGravity.x/10
mouse.deltaY = wiimote[0].balanceBoard.centerOfGravity.y/10

@zelmon64 I think i am done now, so we should be good for a merge.
This should just move the mouse around by leaning from side to side.

@zelmon64
Copy link
Collaborator

@sanjay900 Great!

I must have some conflicting software because that's basically how I've been trying to move the mouse. All it does for me is force the mouse to the bottom right corner. Oh well

@sanjay900
Copy link
Contributor Author

sanjay900 commented Oct 26, 2017

Weird, maybe we should look into giving the mouse plugin a little more functionality like getting and setting cursor position, instead of just deltas.

@zelmon64
Copy link
Collaborator

@sanjay900 maybe. What do you fancy tackling next? Do you have any more unsupported controllers?

After I merge your DolphiiMote work I'm going to combine it with the improved wiimote passthrough mode I've been working on. Would you mind testing it with you guitar when it's ready please?

@sanjay900
Copy link
Contributor Author

sanjay900 commented Oct 26, 2017

@zelmon64 I haven't got any more controllers, however now that i have all my other controllers back i can test your passthrough mode when its ready. Going to be interesting putting a guitar in passthrough mode though haha.

@sanjay900
Copy link
Contributor Author

sanjay900 commented Oct 26, 2017

@zelmon64 I may tackle the mouse thing since i did actually have a need for it a while ago and just hacked something in, but it would be much nicer to have it as built in functionality.

@zelmon64 zelmon64 merged commit c0b2116 into AndersMalmgren:master Oct 26, 2017
@sanjay900 sanjay900 deleted the AddBalanceBoardSupport branch October 26, 2017 10:35
@zelmon64
Copy link
Collaborator

@sanjay900 I've uploaded a build on mtbs3d with the modified DolphiiMote for wiimote passthrough mode. There's an example script to show you how to enable it. It doesn't seem to succeed 100% of the time but should after a restarting the script a couple of times (I haven't figured out why yet).

@JabberwockPL
Copy link

Great work on the balance board! I have been wishing for that (and nagging everyone on the forum) for a long time!

As for the mouse, while you are at it, you might also look into grabbing absolute input and/or DirectX input. The former could be useful for controllers such as drawing tablets (I got mine to work as a lightgun, but with additional software), the latter might make easier such schemes like controlling planes etc. with mouse (as it makes recentering easier).

@sanjay900
Copy link
Contributor Author

@zelmon64 So the guitar does not work - atleast not through the guitar. However, it is being passed through as i can see values change on the nunchuck when i alter the guitar.

@sanjay900
Copy link
Contributor Author

@zelmon64 Could you possibly push your changes so i can look at them?

@zelmon64
Copy link
Collaborator

@sanjay900 my changes are on this branch:
https://github.com/zelmon64/DolphiiMote/tree/simultaneous_extensions

Did you try the DolphiiMote test app or FreePIE?

@sanjay900
Copy link
Contributor Author

Freepie

@sanjay900
Copy link
Contributor Author

However the same happens with dolphiimote test.

@sanjay900
Copy link
Contributor Author

@zelmon64 I think i have an idea as to why this happens. It is also a problem with classic controllers, I will fix this on my own fork of your branch.

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.

None yet

4 participants