getObjectOrientation issue

Typically: "How do I... ", "How can I... " questions
Post Reply
Ayubowan
Posts: 2
Joined: 20 Mar 2018, 10:43

getObjectOrientation issue

Post by Ayubowan »

Hello ! I'm glad to post here, this community seems to be very nice.
First of all, sorry about my english, I'm french ;)

So, I would like to control the V-rep Quadricopter through Matlab/Simulink. I use shared memory to send the quadricopter position and orientation. But I have an issue : the orientation function returns nil values I think. I use addStatusbarMessage to check the values : position is ok but orientation not (incorrect type for the addStatusbarMessage arguments).

Here is the code :

Code: Select all

if (sim_call_type==sim.syscb_sensing) then
    -- quadAttitude
    position=sim.getObjectPosition(d,-1)
    orientation=sim.getObjectOrientation(d,-1)
    
    for i=1,3,1 do
        pos_or[i]=position[i]
        sim.addStatusbarMessage(pos_or[i])
    end
    
    for i=4,6,1 do
        pos_or[i]=orientation[i]
        sim.addStatusbarMessage(pos_or[i])
    end
    
    data_write=sim.packFloatTable(pos_or,0,6)
    result=simExtShareMemoryWrite(floatMem_OUT,data_write)
end
I'm quite a newbie so the error will probably be very simple ^^
Thanks in advance and have a nice day !

Ayubowan
Posts: 2
Joined: 20 Mar 2018, 10:43

Re: getObjectOrientation issue

Post by Ayubowan »

I found the issue myself. It was, as predicted, stupid !

The loop that was wrong :

Code: Select all

for i=4,6,1 do
        pos_or[i]=orientation[i]
        sim.addStatusbarMessage(pos_or[i])
    end
Loop corrected :

Code: Select all

for i=4,6,1 do
        pos_or[i]=orientation[i-3]
        sim.addStatusbarMessage(pos_or[i])
    end

ljstao
Posts: 1
Joined: 16 Jul 2018, 04:37

Re: getObjectOrientation issue

Post by ljstao »

hi Ayubowan :
what share memory Plugin do you used?
I know that vrep3.5 has integrated a plugin, and dds has also developed a plugin inthis topic. But I don't know how to configure them, can you share your configuration method? a Template would be better. hope you can understand me, I'm from china...
thanks

Post Reply