Welcome, Guest. Please login or register.
Did you miss your activation email?
May 24, 2012, 09:06:40 AM
Home Help Login Register
News: Any Problems or Experience with Industrial Robots ?
Register and place your Question / Answer to worldwide Robotexperts right here !

+  Robotforum | Support for Robotprogrammer and Users
|-+  General Category - Industrial Robot Forum
| |-+  Robot Geometry, Linear Algebra, Forward and Inverse Kinematics
| | |-+  Problem working with Phidget+Matlab
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Problem working with Phidget+Matlab  (Read 307 times)
pamecool2
Newbie
*
Offline Offline

Posts: 1


« on: September 08, 2011, 02:58:26 PM »

Hi!

I'm new in the forum, I have the following problem:

I'm working with a Phidget (0/0/3) sensor, I’m obtaining the data (acceleration in x, y, z) trough Mat lab, currently I’m plotting a vector where the position sensor is pointing, also an Cartesian coordinate system  right in the middle of the plot.

My problem is that I want to stick the axis z direction to the movement of the sensor (position vector)

I hope I explain myself; I’m attaching the code and some images.

Thanks in advance  icon_wink



______________________


close all
t=(0:0.5:50);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%Eje de Coordenadas%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

TA=[0 1 0 0;
    1 0 0 0;
    0 0 1 0;
    0 0 0 1];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%Cosenos Directores%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mod=sqrt(ax^2+ay^2+az^2);

ang1=acos(ax/mod);
ang2=acos(ay/mod);
ang3=acos(az/mod);

for i=1:length(t)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%Aceleración%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

error=calllib('phidget21', 'CPhidgetSpatial_getAcceleration', handle, 0,Acceleration);
ax=(Acceleration.Value);
 
error=calllib('phidget21', 'CPhidgetSpatial_getAcceleration', handle, 1,Acceleration);
ay=(Acceleration.Value);

error=calllib('phidget21', 'CPhidgetSpatial_getAcceleration', handle, 2,Acceleration);
az=(Acceleration.Value);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%Vector de Posición%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

x=(ax*t)/mod;
y=(ay*t)/mod;
z=(az*t)/mod;

pause(.01) % Rate de toma de muestras

col=hsv(150);
plot3(x,y,z,'color',col(i,:));
axis([-2 2 -2 2 -2 2]);
frame(TA,'w',1.5); %Eje de coordenadas
view(128,26);
grid on
title('Vector dirección Phidghet');
drawnow

end
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!