Good afternoon, I have a problem for a project. Let me explain, I'm trying to do a lawn-mower, it's a personnal project. I'm currently using a RPi 4 4bg, It runs on raspbian (Debian GNU/Linux 12 (bookworm)), the project should run with ros2 Jazzy. I'm coding in c++ and the library "wiringPi" for a faster result (even more if I want to upgrade the project in the future). At it is written in the title my problem is concerning the pwm, I have a node to control the motor for the navigation, I tried first without pwm to have the GPIO integration and I was able to switch on/off a LED in function of the command I give, when I tried to change the intensity of the LED instead of just switch it on/off I have a permission error: "pinMode PWM: Unable to do this when using /dev/gpiomem. Try sudo?" When I try with sudo the node works but it's outside of the workspace and can't be reach by the other nodes, so I can't give any command to this node. I tried to change the file
/boot/firmware/config.txt
by adding the line :
dtoverlay=pwm-2chan,pin=18,func=2,pin2=19,func2=2
I also tried to change the file
/etc/udev/rules.d/99-com.rules
adding the lines:
SUBSYSTEM=="pwm*", PROGRAM="/bin/sh -c '\
chown -R root:gpio /sys/class/pwm && chmod -R 770 /sys/class/pwm;\
chown -R root:gpio /sys/devices/platform/soc/*.pwm/pwm/pwmchip* && chmod -R 770 /sys/devices/platform/soc/*.pwm/pwm/pwmchip*\
'"
I also verified if I am on the group of GPIO and I am... I don't know what to check or what I can do, If you can give me some ideas. If you need more explanation or more information I'll be happy to give you