Reduce Speed of YDLidar

Hi, I am working with tortoisebot and due to some reasons I wanted to reduce the lidar motor speed.
Tried to change frequency but that didnot work and i have seen in documentation that i need to change the pwm signal of M_SCTP pin of ydlidar, can anyone please guide me how to reduce.

If the documentation says that you need to change the PWM signal of a pin in the lidar itself, then you need to be able to interact with that pin from somewhere else.

An ubuntu machine can act as a PWM generator, but a laptop doesn’t have an easy way to connect directly to a pin. An alternative is using a Raspberry Pi (I’m sure Raspbian and Ubuntu OS works). That way you can connect the lidar pin to the pi’s GPIO pinout.

Then, you can write a script in whatever language you want that is able to generate a pwm signal; you also need to investigate how the message protocol works so you know the signal is structure correctly, and then send it out to the lidar.

I don’t know if this would mean that the motor would spin at a different speed permanently, I’m guessing that depends on the hardware architecture.

It’s important to know that interacting directly with hardware can be complex and changing something internal might affect the correct functioning of your device (maybe there is a minimum speed that the motor needs in order to scan correctly).

@rodrigo55 Thanks for the response.
That looks too complicated for me. Instead of that cant we change it from the lidar package?

In official repository I have observed one thing in X2.launch(Iam using YDLidar X2) file


Does this line represent speed control of motor?

And official tortoisebot repo have their modified version of ydlidar SDK package where they have customized as per their requirement and I am unable to figure it out.

I don’t know if you can change it from the lidar package, it depends if the developers considered it or not.

It looks like that’s a ROS parameter from an xml launch, and yeah I mean the comment above says frequency is invalid, external pwm control speed seems like a cryptic comment, maybe it means it doesn’t work? You need to go into the cpp that is supposed to take in that parameter and see if it does it.

Have you tried just changing it and checking?

yeah i have tried but not in official repo, however i used tortoisebot repo and tried changing it but didnot work i have observed they have added few conditions too in ydlidar_node.cpp
image

I’m not sure thing might affect the speed but tried changing this too but did not work.

:thinking:

That makes things more tricky…

If the tortoisebot repo has itself a modified version of the YDlidar repo, then you need to check if there are more than that difference you are mentioning. Some things to check:

  • Is the ylidar package in the tortoisebot repo a sub-repo, or just a package?
  • What if you remove the ydlidar package from the tortoisebot repo from your workspace and clone the official repo? Maybe there have been updates in the ydlidar repo that are not reflected in the tortoisebot ydlidar package.

It’s definitely a complicated issue, and adding on top the risk of malfunctioning due to direct hardware modifications, I would personally consider an alternative solution to the issue you are trying to tackle.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.