Author Topic: Problems with GlovePIE and connecting Wiimote+Balance Board  (Read 9630 times)

Offline stardyedbox

  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Hi,

I am writing a glovePIE script that makes use of a Wiimote as well as a Balance Board. I am able to manually connect both to my bluetooth stack; however, the problem is that when I run my script, only one of them ever works (and this is always the device which I have connected first). The device which is connected second never works--I seem to be able to get a bluetooth connection, but GlovePIE is not able to recognize it.

In my code, I use wiimote1 for all my wiimote controls, and wiimote2.balanceboard for my board controls. Thus I always try to connect my wiimote before my balanceboard as I have heard that the devices will be enumerated in the order that you connect them.

I always connect my devices by first 1) opening glovePIE 2) using BlueSoleil to manually connect the HIDs.

Please, can anyone help me? Thanks!



Offline stardyedbox

  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Reply #1 on: July 05, 2010, 03:23:35 AM
Hi everyone, it's me again; sorry to spam. I thought i'd provide some code examples. can anyone help me out with this?

I wrote my script on glovePIE 0.43 for a FPS-type game. My script uses the Wiimote for camera angles (emulating the mouse) and the Balance Board (emulating the keyboard) for movement.

however, whenever I connect my Wiimote, and thereafter my Balance Board, the Balance Board always seems to "switch off" within 2 seconds. Hence, the Wiimote controls work just fine but the Balance Board doesn't seem to be detected at all.

Here is a representative example of my script using lednerg's motion plus air mouse script combined with a balance board control.

In addition, I get the error message
Quote
internal Access violation at address 005A725F in module "GlovePIE.exe". Read of address 00000000.
when running the code on line 13 (
Code: [Select]
if Wiimote1.HasBalanceBoard). What does this mean? the glovePIE editor always seems to highlight any instance of WiimoteX.HasBalanceBoard.

Please, it would be great if anyone had any helpful suggestions for this. Thank you!!

Code: [Select]
//Variables
var.BThreshold = 10 kg
var.Speed = 75

var.MoveButton = Wiimote.A
Mouse.RightButton = Wiimote.B

Key.W = var.Front - var.Back > var.BThreshold
Key.S = var.Back - var.Front > var.BThreshold
Key.A = var.Left - var.Right > var.BThreshold
Key.D = var.Right - var.Left > var.BThreshold

if Wiimote1.HasBalanceBoard then
   //Use Wiimote2
   var.HasMotionPlus = Wiimote2.HasMotionPlus
   var.PitchSpeed = Wiimote2.MotionPlus.PitchSpeed
   var.YawSpeed = Wiimote2.MotionPlus.YawSpeed
   var.SmoothRoll = Wiimote2.SmoothRoll
   //Balance board at Wiimote2
   var.Front = Wiimote1.BalanceBoard.WeightFront
   var.Back = Wiimote1.BalanceBoard.WeightBack
   var.Left = Wiimote1.BalanceBoard.WeightLeft
   var.Right = Wiimote1.BalanceBoard.WeightRight
elseif Wiimote2.HasBalanceBoard then
   //use wiimote1
   var.HasMotionPlus = Wiimote1.HasMotionPlus
   var.PitchSpeed = Wiimote1.MotionPlus.PitchSpeed
   var.YawSpeed = Wiimote1.MotionPlus.YawSpeed
   var.SmoothRoll = Wiimote1.SmoothRoll
   //Balance board at Wiimote2
   var.Front = Wiimote2.BalanceBoard.WeightFront
   var.Back = Wiimote2.BalanceBoard.WeightBack
   var.Left = Wiimote2.BalanceBoard.WeightLeft
   var.Right = Wiimote2.BalanceBoard.WeightRight
endif

if var.HasMotionPlus and var.MoveButton {
   if SameValue( Smooth(var.SmoothRoll, 10), var.SmoothRoll, 10) then var.Roll = Smooth(var.SmoothRoll, 10) else var.Roll = var.SmoothRoll
   if var.Roll < 0 and var.Roll >= -90 {
      var.XYswap = 1 - EnsureMapRange(var.Roll, -90, 0, 0, 1)
      var.RightDown = -1
      var.TopUp = 1
   }
   if var.Roll <= 90 and var.Roll >= 0 {
      var.XYswap = 1 - EnsureMapRange(var.Roll, 90, 0, 0, 1)
      var.RightDown = 1
      var.TopUp = 1
   }
   if var.Roll > 90 and var.Roll <= 180 {
      var.XYswap = 1 - EnsureMapRange(var.Roll, 90, 180, 0, 1)
      var.RightDown = 1
      var.TopUp = -1
   }
   if var.Roll < -90 and var.Roll >= -180 {
      var.XYswap = 1 - EnsureMapRange(var.Roll, -90, -180, 0, 1)
      var.RightDown = -1
      var.TopUp = -1
   }
   var.SpeedX = var.TopUp * var.YawSpeed - ( var.TopUp * var.YawSpeed * var.XYswap ) + ( var.RightDown * var.PitchSpeed * var.XYswap )
   var.SpeedY = var.TopUp * var.PitchSpeed - ( var.TopUp * var.PitchSpeed * var.XYswap) + ( -var.RightDown * var.YawSpeed * var.XYswap )
   mouse.DirectInputX = int(var.MouseX)
   mouse.DirectInputY = int(var.MouseY)
   var.MouseX = var.MouseX + ( var.SpeedX / (10500000 - EnsureMapRange(var.Speed, 0, 100, 0, 10000000) ) )
   var.MouseY = var.MouseY - ( var.SpeedY / (10500000 - EnsureMapRange(var.Speed, 0, 100, 0, 10000000) ) )
   var.yaw = 0
   var.pitch = 0
}

if var.MoveButton = false then
var.MouseX = Mouse.DirectInputX
var.MouseY = Mouse.DirectInputY
endif