ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Hi, i am working with hokuyo lidar and dynamixel motor ax-12a. Can anybody tell me for which frames i have to provide tf between hokuyo lidar and dynamixel motor?

asked 2016-02-19 02:16:37 -0500

ARCHANA gravatar image

updated 2016-03-11 08:22:28 -0500

alee gravatar image

I want to see the laser scans spinning in rviz. `#include <ros ros.h=""> #include <tf transform_broadcaster.h=""> #include <dynamixel_msgs jointstate.h=""> #include "sensor_msgs/PointCloud2.h" #include <sensor_msgs jointstate.h="">

#include "laser_assembler/AssembleScans.h"

void transform_Callback(const dynamixel_msgs::JointState& msg) { ROS_INFO("broadcasting transform"); }

int main(int argc, char** argv){ ros::init(argc, argv, "tf_broadcaster");

ros::NodeHandle node; ros::Rate rate(30.0); static tf::TransformBroadcaster br; tf::Transform transform; while(ros::ok()) {

transform.setOrigin( tf::Vector3(0.0, 0.0, 0.0) ); tf::Quaternion q; q.setRPY(0, 0, 0); transform.setRotation(q); br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/tilt_laser", "/laser")); ros::Subscriber sub = node.subscribe("/tilt_controller/command", 1000, transform_Callback);

rate.sleep(); ros::spinOnce(); }

return 0; };


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-02-22 04:23:42 -0500

Frames of the TF are not fixed. Some nodes have some defaults that can be (most of the times) changed with ROS parameters when launching the nodes. That said, Hokuyo node usually publishes laserscans in the laser frame. By default, there is also the world frame.

Therefore, all you are missing is a transformation between world and laser that you can set with a TransformBroadcaster publishing the transformation between these frames based on the motor positions.

Usually, there is a link in the middle called base_link which is the main link for a given robot. And usually, transformation between world and base_link is given by a localization node. Therefore, some people just publishes the transformation between base_link and laser.

By the way, I suggest for the next times to have a short, concise title and a more detailed question body, giving a bit more details about your problem. It is hard to know what you exactly want based on just this information.

edit flag offensive delete link more


That means the tf tree will be: world ->laser->base_link. How these transformations are based on motor positions?

ARCHANA gravatar image ARCHANA  ( 2016-02-22 04:39:25 -0500 )edit

@ARCHANA transformations should be world -> base_link -> laser (some more info ). But given that you are having problems, I suggest to forget about base_link so far and just publish a transform from world to laser.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2016-02-22 04:43:17 -0500 )edit

@ARCHANA and how these transformations are based on motor positions is something I cannot answer, because it depends on the real configuration of your motor. If you have no idea, just try some transformations and then try to think in mathematical terms what the transformation is.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2016-02-22 04:46:24 -0500 )edit

If i provide transform between world and laser like here, , and set fixed frame in rviz to world then will i be able to see scans spinning?

ARCHANA gravatar image ARCHANA  ( 2016-02-22 04:59:07 -0500 )edit

@ARCHANA I would say so, unless I am missing something here. But you have to periodically publish the transformation.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2016-02-22 05:11:36 -0500 )edit

Shall i use periodic_snapshotter for publishing transformation periodically.

ARCHANA gravatar image ARCHANA  ( 2016-02-23 11:14:57 -0500 )edit

Hi Javier, can you please tell me what is wrong in my tf_broadcaster file that i provided above because I am not able get 3d pointcloud. The laser frame is not moving. What should i do? Thanks.

ARCHANA gravatar image ARCHANA  ( 2016-03-10 09:23:53 -0500 )edit

Question Tools

1 follower


Asked: 2016-02-19 02:16:37 -0500

Seen: 544 times

Last updated: Mar 10 '16