morse-simulator / morse

The Modular OpenRobots Simulation Engine
http://morse-simulator.github.io/
Other
353 stars 156 forks source link

Clean constraint api #699

Closed adegroote closed 8 years ago

adegroote commented 8 years ago

I propose some wrapper around bge.constraints and a rewrite of wheeled_robot to use it. Please review and comment

severin-lemaignan commented 8 years ago

I'm generally certainly supportive of this change. Very needed (if only to abstract away from Blender internals).

Are you aware of any other actuator (besides the armature actuator that relies on a different system -- well, armatures) that would need to be updated to the new API? (a quick grep only returns the Hummer class beyond WheeledRobot)

adegroote commented 8 years ago

No other systems really use the constraints API for now except Hummer, which use the vehicle wrapper API (but it has a comprehensive API). But I'm trying to implement more complex model than differential one (Ackermann for now, possibly with suspension) and after 2 days of setParam, I'm getting tired of this "API" :).

Still, I'm not really happy with the approach, as all the constraints are generated at run-time, in Morse, which make difficult to debug / test in isolation. In the end, I may go back to the bones / armatures interfaces to design them. I'm still trying to understand well the relation best choices between bones|armature / 6DoF Constraints (in bpy.obj.constraints) / 6DoF Constraints (in bge.constraints).

severin-lemaignan commented 8 years ago

Yes, the API split between armatures and constraints, even though it probably makes sense from Blender's modelling perspective, is unfortunate.

The major issue with armatures is that multi-DoF per joint is difficult (because, as far as I remember, you can not 'pose' the joint as you want to have the right rotations axes -- this should be check though, as I'm pretty sure we can change the orientation of the bones' heads)

See #382 for details & discussions (including a few comments on the Constraint API).

adegroote commented 8 years ago

I rework my commit to follow most of your remarks. For moment, I don't create wrapper for other types of joints, as they are no controllable (in the Blender interface). It can be added latterly if needed.

adegroote commented 8 years ago

Can I merge it ? I need it to continue to work on more advanced wheeled robot.

severin-lemaignan commented 8 years ago

+1