Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i can't find the left/right wheel topic on turtlebot Kobuki ? #386

Open
NabilRez opened this issue Mar 6, 2018 · 12 comments
Open

i can't find the left/right wheel topic on turtlebot Kobuki ? #386

NabilRez opened this issue Mar 6, 2018 · 12 comments

Comments

@NabilRez
Copy link

NabilRez commented Mar 6, 2018

Hi, the "/cmd_vel_mux/input/teleop" topic controls linear velocity and angular velocity of the turtlebot kobuki,
What i am trying to find is the topic that controls the rotational speed of the left/right wheel of the turtlebot kobuki in order to implement an LQ regulator to control the speed loop of the turtlebot.

@stonier
Copy link
Member

stonier commented Mar 13, 2018

Been a while, but I think that that pair is what routes directly into the protocol to the Kobuki ECU. You should be able to compute single wheel rotational speeds and then transform them into the above form (base linear velocity/rotational velocity) using the Kobuki base parameters (wheel diameter, ...). Likely to be some error coming from the base parameters, but it should be fairly negligible.

@NabilRez
Copy link
Author

Ok i have some question ( please have in mind that i am new at ROS ).
what is Kobuki ECU ? ( or simply point me to where i can get more understanding about kobuki ecu )
also, in order to implement different control strategy to the speed loop of the turtlebot, two things are required :
-Publish into the topic that controls the (left / right ) wheel rotational speed of the turtlebot.
-Get the measure of the actual rotational speed of the (left/right) wheel form the turtlebot, either by directly subscribing from the wheel encoder topic, which is more practical, or infer it from the speed of the turtlebot (i.e: deduce the ( left / right ) wheel rotational speed from the actual speed of the turtlebot via an inverse matrix )

@alexantosh
Copy link

hello, were you able to find this out? How to control the different wheels separately?

@stonier
Copy link
Member

stonier commented Aug 21, 2020

You can't control them directly - the kobuki accepts commands that control the base, not the individual wheels. These control commands, at the lowest level we have access to (firmware), are accepted in the the form of a radius / speed pair.

Depending on what kind of control you're attempting to perform, you could reverse engineer the process. i.e. convert your wheel commands to the appropriate radius/speed tuple (or velocity/angular velocity pair) and send that. Refer to the documentation on conversions for all the values you need.

@alexantosh
Copy link

Thanks alot @stonier. indeed i want something like this. Where exactly do I put the code to achieve this? What i want is to have the robot rotate 10 or 20 or even 30 degrees about its axis and then pause for about half a minute. then go on till i stop it. Just issuing commands to turtlebot2 only rotates one wheel and the robot somehow displaces
Thanks.

@stonier
Copy link
Member

stonier commented Aug 23, 2020

Seems like something is wrong - you should be able to perfectly manage that with the control paradigm the ros1 node has. I haven't looked / tested the ros1 code for years (and unable to check on melodic right now) so can't help you out there right now.

However, you could try to compile and run the simple loop demo (no ros1 involved and that api will work against melodic's c++ kobuki_driver library). Source code is here.

https://github.com/kobuki-base/kobuki_core/blob/devel/kobuki_driver/src/demos/simple_loop.cpp

Just copy/paste it into your build environment somewhere. It controls kobuki around a virtual square, with pure rotations of the sort you want at the corners. This will at least tell you whether there's a problem with your kobuki/kobuki driver or it's some bug in the ros node wrapper around it.

@alexantosh
Copy link

alexantosh commented Aug 24, 2020

ok i will try this. No, the turtlebot2 and kobuki are running on ROS Indigo Ubuntu 14.04. Couldnot find a way to handle that with the control paradigm ROS1 node provides. Any suggestions in that direction would also be most welcome as I have most code built in ROS with python. Still my C++ is not that awful. It should at least suffice to handle this task. What I did was I practically sent a Twist Object with just the angular velocity and it seems only one wheel is turning and somehow the robot displaces. In ROS melodic I have gazebo. Thats where I want to first try this then port it to the hardware.

@alexantosh
Copy link

I tried the code sample you gave me on both ubuntu 18.04 and 14.04 but it gives errors.
for Ubuntu 14.04, when i try to compile the file, i get:

turtle1@turtle1:~/kobuki/src/kobuki_core/kobuki_driver/src/test$ gcc -o sim simple_loop.cpp In file included from /opt/ros/indigo/include/ecl/linear_algebra.hpp:19:0, from /opt/ros/indigo/include/ecl/geometry/legacy_pose2d.hpp:21, from simple_loop.cpp:16: /opt/ros/indigo/include/ecl/linear_algebra/eigen.hpp:21:26: fatal error: Eigen/Cholesky: No such file or directory #include <Eigen/Cholesky> ^ compilation terminated. turtle1@turtle1:~/kobuki/src/kobuki_core/kobuki_driver/src/test$

for Ubuntu 18.04, i guess it is understandable as it does not have kobuki core library suit, none the less, i will add it here: So I simple copied the simple_loop.cpp file to anyone of the packages got after following This Link Which basically summarizes this post.

/catkin_ws/src/kobuki_node/src/nodelet$ gcc -o sim simple_loop.cpp simple_loop.cpp:20:10: fatal error: ecl/time.hpp: No such file or directory #include <ecl/time.hpp> ^~~~~~~~~~~~~~ compilation terminated.

@stonier
Copy link
Member

stonier commented Aug 24, 2020

Intent was to copy the file across and compile, not entire repo.

You need to either add it to your cmake (easiest way) or make sure you point gcc at where the headers are with -I<path_to_headers>.

@alexantosh
Copy link

Hello. I simply copied the simple_loop.cpp. I already had a similar kobuki repo on the indigo machine.
Any way just to make sure. I copied the file again on the melodic machine and simple added it to the cmake as suggested. This is the error I got.
n file included from /opt/ros/melodic/include/ecl/linear_algebra.hpp:19:0, from /opt/ros/melodic/include/ecl/geometry/legacy_pose2d.hpp:21, from /home/alex/catkin_ws/src/kobuki_keyop/src/simple_loop.cpp:22: /opt/ros/melodic/include/ecl/linear_algebra/eigen.hpp:21:10: fatal error: Eigen/Cholesky: No such file or directory #include <Eigen/Cholesky> ^~~~~~~~~~~~~~~~ compilation terminated. kobuki_keyop/src/CMakeFiles/keyop.dir/build.make:110: recipe for target 'kobuki_keyop/src/CMakeFiles/keyop.dir/simple_loop.cpp.o' failed make[2]: *** [kobuki_keyop/src/CMakeFiles/keyop.dir/simple_loop.cpp.o] Error 1 CMakeFiles/Makefile2:3527: recipe for target 'kobuki_keyop/src/CMakeFiles/keyop.dir/all' failed make[1]: *** [kobuki_keyop/src/CMakeFiles/keyop.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2
This is in my catkin workspace trying to do a catkin_make

@stonier
Copy link
Member

stonier commented Aug 27, 2020

I suspect you missed adding dependencies to the target in cmake.

@alexantosh
Copy link

Hello, sorry for the tardy reply. did not have access to the desktop for a while. Apparently the issue was that my system has eigen3 so I had to include that in the headers that required Eigen (I wonder if there's a simpler way of doing this instead of having to add it manually to all requiring files). Anyway it compiled finally but with warnings and failed because multiple mains were defined. Below is part of the log and the list of undefined references goes on. How effectively can I add these dependencies, again I apologise for the trouble:
/opt/ros/melodic/include/kobuki_driver/kobuki.hpp:96:37: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated] void init(Parameters &parameters) throw (ecl::StandardException); ^~~~~ CMakeFiles/keyop.dir/simple_loop.cpp.o: In function main':
simple_loop.cpp:(.text+0x11): multiple definition of main' CMakeFiles/keyop.dir/main.cpp.o:main.cpp:(.text+0x0): first defined here CMakeFiles/keyop.dir/simple_loop.cpp.o: In function kobuki::Parameters::Parameters()':
simple_loop.cpp:(.text._ZN6kobuki10ParametersC2Ev[_ZN6kobuki10ParametersC5Ev]+0x98): undefined reference to kobuki::Battery::capacity' simple_loop.cpp:(.text._ZN6kobuki10ParametersC2Ev[_ZN6kobuki10ParametersC5Ev]+0xa9): undefined reference to kobuki::Battery::low'
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants