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

I need a help with real robot odometry

asked 2018-12-25 12:49:37 -0500

stevemartin gravatar image

I have bought a small DC motor and I am using this software to control the motor: LINK

Now, when I can control the robot and also getting ticks via magnetic encoders, it is time to navigate the robot autonomously. Here, I need your help to advice me on how can I correctly control the robot. Here is what I think I have to do:

  1. First, using a custom made global planner, I am setting a path from starting point to goal point (in this case, I am getting a starting point from the transform information between /odom and /base_footprint). I call the service GetPlan. Eventually, I am getting a plan in nav_msgs::Plan fashion.

  2. After getting a plan, it is now the part to start the motor (I am not yet using local planner). Here, next step I think is that I should invoke odometry node on callback and using AMCL lidar localization, extract a more precise location. After knowing the current location and the next goal point, I can use a constant velocity of 0.5 m/s, I know the distance to the next location, therefore, I have to set a time => t = v/d to know how long I need to publish the twist message of x (or y) = 0.5 m/s. For that, I will publish the velocity message to /cmd_vel topic for a t period of time (not for an infinite time as usual).

  3. I will create a motor node, which is only subscribed to /cmd_vel topic and as soon it gets to the callback (I think it should be in a callback for t seconds only), I will use the above LINK example code to set the velocity 0.5 m/s to run the motor for a callback period of time, so the robot will start moving. While doing that, inside the callback, I will also publish the ticks to some custom topic like /ticks. After t seconds, the motor node will exit the callback and will be in a waiting mode.

  4. As motor node was publishing ticks to /ticks topic for t time, odom node will also be subscribed to the /ticks topic to get the position of a robot. But here is my struggle, how can I do that? As odom node will already be subscribed to the path topic from which it extracts the path.

edit retag flag offensive close merge delete

Comments

Question, do you have a full robot or just a single DC motor?

juanlu gravatar image juanlu  ( 2019-01-04 02:56:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-01-03 09:12:13 -0500

mali gravatar image

If I understand correctly your are building your own robot and your problem is to develop Odom node for it. I think you need to check the equations which describe the ( differential-driven ) mobile robot kinematics here. Then you need to measure different parameters of your robot (i.g. wheel diameter and gauge distance) and substitute these values into the equations.

"Now, when I can control the robot and also getting ticks via magnetic encoders"

As you mention you can get feedback from the magnetic encoders, you need to convert these ticks to speed. Your Odom node will subscribe to /ticks and convert it to rotation speed for the two wheels, then using the kinematic equations, you convert this rotation speed to linear and angular speed of the robot and calculate the distance that the robot moved, the direction of the robot as well.

So, your Odom node will send the new relative pose of your robot based on the initial position of the robot in the environment. At that moment, you can use your Odom node the AMCL library to get an accurate location.

edit flag offensive delete link more

Comments

Great answer! I'd like to add that in case he is not interested in writing his own controllers and odometry computation he could take a look at ROS Control!

juanlu gravatar image juanlu  ( 2019-01-04 02:41:44 -0500 )edit

Yes ros_control makes life easier !

mali gravatar image mali  ( 2019-01-04 03:57:44 -0500 )edit

@mali What about this package? http://wiki.ros.org/differential_drive It seems that I only need to provide ticks in order to control it and it publishes Odometry itself

stevemartin gravatar image stevemartin  ( 2019-01-04 04:56:11 -0500 )edit

@stevemartin diff_drive works, I think you need to provide your own parameters values and it will work

mali gravatar image mali  ( 2019-01-06 08:15:43 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-12-25 12:49:37 -0500

Seen: 575 times

Last updated: Jan 03 '19