Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 25, 2012, 02:17:06 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
Mach SDK plugin questions and answers.
Wiimote plugin
Pages:
1
2
»
Go Down
« previous
next »
Author
Topic: Wiimote plugin (Read 2285 times)
0 Members and 1 Guest are viewing this topic.
rcrabb
Active Member
Offline
Posts: 154
Wiimote plugin
«
on:
December 29, 2009, 05:09:51 PM »
I'm working on a wiimote plugin for mach. Im using Ed's plugin wizard and the wiiuse lib. First I must say Ed did a fantastic job with this wizard and the videos gave my a huge leap forward with my learning curve. I have connected the wiimote to mach and displayed limited data in a dialog. Now Im stuck. The code below works great.
WiiMoteStatus^ wiimotestatus = MG::wiimotestatus;
WiiMoteConfig^ wiimoteconfig = MG::wiimoteconfig;
wiimote** wiimotes;
wiimotes = wiiuse_init(wiimoteconfig->maxwiimotes); // Send the max wiimotes to init (max of 1)
//--------------------------------------------------------------------
// find and connect to the wiimotes
//--------------------------------------------------------------------
if (MG::wiimotestatus) // crashes without this line. learned the hard way
{
if (!wiimotestatus->found) // if we found one wiimote stop looking
{
wiimotestatus->found = wiiuse_find(wiimotes, wiimoteconfig->maxwiimotes, 10); // We look for wiimotes (max of one, look for 10sec)
}
if (!wiimotestatus->connected) // if we are connected dont try to connect
{
wiimotestatus->connected = wiiuse_connect(wiimotes, wiimoteconfig->maxwiimotes);
Now my problem is in the next part-------------------------------------------------------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>
wiiuse_poll(wiimotes, 1);
wiiuse_motion_sensing(wiimotes[0], 1);
wiimotestatus->roll = wiimotes[0]->orient.roll;
if (IS_PRESSED(wiimotes[0], WIIMOTE_BUTTON_A))
{
wiimotestatus->debug = (true);
Everything compiles ok but mach crashes. Now wiiuse_poll is the function to poll the data from the wiiuse dll. it seems im having trouble getting to arrays of data returned.
I hope someone has an idea.
«
Last Edit: December 29, 2009, 05:15:30 PM by rcrabb
»
Logged
Ryan
ART
Administrator
Offline
Posts: 1,080
Tough as soggy paper.
Re: Wiimote plugin
«
Reply #1 on:
December 29, 2009, 09:14:32 PM »
Hi:
>>wiimotestatus->connected = wiiuse_connect(wiimotes, wiimoteconfig->maxwiimotes);
Now my problem is in the next part-------------------------------------------------------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>
wiiuse_poll(wiimotes, 1);
wiiuse_motion_sensing(wiimotes[0], 1);
wiimotestatus->roll = wiimotes[0]->orient.roll;
....
Im not familiar with the wii motes calls, but it seems to me youd want to check to make sure the connection worked by checking
is true or not before calling poll, and after calling connect..
Art
Logged
rcrabb
Active Member
Offline
Posts: 154
Re: Wiimote plugin
«
Reply #2 on:
December 29, 2009, 10:03:52 PM »
Thanks Art.
Ill try that. What kills me is that I get that 9988 error and mach blows up. I have to reboot my computer everytime. And if I dont reboot after some time I get the blue screen. I will say im just learning c++ .NET and I have a long way to go. I was very exited when I got the wiimote connected and toggled one of the wiimote's leds. Now I hit a wall and need help.
Logged
Ryan
ART
Administrator
Offline
Posts: 1,080
Tough as soggy paper.
Re: Wiimote plugin
«
Reply #3 on:
December 29, 2009, 10:51:49 PM »
Hi:
Yeah, Fatal errors tend to do that.. better then the old days of instant blue screen though. Take out a few lines to find what line exactly is causing it. Your code is assuming sucessfull completion by the look of it, if the calls dont properly send you a pointer to the remote though, youll end up querying a null pointer.. and that may be the cause of your trouble..
Art
Logged
ART
Administrator
Offline
Posts: 1,080
Tough as soggy paper.
Re: Wiimote plugin
«
Reply #4 on:
December 29, 2009, 10:52:49 PM »
If it were me, Id breakpoint on the poll line and check the contents of the wiimotes[0] variable..
Art
Logged
rcrabb
Active Member
Offline
Posts: 154
Re: Wiimote plugin
«
Reply #5 on:
December 29, 2009, 11:16:22 PM »
This line crashed me. wiimotes = wiiuse_init(wiimoteconfig->maxwiimotes);
wiimoteconfig->maxwiimotes was the null. I added it and forgot that wiimoteconfig doesnt get gcnew till after postinit.
Now i need to figure out why I dont see any data after the poll. I cant get my code to run in debug so this will be a chalenge.
Logged
Ryan
rcrabb
Active Member
Offline
Posts: 154
Re: Wiimote plugin
«
Reply #6 on:
December 30, 2009, 11:17:11 AM »
I set a breakpoint at the poll line. There is no data in the wiimotes[0]. Now my code sets the first led on the wiimote after it connects so the wiiuse dll must be working. But I cant poll any data.
Logged
Ryan
rcrabb
Active Member
Offline
Posts: 154
Re: Wiimote plugin
«
Reply #7 on:
December 30, 2009, 04:04:15 PM »
Found my problem. I was sending an init call to the dll causing my variables to get wiped out. Now I have a new prob.
My array for the wiimote data is setup with this line.
wiimote** wiimotes;
wiimotes = wiiuse_init(2); <--------size of the array
But the data is gone after each pass through the code.
If i change it to this line.
static wiimote** wiimotes;
wiimotes = wiiuse_init(2); <--------size of the array
The data stays but the array is only one element. Now this is ok because I only plan to connect one wiimote but I would like to know the proper way to setup the arrays to work properly.
Logged
Ryan
ART
Administrator
Offline
Posts: 1,080
Tough as soggy paper.
Re: Wiimote plugin
«
Reply #8 on:
December 30, 2009, 05:27:26 PM »
Hi :
Seems that that would be specific to the wii dll as to function, but I suspect if more than one ispresent, that the dll will create the additional arrays..
Since its a pointer to a pointer its probably simply sending you the internal pointer to that data..
Art
Logged
rcrabb
Active Member
Offline
Posts: 154
Re: Wiimote plugin
«
Reply #9 on:
December 31, 2009, 12:09:42 AM »
Thanks Art for your responses. I have all the accelerometer data and all buttons working. I also have the smoothing algorithm working. Of course all this is a part of the wiiuse dll and only needs to be called, for me it was a huge mountian to climb. A fun project.
Logged
Ryan
Pages:
1
2
»
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...