0
$\begingroup$

Rosanswers logo

I am using this callback function because I want to tell the robot to move a specified angle. I was wondering if there is a way to restart the /odom topic back to 0 for simplicity purposes. Your help is really appreciated!

I am using ROS Indigo and I have a create turtlebot base

def odometry_cb(self, data):
        pose = data.pose.pose
        quaternion = (pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w)
        euler = tf.transformations.euler_from_quaternion(quaternion)
        roll = euler[0]
        pitch = euler[1]
        yaw = euler[2] 
        yaw_angle = (yaw*(180/math.pi))
        self._last_yaw_angle = yaw_angle
        print(self._last_yaw_angle)

Originally posted by shahvineet98 on ROS Answers with karma: 21 on 2015-07-07

Post score: 2


Original comments

Comment by BennyRe on 2015-07-10:
It would be useful if you name the robot you use and which package.

Comment by shahvineet98 on 2015-07-10:
I am sorry for not clarifying earlier but I updated that in my question

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

This is how odometry is reset for Kobuki:

void KobukiRos::subscribeResetOdometry(const std_msgs::EmptyConstPtr /* msg */)
{
  ROS_INFO_STREAM("Kobuki : Resetting the odometry. [" << name << "].");
  joint_states.position[0] = 0.0; // wheel_left
  joint_states.velocity[0] = 0.0;
  joint_states.position[1] = 0.0; // wheel_right
  joint_states.velocity[1] = 0.0;
  odometry.resetOdometry();
  kobuki.resetOdometry();
  return;
} 

Hope this helps.


Originally posted by vinjk with karma: 96 on 2015-07-14

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$
0
$\begingroup$

Rosanswers logo

If you do have a Kobuki base, you can use the ~commands/reset_odometry topic of type std_msgs/Empty for this, as described here


Originally posted by mgruhler with karma: 12390 on 2015-07-10

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by shahvineet98 on 2015-07-10:
This is exactly what I am looking for but is it possible on a create base?

Comment by Mehdi. on 2015-07-10:
I think if you search in the source code where this topic is defined and how its callback function looks like, you can copy it for the create.

Comment by OsgoodWu on 2017-12-05:
Hello, I just creat a publisher topic to publish the ~commands/reset_odometry , but I find the turtlebot doesn't change it's pose ,do you know the reason?

$\endgroup$
0
$\begingroup$

Rosanswers logo

As far I can see there is no such service for the create node.

I guess you would have to add a service for that yourself in

https://github.com/turtlebot/turtlebot_create/blob/832a645fc459823b76b8f340dc8d9695a40d718f/create_node/nodes/turtlebot_node.py

Maybe the _robot_reboot(self): function does what you want but you will have to add a service to call it externally.

Regards,

Christian


Originally posted by cyborg-x1 with karma: 1376 on 2015-07-10

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.