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

Linear velocity transformation in ROS

$
0
0
Hello, I use camera to estimate the linear velocities in camera frame. I would like to transform these estimations of linear velocities from camera frame to robot frame. How can I do that? Are there any available commands can help us? I try to find in tf but only having lookupTwist not for this purpose. Many thanks

tf error: Lookup would require extrapolation into the past

$
0
0
Hi, all. I want to convert a pose from "odom" to "map", I am using codes as follows. void PeopleAgent::TransformPos(const people_msgs::PoseArrayWeighted &msg) { boost::mutex::scoped_lock lock(agent_mutex_); pose_array_weighted_.clear(); geometry_msgs::PoseStamped in; in.header = msg.header; for (int i = 0; i< (int)msg.poses.size(); i++) { in.pose = msg.poses[i]; geometry_msgs::PoseStamped result; try { tf_->waitForTransform("odom", "base_link", in.header.stamp, ros::Duration(0.2)); tf_->transformPose("base_link", in, result); pose_array_weighted_.push_back(std::make_pair(msg.weights[i], result)); } catch (tf::TransformException ex) { ROS_ERROR("%s",ex.what()); ROS_ERROR("point transform failed"); }; } } The above code works fine in my project, However, when the "base_link" is changed to be " map", then errors come up as follows: [ERROR] [1426895120.908823306, 1422676721.758969255]: Lookup would require extrapolation into the past. Requested time 1422676720.347031633 but the earliest data is at time 1422676720.654202231, when looking up transform from frame [odom] to frame [map] [ERROR] [1426895120.908922891, 1422676721.758969255]: point transform failed I also have tried to use tf_->waitForTransform("odom", "map", ros::Time(0), ros::Duration(0.2)); or tf_->waitForTransform("odom", "map", ros::Time::now(), ros::Duration(0.2)); but all failed. Please tell me the reason why above errors come up and how to modify the code. Thank you EDIT: Just now, I found that the above code with "base_link" worked fine only for rosbag files. When it was run in a real robot( turtlebot), same errors with "from frame [odom] to frame [base_link]" came up too. I am very confused and don't know what I should do next.

Publishing tf from base_link to camera using Kinect error

$
0
0
Hello, I'm publishing a tf from base_link to camera_rgb_optical_frame in order to calculate robot motion from camera motion. When doing this using a frame_tf_broadcaster similar to the one seen in the tf tutorials I get the following warning: [ WARN] [1374775573.363920696]: TF exception: Lookup would require extrapolation into the future. Requested time 1374775573.291255712 but the latest data is at time 1374775573.259098846, when looking up transform from frame [/camera_depth_optical_frame] to frame [/camera_rgb_optical_frame] So, when I look at the frames I see the following: ![image description](http://screencloud.net//img/screenshots/1cfec494cb5b78cabd7bcda92979d316.png) As you can see the frame tf broadcast is not being recognized. Am I publishing to the correct frames (base_link -> camera_rgb_optical_frame)? Any idea why the tf isn't being recognized? Thanks, EDIT: adding the code of the frame_tf_broadcaster #include #include int main(int argc, char** argv){ ros::init(argc, argv, "my_tf_broadcaster"); ros::NodeHandle node; tf::TransformBroadcaster br; tf::Transform transform; ros::Rate rate(10.0); while (node.ok()){ transform.setOrigin( tf::Vector3(0.0, 0.0, 2.0) ); transform.setRotation( tf::Quaternion(0, 0, 0) ); br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "base_link", "camera_rgb_optical_frame")); rate.sleep(); } return 0; };

building a map using slam_gmapping

$
0
0
Hello, I am using ubuntu 14.04 and indigo version. Also, I used kinect and custom made robot with encoders. I published laser scan, odom, and tf information and now I'm starting building the map but I faced some problems This the launch file for publishing laser scan information: And I can view the laser scans successfully in rviz. This is the node to publish odom information (the nodes assumes the robot is moving in circle): #include #include #include int main(int argc, char** argv){ ros::init(argc, argv, "odometry_publisher"); ros::NodeHandle n; ros::Publisher odom_pub = n.advertise("odom", 50); tf::TransformBroadcaster odom_broadcaster; double x = 0.0; double y = 0.0; double th = 0.0; double vx = 0.1; double vy = -0.1; double vth = 0.1; ros::Time current_time, last_time; current_time = ros::Time::now(); last_time = ros::Time::now(); ros::Rate r(1.0); while(n.ok()){ ros::spinOnce(); // check for incoming messages current_time = ros::Time::now(); //compute odometry in a typical way given the velocities of the robot double dt = (current_time - last_time).toSec(); double delta_x = (vx * cos(th) - vy * sin(th)) * dt; double delta_y = (vx * sin(th) + vy * cos(th)) * dt; double delta_th = vth * dt; x += delta_x; y += delta_y; th += delta_th; //since all odometry is 6DOF we'll need a quaternion created from yaw geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(th); //first, we'll publish the transform over tf geometry_msgs::TransformStamped odom_trans; odom_trans.header.stamp = current_time; odom_trans.header.frame_id = "odom"; odom_trans.child_frame_id = "base_link"; odom_trans.transform.translation.x = x; odom_trans.transform.translation.y = y; odom_trans.transform.translation.z = 0.0; odom_trans.transform.rotation = odom_quat; //send the transform odom_broadcaster.sendTransform(odom_trans); //next, we'll publish the odometry message over ROS nav_msgs::Odometry odom; odom.header.stamp = current_time; odom.header.frame_id = "odom"; //set the position odom.pose.pose.position.x = x; odom.pose.pose.position.y = y; odom.pose.pose.position.z = 0.0; odom.pose.pose.orientation = odom_quat; //set the velocity odom.child_frame_id = "base_link"; odom.twist.twist.linear.x = vx; odom.twist.twist.linear.y = vy; odom.twist.twist.angular.z = vth; //publish the message odom_pub.publish(odom); last_time = current_time; r.sleep(); } } This the TF node: #include #include #include #include int main(int argc, char** argv){ ros::init(argc, argv, "robot_tf_publisher"); ros::NodeHandle n; ros::Rate r(100); tf::TransformBroadcaster broadcaster; while(n.ok()){ broadcaster.sendTransform( tf::StampedTransform( tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.1, 0.0, 0.2)), ros::Time::now(),"base_link", "base_laser")); r.sleep(); } } I followed the steps in this [tutorial](http://wiki.ros.org/slam_gmapping/Tutorials/MappingFromLoggedData#record) When I reached this command : `rosbag play --clock mylaserdata.bag` the other terminal gives this error: Warning: TF_OLD_DATA ignoring data from the past for frame base_laser at time 1.4273e+09 according to authority unknown_publisher Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained at line 260 in /tmp/buildd/ros-indigo-tf2-0.5.7-0trusty-20141230-0040/src/buffer_core.cpp Also, after typing this command: `rosrun map_server map_saver` it says `Waiting for the map` and didn't do any thing.

Transform Configuration Step

$
0
0
Hello, I'm using Ubuntu 14.04 and ROS indigo. I'm trying to setup my robot to be used with the navigation stack These are the steps that I should follow before using the navigation stack: 1) Transform Configuration (other transforms) 2) Sensor Information (sensor sources) 3) Odometry Information (odometry source) 4) Base Controller (base controller) 5) Mapping (map_server) I'm done with the first four steps and started the mapping but it didn't work. I believe that there is something wrong or missing in the first step (TF) because I don't think I got it right! I read all tutorials and explanation regarding TF but I didn't get full understanding I know that I should make the urdf file and publish it using robot_state_publisher package. But I'm not sure how to publish it? what is required? what is optional? and whether I need modification to fit my robot? May anyone please explain in brief what should I do to complete the TF successfully step by step? Thank you

Introduction to tf installation error

$
0
0
Hello, I found that when following the command "sudo apt-get install ros-hydro-ros-tutorials ros-hydro-geometry-tutorials rviz", I got an error. I resolved this by changing "rviz" to "ros-hydro-rviz". Is this the correct way to do this or should it be working with just "rviz"? http://wiki.ros.org/action/login/tf/Tutorials/Introduction%20to%20tf

Moving a box using tf

$
0
0
Hi to all, I try to move a box in my planning scene using a tf-frame. But it's not working at the moment. I insert the box as shown in the moveit-tutorial and giving it a tf-frame additionally like this: /* The id of the object is used to identify it. */ co_box.id = "box1"; co_box.header.frame_id = "//box_frame"; If I now insert the box, it is correctly inserted at the position and orientation I publish in my tf-broadcaster. But when I move the frame in the broadcaster, I can see the frame moving in Rviz but not the box. What can I do here. Is the box not correctly linked to the tf-frame or do I constantly need to update the planning scene. I'm really stuck here. I would really appreciate if somebody could help me out.

ERROR: Laser has to be mounted planar

$
0
0
Hi, I'm using Ubuntu 14.04 and ROS indigo. I published the TF using static_transform_publisher from tf package. Using the following tag to publish the transformation between the base_link and the camera_link: When I started slam_gmapping node it gives the following error: Laser has to be mounted planar! Z-coordinate has to be 1 or -1, but gave: 0.00000 The problem is solved when I changed the Y coordinate to 1 or -1 . But this is not the right transformation of my robot.

URDF change color

$
0
0
Hi, currently I added bumper on my robot and I have my robot model with bumper. I wan to show in rviz that when the bumper get hit the respective bumper will turn from white to red color. But I couldn't find any example on to to change to color of URDF based on subscribing msg. Is anyone know how to do this? or where can I find the example?

Nav2d_karto mapper doesn't build a map

$
0
0
Hello, I followed the nav2d tutorials to adapt it to a turtlebot. The first two tutorials work well but I have a problem with the 3rd one. I noticed that the mapper node from the nav2d_karto doesn't build a map: no frame are published and the map topic is empty. I get this message when I run the launchfile: [ WARN] [1427816737.545498816]: MessageFilter [target=map ]: Dropped 95.01% of messages so far. Please turn the [ros.rviz.message_notifier] rosconsole logger to DEBUG for more information. Sometimes it's 98% or 100% dropped. And the rviz screenshot related: http://hpics.li/14f0f88 Here is my launch file: and the ros.yaml related: Defines topics services and frames for all modules TF frames laser_frame: camera_link #base_laser_link robot_frame: base_link odometry_frame: odom offset_frame: offset map_frame: map ROS topics map_topic: map laser_topic: scan #base_scan ROS services map_service: static_map And finally the tf tree: http://hpics.li/a627710 Thank you in advance!

Base_link frame is not connected to odom frame

$
0
0
hello, I'm using Ubuntu 14.04 and ROS Indigo I used the following block of code to publish the transformation of base_link frame and odom frame: geometry_msgs::TransformStamped odom_trans; odom_trans.header.stamp = current_time; odom_trans.header.frame_id = "odom"; odom_trans.child_frame_id = "base_link"; odom_trans.transform.translation.x = x; odom_trans.transform.translation.y = y; odom_trans.transform.translation.z = 0.0; odom_trans.transform.rotation = odom_quat; //send the transform odom_broadcaster.sendTransform(odom_trans); Also, I used this launch file to publish the other frames: When the robot start moving I run rviz and it shows the odom frame moving, but the base_link and camera_link are fixed in their initial position. I think I missed something but I don't know what is it. UPDATE: 1) current_time is set inside the loop `while(nodehandle.ok())` and is set to `current_time = ros::Time::now();` 2) `odom_broadcaster` is created outside the loop and at the beginning of the main as `tf::TransformBroadcaster odom_broadcaster;` 3) This is running live 4) When I run `rosrun tf tf_echo odom base_link` it shows values like: At time 1428335473.731 - Translation: [-0.338, 1.148, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.295, 0.955] in RPY [0.000, -0.000, 0.600] At time 1428335474.787 - Translation: [-1.613, 3.059, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.223, 0.975] in RPY [0.000, -0.000, 0.449] 5) This is my tf tree: ![tf tree](/upfiles/1428336712182709.jpg) Also I have this transformation in the launch file: ``

Using TF package to transform rotations

$
0
0
I'm using the Gazebo simulator and gazebo_ros to interface with it. It the simulator, I have a "quadcopter" object. I would like to apply a thrust to the quadcopter. Gazbo_ros offers a way to apply a force to an object, but it can only do so in the world's coordinate frame (i.e. even if my quadcopter is on its side, applying a force in the Z axis will still make it go directly vertical). I'm trying to figure out how to use the TF package to transform between the two coordinate frames. Essentially, with a given Pose vector and Quaternion orientation of the quadcopter model, how can I convert from the quadcopter's Z axis to a vector in the world's coordinate frame? i.e. what force vector in the world's coordinate frame should be applied to give a force in the quadcopter's Z axis?

tf static transform publisher

$
0
0
in tf static transform publisher, what is the different between
static_transform_publisher x y z yaw pitch roll frame_id child_frame_id period_in_ms
and
static_transform_publisher x y z qx qy qz qw frame_id child_frame_id period_in_ms
and what are the values that i'm suppose to use in args such as:
Thank u.

why tf_monitor shows unknown_publisher

$
0
0
When I tf_monitor my frames, I saw all my frames were published by unknown_publisher. Could anyone please give me an idea how that usually happens, and how to solve it? Also, I wonder whether it has anything to do with my strangely behaved AMCL, which seems to update the robot location only by /odom, and did not care about the laser scan (because laser scan does not align to the map). Thank you. RESULTS: for all Frames Frames: Frame: base_link published by unknown_publisher Average Delay: 0.0187717 Max Delay: 0.0346738 Frame: left_back_wheel published by unknown_publisher Average Delay: 0.0250101 Max Delay: 0.0499581 Frame: left_front_wheel published by unknown_publisher Average Delay: 0.0250121 Max Delay: 0.0499596 Frame: odom published by unknown_publisher Average Delay: 0.0589457 Max Delay: 0.109153 Frame: right_back_wheel published by unknown_publisher Average Delay: 0.0250131 Max Delay: 0.0499602 Frame: right_front_wheel published by unknown_publisher Average Delay: 0.0250138 Max Delay: 0.0499608 Frame: rplidar published by unknown_publisher Average Delay: -0.499657 Max Delay: 0 All Broadcasters: Node: unknown_publisher 86.3553 Hz, Average Delay: -0.278273 Max Delay: 0.109153

Z-coordinate has to be 1 or -1

$
0
0
Hello, I'm starting to build a map using gmapping, but whenever I start slam_gmapping, the following warning is shown: Laser has to be mounted planar! Z-coordinate has to be 1 or -1, but gave: 0.00000 This is one of the published transformations: When I change the X argument into 1 or -1 the warning is gone! I don't know why!.But I'm sure there is something wrong!! and I need the X to be 0. any idea?

Filtering transform over time

$
0
0
I am using ar_kinect and I'm getting some noise in the orientation. Since my camera motion is relatively slow I wanted to filter the transforms over time. I have designed an FIR filter. I was wondering what is the best way of filtering the transformations. I was not sure if filtering quaternions would make any sense. Should I convert to RPY and apply the filter?

tf.Exception thrown while using waitForTransform

$
0
0
Hi everyone! I am a ros beginner and I am using ros indigo and tf 1.11.6. I am following the tf tutorials at this site [Learning about tf and time (Python)](http://wiki.ros.org/tf/Tutorials/tf%20and%20Time%20%28Python%29) But I got an error when I changed the code to use listener.waitForTransform("/turtle2", "/carrot1", rospy.Time(), rospy.Duration(4.0)) Here is what i got: Traceback (most recent call last): File "/home/sklaw/Desktop/experiment/ros/indigo/tutorials_ws/src/learning_tf/nodes/turtle_tf_listener.py", line 18, in listener.waitForTransform("/turtle2", "/carrot1", rospy.Time(), rospy.Duration(4.0)) tf.Exception I tried to look up "tf.Exception" in the documentation of tf, but nothing found. so what is wrong with that? Any help would be great! Thanks! here is the code of the turtle_tf_listener.py: #!/usr/bin/env python import roslib roslib.load_manifest('learning_tf') import rospy import math import tf import geometry_msgs.msg import turtlesim.srv import sys, traceback if __name__ == '__main__': rospy.init_node('tf_turtle') listener = tf.TransformListener() rospy.wait_for_service('spawn') spawner = rospy.ServiceProxy('spawn', turtlesim.srv.Spawn) spawner(4, 2, 0, 'turtle2') turtle_vel = rospy.Publisher('turtle2/cmd_vel', geometry_msgs.msg.Twist,queue_size=1) rate = rospy.Rate(10.0) listener.waitForTransform("/turtle2", "/carrot1", rospy.Time(), rospy.Duration(4.0)) while not rospy.is_shutdown(): try: now = rospy.Time.now() listener.waitForTransform("/turtle2", "/carrot1", now, rospy.Duration(4.0)) (trans,rot) = listener.lookupTransform("/turtle2", "/carrot1", now) except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException): continue angular = 4 * math.atan2(trans[1], trans[0]) linear = 0.5 * math.sqrt(trans[0] ** 2 + trans[1] ** 2) cmd = geometry_msgs.msg.Twist() cmd.linear.x = linear cmd.angular.z = angular turtle_vel.publish(cmd) rate.sleep()

rospy tf waitForTransform not waiting

$
0
0
I keep getting lookup extrapolation errors when trying to use tf, even when using listener.waitForTransform. For example I get: Exception: Lookup would require extrapolation into the future. Requested time 1428875486.097693682 but the latest data is at time 1428875486.097676516, when looking up transform from frame [ugv0] to frame [image] The difference in time is less than a millisecond, and even if my timeout duration is very long, I still get an extrapolation error. My code has: tfl.waitForTransform('image',obj_name,timeStamp,rospy.Duration(10.0)) The tf call is in a callback on a topic that has data published to it at a very fast rate, approximately 360hz, and the relevant transforms are also all being published at ~360hz except for a static transform, which is at 10hz. I would attach the pdf of the view frames output, but I dont have enough points to attach files. What is wrong?

robot_localization with GPS + IMU

$
0
0
I'm trying to setup a localization system for my aerial vehicle, however I never used robot_localization or the TF package, so everything seems a little overwhelming, setup wise. I have a couple of questions: 1) Is it possible to use robot_localization with only GPS and IMU? Would the output be any good? 2) I have a bottom camera that is used from ground target detection. Should I use it for some kind of visual odometry? I'm afraid that this will put the processor under too much strain (odroid X2). Can I get some tips on how to setup all of this? I find myself a little lost. EDIT1: Just for some context, my system is an aerial vehicle supported by a balloon that uses two rotors in order to adjust its position: (1-baloon; 5-rotors; 4-bottom camera (webcam); 3-main "box" with GPS, IMU, odroid X2, etc) ![image description](/upfiles/14290375622232288.png) I had already changed the IMU output to be as specified in REP-103. Initially I was using "udm_odometry_node" from gps_common, but switched to the "navsat_transforme_node". For the altitude I'm using the GPS, since the IMU I'm using doesn't have altitude information. The bottom camera (simple webcam) is meant for ground target detection/tracking, however I could use it for some kind of visual odometry if the odroid is able to handle it. I think I was able to setup everything correctly since I'm able to "echo" the output on odometry/filtered. However it seems like it has a lot of noise. I still have to do some real tests, since I only tested this with my laptop and the sensors were stationary. (Note: Are the velocities in Twist set as m/s?) However I got an error when trying to set the process_noise_covariance (type 7 if I recall correctly). Since I was using the covariance from the template launch file, I just deleted it in order to check if everything was working (if I was able to get an output).

Get the projection matrix from odometry/tf data

$
0
0
Hello, I would like to compare my results of visual Odometry with the groundtruth provided by the KITTI dataset. For each frame in the groundthruth, i have a projection matrix. For example: 1.000000e+00 9.043683e-12 2.326809e-11 1.110223e-16 9.043683e-12 1.000000e+00 2.392370e-10 2.220446e-16 2.326810e-11 2.392370e-10 9.999999e-01 -2.220446e-16 Here the instructions provided by the readme: > Row i represents the i'th pose of the> left camera coordinate system (i.e., z> pointing forwards) via a 3x4> transformation matrix. The matrices> are stored in row aligned order (the> first entries correspond to the first> row), and take a point in the i'th> coordinate system and project it into> the first (=0th) coordinate system.> Hence, the translational part (3x1> vector of column 4) corresponds to the> pose of the left camera coordinate> system in the i'th frame with respect> to the first (=0th) frame But I don't know to to produce the same kind of data for me. What I have for each frame: - The Tf transformation from the init_camera (the fix one from the (0,0,0)) to the left camera which is moving. So I have the translation vector and the quaternion rotation. - The odometry data: the pose and the twist - Camera calibration parameters With those data, How I compare with the groundtruth ? So I need to find the projection matrix from the data above but don't know how to do it. Can someone help me ? Thank
Viewing all 844 articles
Browse latest View live


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