simxPackFloats in ROS

Typically: "How do I... ", "How can I... " questions
Post Reply
mamagosia
Posts: 5
Joined: 11 Jan 2018, 18:48

simxPackFloats in ROS

Post by mamagosia » 15 Jan 2018, 21:39

Hello,

I found function simxPackFloats in Remote API. I want to send data from Python script to V-REP via ROS in similar way, like it happens in Remote API, without Remote API. How are those data packed?
E.g. I have got:

Code: Select all

tab = [1.222, 2, 3.55555555, 0, 0, 4]
and after simxPackFloats it will be:

Code: Select all

     1.222     2.000     3.556     0.000     0.000     4.000
or something like that:

Code: Select all

['1.22', '2.00', '3.56', '0.00', '0.00', '4.00']

coppelia
Site Admin
Posts: 6361
Joined: 14 Dec 2012, 00:25

Re: simxPackFloats in ROS

Post by coppelia » 17 Jan 2018, 10:23

Hello,

have a look at the simxPackFloats function in the python remote API. But basically, in plain C we would have:

Code: Select all

float myFloats[]={1.222f, 2.0f, 3.55555555f, 0.0f, 0.0f, 4.0f};
char* packedFloats=(char*)myFloats;
Cheers

Post Reply