Closed Russ76 closed 1 year ago
The issue seems to be that the grove_motor_driver node is subscribed to motor_left/right
without the /diffbot/
prefix.
Just to clarify, the diffbot_base
is actually providing two "output" interfaces:
The interface you are currently using with the encoder(-bno).ino script is the high-level PID approach and that one works with the motor commands, publishing setup is here:
The diffbot_base
is launched with the /diffbot
namespace
So the options that should fix the issue you have is to
grove_motor_driver
or grove_motor_driver
in the /diffbot
namespaceNote In case you use the encoder-bno.ino you have to tune the high-level PID
Franz, you are right, now they run! Forward and backward looks good, however, the turning power is much too low. How do I boost the turning power? The angular boost?
Great, glad that helped! You should be able to tune the high-level PID controller using dynamic reconfigure through rqt. I am guessing the P gain can be turned up a bit.
I will work on that, thanks! My Python on laptop is messed up and won't run Rqt tools, but I can do it some other way. I tried boosting the angular from teleop_twist_joy but that didn't work.
I was not able to get the angular command to increase without also increasing the linear, and it is enough already. I tried adjusting all the variables. However, even with weak turning, two of us were able to drive the robot around successfully even on carpet. Maybe this will work with move_base and other software.
The encoder topic is a problem. They aren't connected, as can be seen above. The Teensy code has topic "Encoder" and the Raspi code looks for topic "EncoderStamped" These are not the same! Did you get the package to work like this? How?
I was not able to get the angular command to increase without also increasing the linear, and it is enough already. I tried adjusting all the variables. However, even with weak turning, two of us were able to drive the robot around successfully even on carpet. Maybe this will work with move_base and other software.
Have you tried adapting the limits in the diff_drive_controller
config? Maybe that could help (see also a full configuration example of all values here).
After that you most likely have to tune the PID gains again.
The encoder topic is a problem. They aren't connected, as can be seen above. The Teensy code has topic "Encoder" and the Raspi code looks for topic "EncoderStamped" These are not the same! Did you get the package to work like this? How?
Right, that is an issue I introduced while switching from the high-level PID to the low-level PID approach. Sorry for that :-/
I'd recommend to update the encoder.ino
/ encoder-bno.ino
to also use the diffbot_msgs::EncodersStamped
message as it includes a time stamp, which might be useful.
Well, I tried to get that to work, and it compiles, and the topic connects, but there is no ticks data showing in the message!
That is strange. Is the published topic from the mcu containing something when you inspect it, e.g. with something similar to rostopic echo /diffbot/encoder_ticks
? If not then there seems to be an issue while creating the message. I am assuming that diffbot_msgs::Encoders
is present as an (arudino) library. For PlatformIO I placed the header in diffbot_base/scripts/base_controller/lib/ros_lib/diffbot_msgs
. The way that diffbot_msgs::Encoders
is used for the new base_controller
firmware is shown below:
This is slightly different to how it is currently done in the encoders-bno.ino
:
However, because it compiles I am guessing there is no issue here.
What I would also try to verify is that rosmsg show diffbot_msgs/Encoders
will correctly show the message. ^msg
If all this doesn't help, I will try to find time near the end of the month to test this setup myself.
Yes, that block of code what what I needed. Now we got it working: encoders stamped has time, sequence, and ticks data! I had to add "diffbot" to the "encoder_diffbot.h" reference in the #include list, for the Arduino IDE to find the header file. Now the only error in starting the main nodes on Raspi is complaining about no "joint states publishers", which I suppose is not important. Thanks, Franz!
Let the robots roam!
Cannot get the motors to run from the joystick. I checked, and it is publishing data to /diffbot/mobile_base_controller/cmd_vel. Also the /diffbot/wheel_cmd_velocities shows data from the joystick. But /motor_left and /motor_right do not show any data. If I send a command from CLI on that topic then the motors will run. I am running joy and teleop_twist_joy on the laptop. And I ran the launch file on robot called roslaunch diffbot_bringup bringup.launch
I am using the Python Grove motor controller routines. I don't have the Lidar tested yet; was saving that for after the driving was proven. The encoders seem to work correctly. The odom topic stays at zero, even when tracks are spun by hand. I tried using the rqt_robot_steering and it published but no response from program or motors.
I'm using Raspi 4.0 with 4 Gig, Ubuntu 20.04 Mate and Noetic.
What should I try next to fix this robot?