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

leovetto's profile - activity

2016-04-12 20:20:35 -0500 received badge  Famous Question (source)
2016-04-12 20:20:35 -0500 received badge  Notable Question (source)
2016-02-26 16:59:47 -0500 received badge  Famous Question (source)
2015-12-25 09:45:28 -0500 received badge  Popular Question (source)
2015-12-25 09:45:28 -0500 received badge  Notable Question (source)
2015-11-20 08:08:19 -0500 received badge  Scholar (source)
2015-11-20 08:07:20 -0500 received badge  Supporter (source)
2015-11-16 01:49:05 -0500 received badge  Popular Question (source)
2015-11-13 13:41:13 -0500 asked a question publishing marker points python

I have some problems publishing markers in a python node to visualize them on rViz. I have a node that calculates some static points and I want to visualize them (like a path). I also have a robot moving and I want to drop some marks when it reaches some points. I don't want to make an infinite cycle to visualize them, otherwise the rest of the code will not go on. Here is a method that I wrote to visualize the points in the path and it worked sometimes, now I don't know why does never appear anything on rViz:

def print_points(self, points, frame):
    rate = rospy.Rate(5)
    triplePoints = []
     #transform from x,y points to x,y,z points
    for (x,y) in points:
        p = Point() 
        p.x = x
        p.y = y
        p.z = 0
        triplePoints.append(p)

    iterations = 0
    while not rospy.is_shutdown() and iterations <= 10:
        pub = rospy.Publisher(frame, Marker, queue_size = 100)
        marker = Marker()
        marker.header.frame_id = "/map"

        marker.type = marker.POINTS
        marker.action = marker.ADD
        marker.pose.orientation.w = 1

        marker.points = triplePoints;
        t = rospy.Duration()
        marker.lifetime = t
        marker.scale.x = 0.4
        marker.scale.y = 0.4
        marker.scale.z = 0.4
        marker.color.a = 1.0
        marker.color.r = 1.0

        pub.publish(marker)
        iterations += 1
        rate.sleep()

As you can see I tried to use the lifetime and 0 should mean infinite time. I also published the points more times because I've seen that sometimes rviz needed 2-3 times to receive the points. Now it doesn't work anymore.

2015-10-07 10:59:42 -0500 asked a question Using launch file: tf.Exception: Lookup would require extrapolation into the past

Hi, I am using two nodes: the first is a stage from stage_ros, the second is a controller for the robot that I wrote in python. I started using the nodes separately, launching the first from a launch file:

 <launch>
    <node name="stage" pkg="stage_ros" type="stageros"
    args="$(find stage_ros)/world/willow-erratic.world"/>
</launch>

The second from terminal with "rosrun ...". In this way all works fine. If I try to insert the second node in the launch file modifying the launch file in this way

<launch>
    <node name="stage" pkg="stage_ros" type="stageros"
    args="$(find stage_ros)/world/willow-erratic.world"/>

    <node name="controller2" pkg="simplebot" type="controller2.py"/>
</launch>

and now I have some problems with the tf transformation that was working perfectly before. Here is the error that I get when I launch the new launch file:

tf.Exception: Lookup would require extrapolation into the past.  Requested time 4.900000000 but the earliest data is at time 1444231224.668656111, when looking up transform from frame [target] to frame [base_laser_link]. canTransform returned after 5.00914 timeout was 5.

Here is the code that can have something to do with the transformation:

self.sub = rospy.Subscriber('/base_scan', LaserScan, self.laser_callback, queue_size=1)
....
time = rospy.Time(0)
self.tf_listener.waitForTransform('/base_laser_link','/target', time, rospy.Duration(5.0))
(self.t_pos, self.t_ang) = self.tf_listener.lookupTransform('/base_laser_link','/target', time)
....
def position_callback(self, data):
    ...
    #send the target position to tf
    self.br.sendTransform(
        (self.x_target, self.y_target, 0.0), (0.0, 0.0, 0.0, 1.0),
        rospy.Time.now(), '/target', '/odom')

So the problem is that I don't understand why it was working launching the two nodes separately and why is not working with the two nodes in the same launch file