From: Delian Asparouhov on
I am trying to use the Simulink Joystick Library onto a force-feedback joystick. This is the documentation for the force command:

force(joy, n, f) applies force feedback to joystick axis n. The n parameter can be a vector to affect multiple axes. f values should be in range of -1 to 1, and the number of elements in f should either match the number of elements of n, or f can be a scalar to be applied to all the axes specified by n.

I am continuously getting an error that says:
Joystick force-feedback axis number must be between 1 and 1.

This is a bit of an oxymoronic error and was wondering if anyone knew how to properly use the force command. My current code looks like:

function JoystickForce()
joy = vrjoystick(1);
n=[0, 1];
for j = 1:100000
force(joy,n,1);
end

If anyone has any info or advice, that would be great!
From: Steven Lord on

"Delian Asparouhov" <d.asparouhov(a)gmail.com> wrote in message
news:hvob3u$31c$1(a)fred.mathworks.com...
>I am trying to use the Simulink Joystick Library onto a force-feedback
>joystick. This is the documentation for the force command:
>
> force(joy, n, f) applies force feedback to joystick axis n. The n
> parameter can be a vector to affect multiple axes. f values should be in
> range of -1 to 1, and the number of elements in f should either match the
> number of elements of n, or f can be a scalar to be applied to all the
> axes specified by n.
>
> I am continuously getting an error that says:
> Joystick force-feedback axis number must be between 1 and 1.
>
> This is a bit of an oxymoronic error and was wondering if anyone knew how
> to properly use the force command. My current code looks like:
>
> function JoystickForce()
> joy = vrjoystick(1);
> n=[0, 1];
> for j = 1:100000
> force(joy,n,1);
> end
>
> If anyone has any info or advice, that would be great!

Try a simple example first:

joy = vrjoystick(1);
n = 1;
for k = 1:100000
force(joy, n, 1);
end

If that works, then try:

joy = vrjoystick(1);
n = 0;
for k = 1:100000
force(joy, n, 1);
end

then:

joy = vrjoystick(1);
n = 2;
for k = 1:100000
force(joy, n, 1);
end

I'm not certain if the axes of the joystick are 0-based (from the error I
would guess not) or 1-based. If they are 1-based then I would expect the
first and third of those experiments above to work and the second to fail.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Jan Houska on
Hi Delian,

Delian Asparouhov wrote:
> I am trying to use the Simulink Joystick Library onto a force-feedback
> joystick. This is the documentation for the force command:
>
> force(joy, n, f) applies force feedback to joystick axis n. The n
> parameter can be a vector to affect multiple axes. f values should be in
> range of -1 to 1, and the number of elements in f should either match
> the number of elements of n, or f can be a scalar to be applied to all
> the axes specified by n.
>
> I am continuously getting an error that says:
> Joystick force-feedback axis number must be between 1 and 1.
>
> This is a bit of an oxymoronic error and was wondering if anyone knew
> how to properly use the force command. My current code looks like:
>
> function JoystickForce()
> joy = vrjoystick(1);
> n=[0, 1];
> for j = 1:100000
> force(joy,n,1);
> end

I agree that the error message is confusing. But it means that you have
no force-feedback support for your joystick. You can verify it by
calling "caps(joy)" - this will show you the number of available signals
for each type of joystick I/O.

If your joystick is a force-feedback one, it may indicate that you do
not have the proper driver installed. The default system driver does not
support force-feedback even if the joystick has it.

Jan


--
Jan Houska HUMUSOFT s.r.o.
houska(a)humusoft.com Pobrezni 20
http://www.humusoft.com 186 00 Praha 8
tel: ++ 420 284 011 730 Czech Republic
fax: ++ 420 284 011 740
 | 
Pages: 1
Prev: cannot change color for bar plots
Next: GUI Piano