robocomp/robocomp-robolab

Mouse support (joystick simulator)

Closed this issue · 21 comments

Hello, I would like to start participating in the project. I am currently reading the code and came up with the idea of supporting the mouse to using the robot. I'm going to start creating this component. It can be helpful?

Hello, yes it could be a nice way to start using RoboComp. Maybe with a Qt window with a crosshair simulating the position of the joystick.
By the way, we are using gitter robocomp related channels to discuss these issues.

@bartekxk let us know about your progress with the component to close this issue.

@orensbruli I apologize for the lack of information (due to the exams: /). I tried to understand the code and I will try to implement the component next week (or as much as possible its part).

Ok. No problem. We are not in a hurry with this. Just keep us updated to avoid forgetting to close the issue. Good luck with the exams.

I created my own joystick but with the help of tkinter (because I already knew it). Can I use this library or better if I used PySide? I'm not sure if I can use this in this project.

Hello @bartekxk
Most of the components on robocomp use qt when a UI is needed, so it would be great to have it working on qt. That way we avoid introducing dependency on another graphic library and we keep the coherence on the code examples.
Best.

Hello @orensbruli
Okay, I created today basic gui in Qt (PySide). I will try to find time in the coming days to improve it and connect it with robocomp.

Ok, I created GUI but I have a question. Should I create 2 joystick (one for speed and one for rotation) or one joystick for both?
image
What would be better? Maybe create two option with switch button?
Best.

I think that the first idea is better. You usually will want to move and rotate at the same time and I don't see the way to do that with the splitted option, right?
If you want to code a "mode switch" button or menu, it would be also great, but I guess the first option will be the most used one.
Best.

Hello @orensbruli ,
I think that my component is already working. Of course, it's not perfect yet and I'm going to improve it but it seems to me that it looks cool. It would be nice if you looked and tell me your opinion. I would like to do comments and moving the joystick around the circle iin the coming days.
It is here:
https://github.com/bartekxk/robocomp-robolab
You can run it like keyboard robot controller

cd ~/robocomp/components/robocomp-robolab/components/joystickSimulatorController
cmake .
make
src/joystickSimulatorController.py etc/config

Thanks for Your help.
Best.

Hello @bartekxk,

Have you followed this tutorial to create your component?
https://github.com/robocomp/robocomp/blob/stable/doc/robocompdsl.md

Sorry for the delay, busy week.
Best.

@orensbruli
Hello, no problem.
Sorry, I have not seen that. I will read it and properly correct it.

Ok, @bartekxk thank you. The tutorials are a good point to start, I thought that you had already seen it: https://github.com/robocomp/robocomp/blob/stable/doc/README.md
If you generate your component with robocompdsl it will have the same structure that we are currently using. Save your current component code and you can use it in the new generated one.
Best.

Hello @orensbruli ,
I corrected it according to the tutorial. Works good but I'm not sure if it is perfectly written as in the tutorial. I also added joystick circular motion. I am going to add comments and write readme. Everything is the same as before, here https://github.com/bartekxk/robocomp-robolab .
Best.

Hello @orensbruli ,
I created merge request. Can you look at this in your free time?
Best.

Hello @bartekxk,
I have been reviewing your code. If you have followed the tutorials you know that most of the custom code for a component is developed on the specificworker.py (or cpp if using C++).
As far as I see, your mouse control code have been implemented on the genericworker.py file which should be avoided, because it's auto generated each time by the execution of robocompdsl
The same is applied to the main file joystickSimulatorController.py. All tour custom code should be moved to the specificworker.py file and class.
Please review the tutorial and check what is done in it.
Thank you.

Hello @orensbruli ,
Okay, I'll try to improve it in my component. Thank you for your opinion.
Best.

Hello @orensbruli ,
I have moved the specific code to the specificworker.py and I think the component works well. Can you look at this? #20
Thanks.

new component added