Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all 844 articles
Browse latest View live

undefined reference to `tf::TransformBroadcaster::TransformBroadcaster()'

$
0
0
Hi all when I learn the tf with ros wiki, some questions happened. it said:undefined reference to `tf::TransformBroadcaster::TransformBroadcaster()` But at the CMakeLists.txt I add tf in the find package and the catkin_package. at package.xml I add `tftf` and `tf` I dont kown why undefined Thanks all this is my code. #include #include #include #include"ros/ros.h" #include #include using namespace std; string turtle_name; void poseCallback(const turtlesim::PoseConstPtr &msg) { static tf::TransformBroadcaster br; tf::Transform transform; transform.setOrigin(tf::Vector3(msg->x, msg->y, 0.0)); tf::Quaternion q; q.setRPY(0, 0, msg->theta); transform.setRotation(q); br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "world", turtle_name)); } int main(int argc, char **argv) { ros::init(argc, argv, "my_tf_broadcaster"); if(argc != 2) { ROS_ERROR("need turtle name as argument"); return -1; } turtle_name = argv[1]; ros::NodeHandle node; ros::Subscriber sub = node.subscribe(turtle_name + "/pose", 10, &poseCallback); ros::spin(); return 0; }

"right_arm_base_link" passed to lookupTransform argument target_frame does not exist.

$
0
0
ros kinetic, ubuntu 16.04, gazebo 7, intera 5.2 (for sawyer robot), kinect camera in simulation. trying to transform pointcloud from kinect frame to base from of a sawyer robot. i've coded for this inside another void function that estimates the normals for each point in a point cloud. trying to use `transformPointCloud` from `/tf`. code compiles properly, but i get the error in the title of the question. This is the code i'm using. tf::TransformListener listener; tf::StampedTransform transform; // Perform point cloud transformation listener.lookupTransform("/right_arm_base_link", "/depth_link", ros::Time(0), transform); // based on line 129 /tf/tf.h pcl::PointCloud::Ptr trans_cloud (new pcl::PointCloud); pcl_ros::transformPointCloud("/right_arm_base_link", *cloud_with_normals, *trans_cloud, listener); // based on line 131 /pcl_ros/transforms.h // Publish transformed point cloud sensor_msgs::PointCloud2 ros_trans_out; pcl::toROSMsg( *trans_cloud, ros_trans_out); tf_pub.publish (ros_trans_out); `*cloud_with_normals` is of type `PointCloud2` and is my point cloud in. `*trans_cloud` is my point cloud out, also `PointCloud2`. the goal is to be able to publish the transformed point cloud to a rostopic (publisher has been omitted from the question). my concern is that `right_arm_base_link` is not being recognised, but it appears in the transformation tree when i used `$ rostopic echo /tf`. I can also use the following to determine the actual transformation between `right_arm_base_link` and `depth_link`: $ rosrun tf tf_echo right_arm_base_link depth_link and it will yield: At time 2358.846 - Translation: [0.547, 0.183, 0.017] - Rotation: in Quaternion [-0.081, 0.701, 0.080, 0.704] in RPY (radian) [-0.336, 1.567, -0.108] in RPY (degree) [-19.257, 89.763, -6.202] At time 2359.846 - Translation: [0.547, 0.183, 0.017] - Rotation: in Quaternion [-0.081, 0.701, 0.080, 0.704] in RPY (radian) [-0.335, 1.567, -0.107] in RPY (degree) [-19.206, 89.763, -6.146] can anyone suggest what i'm doing wrong or how to fix this issue? i will provide more detail if and when needed. Thanks in advance! ~ Luke

Turn a quaternion

$
0
0
Hey there I have a quaternion q and I would like to turn that. Therefore I tried: tf::Quaternion q( four_result_pose.orientation.x, four_result_pose.orientation.y, four_result_pose.orientation.z, four_result_pose.orientation.w); tf::Matrix3x3 m = tf::getRotation(q); tf::Matrix3x3 x_90_deg_turn; tf::Matrix3x3 result_matrix = m *x_90_deg_turn.setRPY(1,0,0); //(TODO - DOES NOT WORK) // TODO how to give back the quaternion result? Is there any Matrix3x3 function to convert a Matrix3x3 to a quaternion??? **Solution** tf::Quaternion q( four_result_pose.orientation.x, four_result_pose.orientation.y, four_result_pose.orientation.z, four_result_pose.orientation.w); tf::Matrix3x3 m(q); tf::Matrix3x3 x_90_deg_turn; x_90_deg_turn.setEulerYPR(+1.57079632679, 0, 0); tf::Matrix3x3 result_matrix = m*x_90_deg_turn; double res_yaw; double res_pitch; double res_roll; result_matrix.getRPY(res_yaw, res_pitch, res_roll); q.setRPY(res_yaw, res_pitch, res_roll); Do not know how to turn it correctly?? How to set setEulerYPR(+1.57079632679, 0, 0); So that the outer coordinate systems are turned into the one in the middle around the x axis by 90 degree. so that the y axis goes up the x axis right and the z axis out of the image. See this image: [C:\fakepath\Screenshot from 2018-05-30 11:20:49.png](/upfiles/15276720974115239.png)

tf problem of stereo_odometer in viso2_ros

$
0
0
I am simulating a four wheel robot with a stereo camera. When I: "rosrun viso2_ros stereo_odometer", a WARN comes: [ WARN] [1527666187.078464034, 18.886000000]: The tf from '/base_link' to 'TOPY_robot/left_camera' does not seem to be available, will assume it as identity! Actually I have already used: static_transform_publisher to publish the tf as following: I also checked it with rostopic echo: luxiaojun@luxiaojun-P50:~/catkin_ws$ rostopic echo /tf transforms: - header: seq: 0 stamp: secs: 1248 nsecs: 724000000 frame_id: "/base_link" child_frame_id: "TOPY_robot/left_camera" transform: translation: x: 0.215 y: 0.06 z: 0.5289 rotation: x: 0.0 y: 0.0 z: 0.0 w: 1.0 rostopic echo /TOPY_robot/zedcamera/left/image_raw/header seq: 195 stamp: secs: 39 nsecs: 238000000 frame_id: "TOPY_robot/left_camera". Can anyone help me ? Thank you.

static_transform_publisher acting weird when giving tranlation and rotation both

$
0
0
I am playing a rosbag containing pointclouds on ros kinetic. I need to set the tf so that it is at a decent location to the [Panda robot](https://frankaemika.github.io/) for some task. The following is the relevant line from my launch file that set the static transform When running the code like this (with translation and rotation given) the result is: At time 1527473959.781 - Translation: [0.397, -1.842, 0.671] - Rotation: in Quaternion [-0.815, -0.057, 0.082, 0.571] in RPY (radian) [-1.914, 0.068, 0.188] in RPY (degree) [-109.640, 3.898, 10.784] When just rotation or translation is given it works fine. Any help is greatly appreciated. Thank you in advance.

Rtabmap cannot generate transform map->odom while fusing odometry topic from robot_localization or wheel encoder

$
0
0
Hi there, I was working on a project using CLEARPATH Jackal as the platform. Using kinectv2 and `Rtabmap` to generate an indoor map. I want to fuse `/odometry/filtered` topic from `robot_localization` package into `Rtabmap`. I have changed the `fame_id` in `rgbd_mapping_kinect2.launch` to `base_link` and disabled the transform from `visual_odometry`. But it still crashed, showing no image in Rviz. Any thoughts? Thank you! And the output of launch file saying did not receive data since 5 seconds, but all the topics are published.

tf_change_notifier

$
0
0
I find tf_change_notifier node. But I don't know how to use this one. Such as tf_remap, how to use it?

TF tree breaks if parent is lost?

$
0
0
In a multiple robot situation, will all child coordinate frames in a TF tree stop working if communication with the parent is lost? For example, I have two aircraft that are trying to localize themselves to a ground target. The first aircraft (aircraft 1) is able to see the ground target and track it using the transformation from ground target to aircraft 1. The second aircraft (aircraft 2) can only see aircraft 1. Currently, our parent in our TF tree is aircraft 2's frame. If communication is lost between aircraft 1 and aircraft 2, can aircraft 1 no longer compute the transformation between itself and the ground target? If this is the case, is there a workaround for this problem? Or is TF just not reliable for multiple robots with intermittent coms? I've searched for this topic and it seems like it is a fairly fundamental concept, however, I was unable to find the answer. If I missed some link that obvious, please let me know. Thanks. Edit: I don't have enough Karma to upload a figure, but here is what my TF tree looks like. We are not localizing in a world frame, but rather everything is relative to Aircraft 2. In theory, if we don't have the transform from Aircraft 2 to 1, we should still have the transform from Aircraft 1 to the ground target in some other relative coordinate frame. You can also view Aircraft 2 as a world frame. If you lose contact with the world frame, will TF still allow for locally observed coordinate frames to be calculated assuming Aircraft 1 has a bearing and range to the ground target? Aircraft 2 --------> Aircraft 1 ---------> Ground target Another view of this could be: World ----------> Robot -----------> Target If World to Robot is lost, can Robot to Target still be calculated in TF or will TF break if the parent coordinate frame is no longer communicating? This is not to be confused with: Target <---------- World ----------> Robot In which case it is clear that if the World is lost, Robot to Target cannot be calculated. Edit2: I can now attach an image of my TF tree. If I lose handoff_mav_1, can I still calculate the link circled in red? ![image description](/upfiles/15283264658234256.jpg)

rosbag play does not publish world TF if the replay does not start from the beginning

$
0
0
Hi, I created a launch file to replay my bag files from experiments. The launch file accepts "rate" and "start" as input parameters as well as the bag file name Everything works if I set start:=0.0, however I have that some of the TF (e.g. the ones related to the world and the sensors attached to the trunk of my robot) are not published. An error message I see in the Grid plugin in rviz is: "For frame [world]: No transform to fixed frame [trunk]. TF error: [Could not find a connection between 'trunk' and 'world' because they are not part of the same tree.Tf has two or more unconnected trees." It seems a synchronization issue. I set as suggested use_sim_time = true and rosbag play --clock. Anybody as any idea? My launch file is:

Unable to build on the map

$
0
0
Dear ros wizards, I am trying to make a map with octomap. For this, i am running gmapping (to get the map) and octomap altogether. GMapping is working perfect. However, for octomap, adding pointcloud2 topic in RVIZ gives out the following error: > For frame [velodyne]: No transform to > fixed frame [map]. TF error: [Lookup > would require extrapolation into the > past. Requested time > 1528145073.585485000 but the earliest data is at time 1528715125.526055026, > when looking up transform from frame > [velodyne] to frame [map]] However, there exists a trsnsform between map and velodyne. This can be seen in the below image: ![image description](/upfiles/15287154195762077.png) On the same hand; the markerarray topic gives out the following error in RVIZ: Message removed because it is too old (frame=[odom], stamp=[1528145113.324384000]) Please Note: I have ran the same bagfile/dataset on gmapping, cartographer and hector slam without any flaw. Please Note: When changing topic from map to any other frame (odom, camera, base_link, velodyne etc); it works okey; but the quality of map acquired is worthless than due to obvious reasons.

Slow updates in the tf tree. How to deal with it ?

$
0
0
Let say I have a node that publishes a transform from /map to /world. This transformation will be updated at a very slow rate compared to everything else. Now if I need to call tf transformation lookup, I get "extrapolation in the future" errors. One way to deal with it, is to have the node continually pushing the latest transformation so that it gets updated more often. However, that seems more like a hack than an actual solution. What would be the correct way to deal with such situation ?

Robot is not moving to goal

$
0
0
I have a simulation in gazebo with two husky robots. I launch move_base_mapless_demo.launch file so i can send goals to a robot. When I'm using simulation with one husky robot, it moves to correct spot, but when there are two husky robots then the robot never reaches its goal and it never stops. I don't use any map although i thought that is causing the problem... I use this command to move robot to a goal rostopic pub /husky2/move_base_simple/goal geometry_msgs/PoseStamped '{header: {stamp: now, frame_id: "/husky1_tf/odom"}, pose: {position: {x: 1.0, y: 0.0, z: 0.0}, orientation: {w: 1.0}}}' this is my move_base launch file i believe the problem is in frames but I don't quiet understand what should I do to fix the problem. Basically, I want husky2 to go to a goal when there's other robot. frames.pdf looks good to me. map -> husky1_tf/odom -> husky1_tf/base_link map -> husky2_tf/odom -> husky2_tf/base_link

Reducing the publishing rate of a topic from RosLaunch

$
0
0
Hi there, I have a custom-built robot which I am trying to control with move_it. I have written the urdf and generated the srdf using the move_it setup assistant. All the topics from my URDF are being broadcast on tf links at 30Hz based on a sensor_msgs/JointState node I wrote. I am trying to link the base of my robot to the vicon `/world` coodinate frame (I am using the [vicon_bridge package](http://wiki.ros.org/vicon_bridge) ). For some reason, I find that the frames being broadcast by vicon are crazily high (to the order of 200 - 400Hz) and as a result, move_it is not updating the tf transforms because of errors such as the following: ```ERROR] [1477965797.682768512]: Transform error: Lookup would require extrapolation into the future. Requested time 1477965797.631547473 but the latest data is at time 1477965797.626859796, when looking up transform from frame [headnball_link] to frame [world] ``` My `tf` `view_frames` is given by the attachment in the link http://tinypic.com/r/23uwtmo/9 . Is there a way to specify the publish limit to a nodefrom within a roslaunch file?

Should tf frames exist at all times?

$
0
0
I am interested to know from the authors of TF if the nodes/joints in a tf tree are expected to exist during all the time the robot is up and running? As an example: using tf to spawn new joints (for example object grasped will have its tf spawned, as a child node of the gripper) and then let it disappear once the grasped object is put down. Or imagine two robots that could dock to each other (like a locomotive and wagons) and then a link would be spawned between both robots. would that infringe the rules of using tf? What would speak against it? And what would be an alternative solution in that case?

Sync problems between ROS and Gazebo

$
0
0
Hi all, I built a simple simulated environment and a diff-drive robot (with an Hokuyo and a Kinect) in Gazebo to perform some mapping experiments. All the config files are in [this](https://github.com/schizzz8/lucrezio_simulation_environments) repository and you may test it by running: > roslaunch lucrezio_simulation_environments empty_world_with_apartment_and_robot.launch After running the experiments I noticed strange behaviors. This is what happens when I try to localize the robot on a map that I previously built and, at the same time, on RViz I want to visualize the colored point cloud returned by the Kinect: https://youtu.be/v7DAr12hxO0 The only interpretation I can give is that there is some delay in the published transforms. To check this, I wrote a minimal node that does the following: - listens to `/scan` topic to receive laser messages - uses `tf::TransformListener` to receive the TF between `/odom` and `/base_footprint` frames this is the code: void laserCallback(const sensor_msgs::LaserScan::ConstPtr &laser_msg){ ros::Time stamp = laser_msg->header.stamp; ROS_INFO("Laser msg timestamp: %f",stamp.toSec()); tf::TransformListener odom_listener; tf::StampedTransform odom_tf; try{ odom_listener.waitForTransform("/odom", "/base_footprint", stamp, ros::Duration(1.0)); odom_listener.lookupTransform("/odom", "/base_footprint", stamp, odom_tf); } catch (tf::TransformException ex){ ROS_ERROR("%s",ex.what()); } ROS_INFO("Odom tf timestamp: %f",odom_tf.stamp_.toSec()); } when I execute it, this is what I get: dede@srrg-02:~$ rosrun lucrezio_semantic_mapper pose_broadcaster_node [ INFO] [1529497453.859222896, 17.178000000]: Laser msg timestamp: 17.145000 [ERROR] [1529497454.891297562, 18.207000000]: Lookup would require extrapolation into the past. Requested time 17.145000000 but the earliest data is at time 17.356000000, when looking up transform from frame [base_footprint] to frame [odom] [ INFO] [1529497454.891428167, 18.207000000]: Odom tf timestamp: 0.000000 [ INFO] [1529497454.902422031, 18.218000000]: Laser msg timestamp: 18.196000 [ERROR] [1529497455.937621922, 19.248000000]: Lookup would require extrapolation into the past. Requested time 18.196000000 but the earliest data is at time 18.356000000, when looking up transform from frame [base_footprint] to frame [odom] [ INFO] [1529497455.937735340, 19.248000000]: Odom tf timestamp: 0.000000 if, instead of `stamp`, I pass `ros::Time(0)` as argument to **waitForTransform()** and **lookupTransform()** I get no error but I see that the laser message stamp and the tf stamp have a not negligible difference: dede@srrg-02:~$ rosrun lucrezio_semantic_mapper pose_broadcaster_node [ INFO] [1529497759.281287706, 321.114000000]: Laser msg timestamp: 321.107000 [ INFO] [1529497759.484725587, 321.317000000]: Odom tf timestamp: 321.316000 [ INFO] [1529497759.499681070, 321.331000000]: Laser msg timestamp: 321.308000 [ INFO] [1529497759.685763872, 321.516000000]: Odom tf timestamp: 321.516000 Please, can someone explain me what is happening and how to tackle this problem? Thanks.

Apply transformation matrix to existing frame

$
0
0
As the title says, I have a frame, which comes by default in the Kinect, and then I calculated a 4x4 transformation matrix. How can I apply it to the existing frame? Thanks in advance.

Running two subscribers concurrently in the same node

$
0
0
I am working on a problem and need to use the most recent pose from `amcl/future` (my self-designed topic) and publish it as a `tf` between two frames. I made two subscribers for: `amcl_pose/future` and `clock`. The subscriber for `amcl_pose/future` **updates** a `pose` struct inside my code whenever it receives a new pose estimate from amcl; the subscriber for `clock` ignores the `clock` message and publish the most recent pose from the structure to `tf` (basically use it to publish `tf` in a high rate). The problem is that **the `amcl_cb` function is never called** by ROS. I believe it might be a concurrency issue because the two callbacks share the same data structure. What is the "correct" way to implement this? My code snippet is provided. **Note: the pose published is not the amcl estimated pose. ** **The `parent_frame` and `child_frame` are only to simplify the snippet, so it is not related. ** void amcl_cb(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr& p){ pose.header = p->header; pose.pose = p->pose; } void clock_cb(const rosgraph_msgs::Clock::ConstPtr& dummy){ tf::TransformBroadcaster broadcaster; broadcaster.sendTransform( tf::StampedTransform( tf::Transform( tf::Quaternion(pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w), tf::Vector3(pose.position.x, pose.position.y, pose.position.z)), ros::Time::now(),"parent_frame", "child_frame")); } int main(int argc, char** argv){ ros::init(argc, argv, "robot_tf_publisher"); ros::NodeHandle n; ros::Subscriber amcl_sub = n.subscribe("amcl_pose/future",1000, amcl_cb); ros::Subscriber clock_sub = n.subscribe("clock",1000, clock_cb); ros::spin(); }

How does AMCL publishes tf using pose?

$
0
0
In my project, I am able to obtain a special pose (a future pose based on prediction) of a robot, and I need to publish the pose as tf from `map` to `odom_future` frame (my new frame). I know that amcl has provided such a tf publishing code. Therefore, I try to use the AMCL code to write a publisher that convert a pose and publish tf like amcl. However, I encountered some difficulties. In the amcl_node.cpp file, it contains the following lines: // subtracting base to odom from map to base and send map to odom instead geometry_msgs::PoseStamped odom_to_map; ... tf2::Quaternion q; q.setRPY(0, 0, hyps[max_weight_hyp].pf_pose_mean.v[2]); tf2::Transform tmp_tf(q, tf2::Vector3(hyps[max_weight_hyp].pf_pose_mean.v[0], hyps[max_weight_hyp].pf_pose_mean.v[1], 0.0)); geometry_msgs::PoseStamped tmp_tf_stamped; tmp_tf_stamped.header.frame_id = base_frame_id_; tmp_tf_stamped.header.stamp = laser_scan->header.stamp; tf2::toMsg(tmp_tf.inverse(), tmp_tf_stamped.pose); //invert the given pose this->tf_->transform(tmp_tf_stamped, odom_to_map, odom_frame_id_); ///subtraction occurs here ... I tried to use this snippet to help build my tf broadcaster, but it gives the error: "Do not call canTransform or lookupTransform with a timeout unless you are using another thread for populating data. Without a dedicated thread it will always timeout. If you have a seperate thread servicing tf messages, call setUsingDedicatedThread(true) on your Buffer instance."; My only major modification is the time stamp, because my node does not subscribe a laser scan (I also tried to subscribe a laser scan, and use the timestamp, but it doesn't work as well): tmp_tf_stamped.header.stamp = ros::Time::now(); I've also tried `setUsingDedicatedThread(true)`. The error disappears, but the node doesn't do anything. Questions: 1. What exactly does `tf_->transform(...)` do? I couldn't find any documentation about this function. 2. Does the error originated from the timestamp? 3. Is there any other elegant way to compute the tf between `map` and `odom_future` from pose? (in the same way of `odom` frame).

What is tf/static_transform_publisher equivalent in tf2?

$
0
0
Hi, I am attempt to migrate everything related with tf to tf2. In my case, I am not sure what is tf/static_transform_publisher equivalent in tf2? Thanks.

How to migrate tf data types such as Queternion, Vecotr3, Transform to tf2?

$
0
0
There is not much mentioned about tf2 datatypes on tf2_ros documentation at http://docs.ros.org/latest/api/tf2_ros/html/c++/. While comparing to http://docs.ros.org/latest/api/tf/html/c++/, we don't have any data types mentioned. My C++ code has plenty of tf datatypes such as tf::Quaternion q(msg->pose[index].orientation.x, msg->pose[index].orientation.y, msg->pose[index].orientation.z, msg->pose[index].orientation.w); tf::Transform transform; How will I migrate them to tf2_ros?
Viewing all 844 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>