How can I get tf data from ros to v-rep?

Typically: "How do I... ", "How can I... " questions
Post Reply
Quartz
Posts: 4
Joined: 08 Jan 2018, 19:31

How can I get tf data from ros to v-rep?

Post by Quartz » 10 Apr 2018, 16:20

Hello everyone.

I'm working with kinect on ros and v-rep. And I'm using openni_tracker to get the position of my body and send it as a TF data on ROS.
And I'm writing this post because I need to know tp how receive tfdata from a ros node to v-rep using vrep_ros_interface. I created a listener to this tf broadcaster and publish a position data on ros, and this data I could subscribe using simExtRosInterface_subscribe function. But by doing this I'm getting problem with my elbow joint. When I rotate my elbow in order to change my hand position from -z to z (for example). The Z value of my elbow joint increase/decrease, when it's not supposed to. That's why I'm asking about how to subscribe the broadcaster on V-rep and manipulate this data using non-threaded script. Maybe this could fix my problem of elbow joint.

That's the function I'm using on my tf_listener node. Notice that I'm not facing any problems with my shoulder and hand joint, only my elbow joint is getting position problems

Code: Select all

// left shoulder joint 
    left_shoulder_pose.x = transform_left_shoulder.getOrigin().x();
    left_shoulder_pose.y = transform_left_shoulder.getOrigin().y();
    left_shoulder_pose.z = transform_left_shoulder.getOrigin().z();
    // left elbow joint
    left_elbow_pose.x = transform_left_elbow.getOrigin().x();
    left_elbow_pose.y = transform_left_elbow.getOrigin().y();
    left_elbow_pose.z = transform_left_elbow.getOrigin().z();
    // left hand joint
    left_hand_pose.x = transform_left_hand.getOrigin().x();
    left_hand_pose.y = transform_left_hand.getOrigin().y();
    left_hand_pose.z = transform_left_hand.getOrigin().z();
Thanks for everything

Luiz Arthur (Quartz)
Last edited by Quartz on 16 Apr 2018, 18:04, edited 1 time in total.

edward
Posts: 1
Joined: 11 Jan 2018, 09:27

Re: How can I get tf data from ros to v-rep?

Post by edward » 11 Apr 2018, 14:40

Hello,

I made v-rep vehicle simulator several month ago.
I did use `tf` topic to use in ROS and it's working fine.

please see
https://github.com/tigerk0430/V-Rep-Aut ... -Simulator

.ttt file for more detail
Thank you

Quartz
Posts: 4
Joined: 08 Jan 2018, 19:31

Re: How can I get tf data from ros to v-rep?

Post by Quartz » 11 Apr 2018, 18:22

Thanks for these files. But i see that you broadcast a tf from v-rep to ros.

At this part right?

Code: Select all

 transformations = {}
        --transformations[1]=(getTransformStamped(h_vehicle,'base_link',-1,'map'))
        transformations[1]=(getTransformStamped(h_wheelFR,'wheel_link_fr',h_vehicle,'base_link'))
        transformations[2]=(getTransformStamped(h_wheelFL,'wheel_link_fl',h_vehicle,'base_link'))
        transformations[3]=(getTransformStamped(h_wheelRR,'wheel_link_rr',h_vehicle,'base_link'))
        transformations[4]=(getTransformStamped(h_wheelRL,'wheel_link_rl',h_vehicle,'base_link'))
        transformations[5]=(getTransformStamped(h_imu,'imu_link',h_vehicle,'base_link'))
        transformations[6]=(getTransformStamped(h_velodyne,'velodyne_link',h_vehicle,'base_link'))
        transformations[7]=(getTransformStamped(h_gps,'gps_link',h_vehicle,'base_link'))
        --transformations[7]=(getTransformStamped(h_camera,'top_camera',h_vehicle,'base_link'))


        -- Broadcast tf
        simExtRosInterface_sendTransforms(transformations)
What I'm looking is a way to use the tf data that I have on ros, inside V-rep. Like a listener, or a tf subscriber and manipulate it to set the joints of my robot arm

Post Reply