Ask Your Question

Clefairy's profile - activity

2017-10-07 12:11:28 -0600 received badge  Favorite Question (source)
2017-10-07 12:11:26 -0600 received badge  Nice Question (source)
2014-01-28 17:26:59 -0600 marked best answer How do I get the angle in radians (0 to 2pi) from a quaternion?

I'm trying to get the angle of a position model in Stage in radians from the Odometry message published to the "odom" topic.

This is how I've done it:

theta = 2 * asin(msg.pose.pose.orientation.z);

This sort of works in getting the angle in radians, but whenever the angle is below the x axis it gives me a negative angle.

Is there anyway of getting the angle in radians going from 0 to 2pi, starting from the positive x axis going anti-clockwise?


2014-01-28 17:26:55 -0600 marked best answer Get current position of a robot from a world file (Stage)

I have C++ code where I am defining the behaviour of a group of robots. However right now the initial positions of each robots are defined in a .world file for the Stage simulation. Is there a way of possibly getting the position and theta defined in the .world file and referring to it in the C++ code?

I need some sort of way to set the following in the C++ code:

x = theXNumberDefinedInWorldFile
y = theYNumberDefinedinWorldFile
z = 0
theta = theAngleNumberDefinedInWorldFile

Sorry if this is hard to understand but I couldn't think of any other way of putting it as I'm still new to ROS. Any help would be much appreciated.


2012-11-20 23:31:18 -0600 received badge  Famous Question (source)
2012-10-17 07:23:03 -0600 received badge  Famous Question (source)
2012-09-25 08:14:55 -0600 received badge  Famous Question (source)
2012-09-16 05:58:07 -0600 received badge  Famous Question (source)
2012-08-23 10:44:55 -0600 received badge  Notable Question (source)
2012-08-20 15:53:11 -0600 received badge  Notable Question (source)
2012-08-18 10:59:58 -0600 received badge  Popular Question (source)
2012-08-18 00:36:27 -0600 asked a question What are possible reasons for ros::spinOnce causing segmentation faults?

I'm having a problem where ros::spinOnce() will cause my code to stop running because of a segmentation fault when it reaches that line. I'm not sure if it's possible to answer without seeing code but are there any general causes for this?


2012-08-17 08:59:53 -0600 received badge  Famous Question (source)
2012-08-17 05:00:44 -0600 answered a question Why base_pose_ground_truth isn't publishing the real position in stageros?

I am having the exact same problem as well. The orientation is wrong as well. Does no one know why? Is it a bug in Electric?

2012-08-17 02:49:31 -0600 received badge  Popular Question (source)
2012-08-17 02:49:20 -0600 commented question Is this the right way to get odometry information in stageros?

px and py are 9.9 and 10.1 when they are 5.7 and 12.4 in the world. initialX and initialY were set to 15 and 20. Doesn't seem to work when it's set to 0.

2012-08-17 02:40:12 -0600 commented answer Is this the right way to get odometry information in stageros?

I couldn't figure it out because there's so little documentation other than the ROS wiki. Is there a procedure I'm supposed to follow to get it to work?

2012-08-17 02:39:11 -0600 commented answer Is this the right way to get odometry information in stageros?

I'm not that familiar with localization. I've read the amcl ROS wiki and tried subscribing to amcl_pose before but it didn't seem to work because when I type "rosrun amcl amcl scan:=base_scan", it just says "Request for map failed; trying again...".

2012-08-17 00:59:05 -0600 asked a question Is this the right way to get odometry information in stageros?

I'm simulating robots in stageros and I want to use stageros' odom topic to get the current position of the robot. This is how my code looks:

    // In a constructor
    RobotOdometry_sub = n.subscribe<nav_msgs::Odometry>("robot_0/odom",1000,&Robot::ReceiveOdometry,this);
void Robot::ReceiveOdometry(nav_msgs::Odometry msg)
    //This is the call back function to process odometry messages coming from Stage.    
    px = initialX + msg.pose.pose.position.x;
    py = initialY + msg.pose.pose.position.y;
    ptheta = initialTheta + angles::normalize_angle_positive(asin(msg.pose.pose.orientation.z) * 2);

    while (ptheta > 2 * M_PI)
        ptheta -= 2 * M_PI;
    while (ptheta < 0)
        ptheta += 2 * M_PI;

For some reason though the px and py values are wrong whenever I check them and they don't match up with the position of the robot in the stageros world. Is this not the right way to get the current pose of a position model in stageros? Do I need to do something else?

Please help.

2012-08-16 17:59:36 -0600 commented question How do I turn an exact angle using Twist messages?

@joq I'm sorry I'm not that familiar with PID controllers and using feedback control loops. I've read through the Wikipedia page but don't really understand what I need to do. Is there an example somewhere for roscpp?

2012-08-16 11:59:08 -0600 received badge  Notable Question (source)
2012-08-16 11:28:36 -0600 received badge  Famous Question (source)
2012-08-16 08:26:47 -0600 received badge  Popular Question (source)
2012-08-16 07:59:01 -0600 received badge  Student (source)
2012-08-16 06:03:11 -0600 asked a question How do I move with linear velocity for an exact distance?

I want to move a robot in stageros for a distance that is known. I publish Twist messages with a linear velocity and no angular velocity in a loop until it moves the exact distance.

How would I write the loop so that it stops after moving the distance required with no going over or under the distance?

2012-08-16 05:57:45 -0600 edited question How do I turn an exact angle using Twist messages?

I want to turn a position model in stageros a set angle. So I would need to publish Twist messages with an angular velocity to make it turn.

Say I want to turn a robot 180 degrees (or pi radians). How would I write something in C++ to make it stop turning with angular velocity after it turns 180 degrees. I know that I need to send the Twist messages in a loop but I don't know what the condition would be.

How would I check that the robot has reached the desired heading?