Change a value from ros in vrep

Typically: "How do I... ", "How can I... " questions
Post Reply
Posts: 1
Joined: 22 Feb 2018, 14:40

Change a value from ros in vrep

Post by oscarcanre10 » 23 Feb 2018, 09:24

I am having some issues to pass a variable value from ROS.
First I created a topic with which I communicate, but I don't know how provocate a change in the variable.
The receipt of the variable have to be programmed in Vrep or in ROS?


Posts: 246
Joined: 09 Sep 2013, 19:28

Re: Change a value from ros in vrep

Post by fferri » 23 Feb 2018, 09:55

Have a look at how a ROS publisher and subscriber are handled in V-REP, by looking at the demo scene scenes/rosInterfaceTopicPublisherAndSubscriber.ttt.

Simple subscriber example:

Code: Select all

function cb(msg)
    sim.addStatusBarMessage('Received data: '

-- in sysCall_init / sim_childscriptcall_initialization:
    sub = simROS.subscribe('/mytopic', 'std_msgs/Float32', 'cb')
on the other end you have another ROS node publishing a message of type std_msgs/Float32 on the topic /mytopic

Post Reply