Ask Your Question

trbf's profile - activity

2018-02-07 15:30:57 -0500 received badge  Taxonomist
2016-12-15 20:53:41 -0500 received badge  Student (source)
2015-04-07 12:48:43 -0500 received badge  Notable Question (source)
2015-04-07 12:48:43 -0500 received badge  Famous Question (source)
2014-07-15 21:42:52 -0500 received badge  Famous Question (source)
2014-03-17 01:47:06 -0500 received badge  Popular Question (source)
2013-12-30 11:29:39 -0500 received badge  Famous Question (source)
2013-11-17 03:57:41 -0500 received badge  Notable Question (source)
2013-11-10 18:51:28 -0500 received badge  Popular Question (source)
2013-11-10 03:46:08 -0500 commented answer one node subscribes two hokuyo laser python [solved]

I tried that but this error appear: TypeError: callback() takes exactly 10 arguments (1 given) [ERROR] [WallTime: 1384098176.620008] bad callback: <function callback2="" at="" 0x2572ed8=""> Traceback (most recent call last): File "/opt/ros/groovy/lib/python2.7/dist-packages/rospy/", line 681, in _invoke_callback cb(msg) TypeError: callback2() takes exactly 10 arguments (1 given)

2013-11-10 01:01:46 -0500 commented question one node subscribes two hokuyo laser python [solved]

I think that it is wrong because i made it by intuition. I am gonna put the error and the all code in the topic. Thank you

2013-11-09 16:24:33 -0500 asked a question one node subscribes two hokuyo laser python [solved]


I am using two laser hokuyo, one on top of the other to make a 360 degrees scan. I am working in python and i am making a node that simply join the information that come from the different topics.

However i don't know how to make to callbacks in the same node.I simply want that each call back calls from one topic, so that i can read both ranges and join them.

Can you help me?


The error is:

[ERROR] [WallTime: 1384088332.419696] bad callback: <function callback2="" at="" 0x29cbed8=""> Traceback (most recent call last): File "/opt/ros/groovy/lib/python2.7/dist-packages/rospy/", line 681, in _invoke_callback cb(msg) File "/home/tiago/catkin_ws/src/test_python/", line 32, in callback2 cerebro(); File "/home/tiago/catkin_ws/src/test_python/", line 38, in cerebro copy(); File "/home/tiago/catkin_ws/src/test_python/", line 68, in copy pub.publish(LaserScan(laser)) File "/opt/ros/groovy/lib/python2.7/dist-packages/sensor_msgs/msg/", line 80, in __init__ super(LaserScan, self).__init__(args, *kwds) File "/opt/ros/groovy/lib/python2.7/dist-packages/genpy/", line 271, in __init__ raise TypeError("Invalid number of arguments, args should be %s"%str(self.__slots__)+" args are"+str(args)) TypeError: Invalid number of arguments, args should be ['header', 'angle_min', 'angle_max', 'angle_increment', 'time_increment', 'scan_time', 'range_min', 'range_max', 'ranges', 'intensities'] args are(header:

And here is my code:

#!/usr/bin/env python import rospy from sensor_msgs.msg import LaserScan from std_msgs.msg import String from std_msgs.msg import Header import genpy


def callback(header):
    global valores
    global flag
    if flag==2:

def callback2(header): 
    global valores2
    global flag
    if flag==2:

def cerebro():
    global valores_total

def copy():

    laser = LaserScan();
    header = Header();
    global idx
    global flag
    #creating header
    header.seq = idx;
    ftime_now = rospy.get_time();
    header.stamp = genpy.rostime.Time(int(ftime_now) // 1, int((ftime_now % 1.0)*1000000000)); 
    header.frame_id = "laser";

    laser.header = header;
    laser.angle_min = -3.14159;
    laser.angle_max = 3.14159;
    laser.angle_increment= 0.00613592332229;
    laser.time_increment= 9.76562514552e-05;
    laser.scan_time= 0.10000000149;
    laser.range_min= 0.019999999553;
    laser.range_max= 5.59999990463;

    pub = rospy.Publisher('chatter', LaserScan)


def listener():
    rospy.init_node('listener', anonymous=True)
    rospy.Subscriber("/scan", LaserScan, callback)
    rospy.Subscriber("/scan_front", LaserScan, callback2)

if __name__ == '__main__':

Thank you


Ok guys i think that i have solved the problem:

Instead of this:

pub = rospy.Publisher('chatter', LaserScan)

i made this:

pub = rospy.Publisher('chatter', LaserScan)


don't ask me why, i am new in ROS so some times i do things by intuition.

Thank you for your time!

2013-11-05 15:35:15 -0500 received badge  Notable Question (source)
2013-11-05 15:11:56 -0500 asked a question Caterpillar track odometry model

Hi guys,

I am now working in a robot which has Caterpillar track instead of normal wheels and i want to make odometry with him. I was hoping that you had some sugestions about how to make a aproximated model.

Thank You

2013-11-05 15:02:36 -0500 commented question syntax error near unexpected token [SOLVED]

The problem is solved! I was trying to run de cpp file instead of the one made with the rosmake! It was a really nub problem! Thanks

2013-11-03 12:25:37 -0500 commented question syntax error near unexpected token [SOLVED]

Thanks, now it is better. Maybe is the includes but i don't know why...

2013-11-02 19:43:10 -0500 received badge  Popular Question (source)
2013-11-02 09:02:20 -0500 commented question syntax error near unexpected token [SOLVED]

Ok,sorry about the editing,i don't now why it appears like that!

2013-11-02 09:01:10 -0500 received badge  Editor (source)
2013-11-02 07:55:34 -0500 asked a question syntax error near unexpected token [SOLVED]

Hi guys,

I am new in ros and i am having trouble with the odometry c++ publish turorial ( I am using the code in this link.

When i try to rosrun the program it gives me this:

line 5: syntax error near unexpected token `('

line 5: ` int main(int argc, char** argv){'

I don't understand why. BTW i am using groovy.

my c code is:

    #include <ros/ros.h>
    #include <tf/transform_broadcaster.h>
    #include <nav_msgs/Odometry.h>

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

    ros::NodeHandle n;
    ros::Publisher odom_pub = n.advertise<nav_msgs::Odometry>("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);
        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

        //next, we'll publish the odometry message over ROS
        nav_msgs::Odometry odom;
        odom.header.stamp = current_time;
        odom.header.frame_id = "odom";
        odom.child_frame_id = "base_link";

        //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.twist.twist.linear.x = vx;
        odom.twist.twist.linear.y = vy;
        odom.twist.twist.angular.z = vth;

        //publish the message

        last_time = current_time;