rursprung / fhgr-mrproj2

A ROS 1 based tank with a LIDAR.
GNU General Public License v3.0
2 stars 2 forks source link

Add `smt_movement_controller` - WIP #32

Closed joel5399 closed 1 year ago

joel5399 commented 1 year ago

WiringPi issues

rursprung commented 1 year ago

note: i've created https://github.com/joel5399/fhgr-mrproj2/pull/1 to get this to build properly.

rursprung commented 1 year ago

@joel5399: it seems that you rebased and lost commit 3afbb98a375a05beeab68a28eff8aef9821c5fd9 and force-pushed that. you can recover from this by doing these steps:

git reset --hard 3afbb98 # go back to the merge commit (removes everything you just did)
git cherry-pick d4673e0 # re-apply your new fixes. note: this leads to merge conflicts in two files!
# fix the merge conflicts manually (run `git status` to see which files are affected)
# test (to make sure that everything is fine)
git add smt_movement_controller/ # mark the merge conflicts as resolved (easy way here: just specify the whole folder instead of individual files; but do make sure that you've actually resolved them all!)
git cherry-pick --continue # finish the cherry-picking
git push -f origin HEAD # push it again (needs to be a force-push because we just re-wrote history again)
joel5399 commented 1 year ago

I've tried to write my own SIGINT somehow the function is not called, do you know why it won't work?

rursprung commented 1 year ago

I've tried to write my own SIGINT somehow the function is not called, do you know why it won't work?

how do you terminate the program? by pressing Ctrl+C or in another way? i've not tried this with a ROS program so far, i've just found their documentation. but the described way to set up the handler is the standard way of doing it in C++ on linux, so i'd expect it to work if the program receives a SIGINT.

you could test whether it gets triggered if you search for the PID (program ID) of your ROS node when it's running using ps -ef and then use that ID to kill it using kill -SIGINT ${YOUR_PID}.

it might be that you don't get a SIGINT but instead get a SIGKILL for some reason? in that case you'd need to register your handler also for SIGKILL and maybe even SIGTERM? if you do that and change the logging to also output the signal ID which you received (it's the parameter of your function) then you'll see what kind of signal you receive.

joel5399 commented 1 year ago

I've tried all of this, but somehow I still don't get this funktion to work. But anyways if i write the gpioTerminate() in front of the gpioInitialise it still dont work. I still get the error bind to port 8888 failed. Do you have any other ideas how i could solve this problem?

rursprung commented 1 year ago

so just to make sure: if you remove the port binding + termination at the beginning of the init function it works for the first launch, right?

then i'd suggest to remove that + also remove the custom signal handler for now and get this PR merged. then we can investigate this further separately and not hold up the whole PR. (i currently also don't have a good idea and would need to try things out; possibly on the RPi itself).

joel5399 commented 1 year ago

No, when I remove the Portbinding I didn't even can start it 1 time. If i set the port binding, I can start it one time and after that i get the same error. Then with reboot I can solve this problem and start it a second time. If it is ok for you, I will set the Portbinding for now we can than figure out a proper solution later.

rursprung commented 1 year ago

ok, then let's do it like that. can you please also add an issue (with a reference to this PR) so that we remember to solve this later?