How to get data values from struct and save it in struct

Hi all. First define what is rpoint, and rset: rpoint is from Robotic Toolbox funciton that define robot-positions with coordinates and motion-properties. rset sets up interpreter-, toolbox- and motion-properties
Syntax:
Point = rpoint( x,y,z,o,a,t, 'pose', 'RELATION', 'INTERPOLATION',['PROPERTY', VALUE ])
Example :
Point = rpoint(177.957,349.963,-229.418,15.983,179.610,-162.582)
Syntax:
ID = rset( HANDLE, 'PROPERTY', VALUE, ['now'])
Example:
rset( HANDLE, 'base', rpoint(10,10,10,0,0,0) );
I need to get values from struct and put them into code line, like this:
Kawasaki = 1; % HANDLE
getPoseValue = [Pose.x,Pose.y,Pose.z,Pose.o,Pose.t,Pose.j1,Pose.j2,Pose.j3,Pose.j4,Pose.j5,Pose.j6,Pose.poscfg,Pose.typ,Pose.move,Pose.signal,Pose.pulse,Pose.speed,Pose.acceleration,Pose.deceleration,Pose.accuracy,Pose.wait];
temp = num2cell(getPoseValue);
rset( Kawasaki, 'base', rpoint(temp{:}) );
But it does not work well:
Struct contents reference from a non-struct array object.
Error in rset
Error in testtt (line 4)
rset( Kawasaki, 'base', rpoint(temp{:}) );
I need to get values from struct and put them into code line, like this:
It will help me with getting the actual pose and defines is as base.
If anyone can help with this I'll be gratefull.

댓글 수: 7

Hello Damian,
can you provide the source of the documentation? I have installed the Robotics System Toolbox but cannot find the command in the documentation. Which Matlab version are you using?
Damian
Damian 2018년 1월 23일
편집: Damian 2018년 1월 23일
The source is here:
But you must have login and password to download it. I'll have but i don't have permission to share it with you. Here i can show you help_files with i uploaded to my private google drive folder:
Sorry, but I hope you understand I am not going to open .rar-files from private Google drives. I think your call of the rpoint function is not working well since the arguments do not correspond to the required input arguments.
Error in testtt (line 4)
rset( Kawasaki, 'base', rpoint(temp{:}) );
You might want to try the following:
Point = rpoint(Pose.x, Pose.y, Pose.z, Pose.o, Pose.a, Pose.t,...
'pose',...
'RELATION',...
'INTERPOLATION',...
['PROPERTY', VALUE ]);
rset(Kawasaki, 'base', Point);
Answer to this is:
Point = rpoint(Pose.x,Pose.y,Pose.z,Pose.o,Pose.a,Pose.t);
rset( Kawasaki, 'base', Point);
but still i can't set rset:
Struct contents reference from a non-struct array object.
Error in rset
Error in testtt (line 3)
rset( Kawasaki, 'base', Point);
What shows up for class(Point) ?
Could you check in case Pose.x or .y or .z or .o or .a or .t are not scalars ?
>> class(Point)
ans =
'struct'
>> class(Pose.x)
ans =
'double'
>> class(Pose.y)
ans =
'double'
>> class(Pose.z)
ans =
'double'
>> class(Pose.o)
ans =
'double'
You could try
dbstop if caught error
and run, which might get you into the debugger at the line in rset that is complaining; from there you might be able to trace back to see what it is trying to access and where that variable came from.

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2018년 1월 23일

1 개 추천

rpoint can take at most 6 numeric parameters before it needs 'pose' followed by a string representing a relationship followed by a string representing an interpolation, with name/value pairs after that. You are passing in something like 20 numeric parameters instead. I suspect that rpoint is failing and is returning [] instead of the structure that rset expects.
Damian
Damian 2018년 1월 24일
OK, the main problem was that rset works ok only with true robot connection. Today I installed KAWASAKI-Visualization Toolbox for Matlab with Virtual Robot and i made an virtual connection.
Point = rpoint(Pose.x,Pose.y,Pose.z,Pose.o,Pose.a,Pose.t);
rset( Kawasaki, 'base', Point);
Thank you all for taking the time for me.

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

질문:

2018년 1월 23일

답변:

2018년 1월 24일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by