Yanzqing / alufr-ros-pkg

Automatically exported from code.google.com/p/alufr-ros-pkg
0 stars 0 forks source link

Restructure of nao_teleop to allow reuse via subclasses #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am in the process of developing a Nao teleoperation node to generate a demo 
system. As I would like to reuse as much existing functionality as possible, 
I'd like to base this on the teleop_nao_joy node. However the source files for 
this class do not currently allow subclassing. I have restructured them (based 
on svn rev 2730) to do so. In summary I've created 
nao_teleop/include/nao_teleop/teleop_nao_joy.h and made a library that is built 
from teleop_nao_joy.cpp. There is now a new file teleop_nao_joy_node.cpp which 
creates a node which has the same functionality as the previous 
teleop_nao_joy.cpp node. New classes can be developed by subclassing 
TeleopNaoJoy and calling subscribeToJoystick with a callback from the subclass. 
I've attached an svn diff of the changes plus an example of subclassing that 
works. I would be extremely grateful if you could merge these into the trunk, 
or let me know what changes you'd like before merging can happen.

cheers, Nick

Original issue reported on code.google.com by nick.ha...@gmail.com on 16 May 2012 at 12:55

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated files with more superclass functionality exposed. 

Original comment by nick.ha...@gmail.com on 16 May 2012 at 1:28

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by h...@informatik.uni-freiburg.de on 17 May 2012 at 3:31

GoogleCodeExporter commented 9 years ago
Fixed in Rev. #2752. I just made some slight adjustments:
- name of the library in manifest and CMakeLists is nao_teleop, like the 
package. In the future this could be extended e.g. with keyboard teleop in the 
same lib.
- name of the node binary is teleop_nao_joy in order to not break existing 
launchfiles

Original comment by h...@informatik.uni-freiburg.de on 24 May 2012 at 1:05

GoogleCodeExporter commented 9 years ago
I just added the package namespace around the classes as well, you should 
probably consider this for your derived classes.

Original comment by h...@informatik.uni-freiburg.de on 24 May 2012 at 1:48

GoogleCodeExporter commented 9 years ago
Great, thanks. I can confirm that this works for my components as expected. 

Original comment by nick.ha...@gmail.com on 25 May 2012 at 11:43