morse-simulator / morse

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

Remove useless bge import and wrap other ones #167

Closed severin-lemaignan closed 11 years ago

severin-lemaignan commented 12 years ago

This would simplify our dependency on Blender Python API.

severin-lemaignan commented 12 years ago

commit c0f887835456e45c91babb894 introduces the underlying work required to complete this issue.

flixr commented 12 years ago

It seems that in at least some cases running_in_blender is False, even though it is running in Morse/Blender. I ran into this issue with services (rotorcraft_waypoint actuator). I added a print statement to blenderapi:persistantstorage() and it returns that it thinks it's fake:

[SUPERVISION SERVICES INITIALIZATION]
[    0.121] [middleware.socket_request_manager] Socket service manager now listening on port 4000.
[    0.122] [core.services] Successfully initialized the SocketRequestManager request manager.
[    0.131] No multi-node scene configuration file found. Multi-node support disabled.
is fake
Python script error - object 'Scene_Script_Holder', controller 'Initialize':
Traceback (most recent call last):
  File "/usr/local/lib/python3/dist-packages/morse/blender/main.py", line 620, in init
    init_ok = init_supervision_services()
  File "/usr/local/lib/python3/dist-packages/morse/blender/main.py", line 741, in init_supervision_services
    import morse.services.supervision_services
  File "/usr/local/lib/python3/dist-packages/morse/services/supervision_services.py", line 8, in <module>
    @service(component = "simulation")
  File "/usr/local/lib/python3/dist-packages/morse/core/services.py", line 211, in service
    do_service_registration(fn, component, name, async)
  File "/usr/local/lib/python3/dist-packages/morse/core/services.py", line 121, in do_service_registration
    request_managers = blenderapi.persistantstorage().morse_services.get_request_managers(component_name)
AttributeError: 'module' object has no attribute 'morse_services'
flixr commented 12 years ago

IMHO this should be a blocker for the 0.6 release, since this wrapper returns false for running_in_blender in some cases and hence prevents a couple of components from working. See previous comment.

adegroote commented 12 years ago

Can you add an unit-test or at least a scene which exposes the issue ? Thanks in advance.

flixr commented 12 years ago

It actually doesn't seem to happen when running the simulation directly or starting it for the first time. However, stopping GE via Esc and restarting it with p triggers this issue. For example this happens with the scene examples/scenarii/quadrotor_dynamic_example.py

On Mon, Oct 29, 2012 at 5:37 PM, Arnaud Degroote notifications@github.comwrote:

Can you add an unit-test or at least a scene which exposes the issue ? Thanks in advance.

— Reply to this email directly or view it on GitHubhttps://github.com/laas/morse/issues/167#issuecomment-9875401.

adegroote commented 12 years ago

On 29/Oct - 09:49, Felix Ruess wrote:

It actually doesn't seem to happen when running the simulation directly or starting it for the first time. However, stopping GE via Esc and restarting it with p triggers this issue. For example this happens with the scene examples/scenarii/quadrotor_dynamic_example.py

Can you test the following patch ? I'm not sure why it works but it seems to fix the issue. Still, it is quite mysterious!

Arnaud Degroote Postdoc RIA LAAS - CNRS

flixr commented 12 years ago

I guess the attached patch got stripped by github?

On Mon, Oct 29, 2012 at 6:53 PM, Arnaud Degroote notifications@github.comwrote:

On 29/Oct - 09:49, Felix Ruess wrote:

It actually doesn't seem to happen when running the simulation directly or starting it for the first time. However, stopping GE via Esc and restarting it with p triggers this issue. For example this happens with the scene examples/scenarii/quadrotor_dynamic_example.py

Can you test the following patch ? I'm not sure why it works but it seems to fix the issue. Still, it is quite mysterious!

Arnaud Degroote Postdoc RIA LAAS - CNRS

— Reply to this email directly or view it on GitHubhttps://github.com/laas/morse/issues/167#issuecomment-9878628.

adegroote commented 12 years ago

Seems to do the trick :-)

Btw, I also have some problems regarding the logger, when running the simulation for the second time, maybe it's something similar?

[ 0.195] Component: 'imu' using middleware 'morse.middleware.ros_mw.ROSClass' Traceback (most recent call last): File "/usr/lib/python3.2/logging/handlers.py", line 79, in emit logging.FileHandler.emit(self, record) AttributeError: 'NoneType' object has no attribute 'FileHandler' Logged from file topics.py, line 1034 [ 0.395] [middleware.ros_mw] Middleware initialization Traceback (most recent call last): File "/usr/lib/python3.2/logging/handlers.py", line 79, in emit logging.FileHandler.emit(self, record) AttributeError: 'NoneType' object has no attribute 'FileHandler' Logged from file ros_mw.py, line 15 ....

On Mon, Oct 29, 2012 at 8:12 PM, Arnaud Degroote arnaud.degroote@laas.frwrote:

On 29/Oct - 11:53, Felix Ruess wrote:

I guess the attached patch got stripped by github?

Probably. I send you it again directly

On Mon, Oct 29, 2012 at 6:53 PM, Arnaud Degroote notifications@github.comwrote:

On 29/Oct - 09:49, Felix Ruess wrote:

It actually doesn't seem to happen when running the simulation directly or starting it for the first time. However, stopping GE via Esc and restarting it with p triggers this issue. For example this happens with the scene examples/scenarii/quadrotor_dynamic_example.py

Can you test the following patch ? I'm not sure why it works but it seems to fix the issue. Still, it is quite mysterious!

Arnaud Degroote Postdoc RIA LAAS - CNRS

adegroote commented 12 years ago

Cool! The logger issue may be related. Does it happen for every scene or it is related to ros scene ? I personnaly don't see these issues with basic tests example, so it may be related to specific environment or scenes.

Felix Ruess felix.ruess@gmail.com a écrit :

Seems to do the trick :-)

Btw, I also have some problems regarding the logger, when running the simulation for the second time, maybe it's something similar?

[ 0.195] Component: 'imu' using middleware 'morse.middleware.ros_mw.ROSClass' Traceback (most recent call last): File "/usr/lib/python3.2/logging/handlers.py", line 79, in emit logging.FileHandler.emit(self, record) AttributeError: 'NoneType' object has no attribute 'FileHandler' Logged from file topics.py, line 1034 [ 0.395] [middleware.ros_mw] Middleware initialization Traceback (most recent call last): File "/usr/lib/python3.2/logging/handlers.py", line 79, in emit logging.FileHandler.emit(self, record) AttributeError: 'NoneType' object has no attribute 'FileHandler' Logged from file ros_mw.py, line 15 ....

On Mon, Oct 29, 2012 at 8:12 PM, Arnaud Degroote arnaud.degroote@laas.frwrote:

On 29/Oct - 11:53, Felix Ruess wrote:

I guess the attached patch got stripped by github?

Probably. I send you it again directly

On Mon, Oct 29, 2012 at 6:53 PM, Arnaud Degroote notifications@github.comwrote:

On 29/Oct - 09:49, Felix Ruess wrote:

It actually doesn't seem to happen when running the simulation directly or starting it for the first time. However, stopping GE via Esc and restarting it with p triggers this issue. For example this happens with the scene examples/scenarii/quadrotor_dynamic_example.py

Can you test the following patch ? I'm not sure why it works but it seems to fix the issue. Still, it is quite mysterious!

Arnaud Degroote Postdoc RIA LAAS - CNRS

flixr commented 12 years ago

As I only use ROS, I haven't tested other middlewares. But it also only happens when I start the simulation in edit mode and run it for the second time (p -> ESC -> again p).

On Mon, Oct 29, 2012 at 9:06 PM, Arnaud Degroote notifications@github.comwrote:

Cool! The logger issue may be related. Does it happen for every scene or it is related to ros scene ? I personnaly don't see these issues with basic tests example, so it may be related to specific environment or scenes.

Felix Ruess felix.ruess@gmail.com a écrit :

Seems to do the trick :-)

Btw, I also have some problems regarding the logger, when running the simulation for the second time, maybe it's something similar?

[ 0.195] Component: 'imu' using middleware 'morse.middleware.ros_mw.ROSClass' Traceback (most recent call last): File "/usr/lib/python3.2/logging/handlers.py", line 79, in emit logging.FileHandler.emit(self, record) AttributeError: 'NoneType' object has no attribute 'FileHandler' Logged from file topics.py, line 1034 [ 0.395] [middleware.ros_mw] Middleware initialization Traceback (most recent call last): File "/usr/lib/python3.2/logging/handlers.py", line 79, in emit logging.FileHandler.emit(self, record) AttributeError: 'NoneType' object has no attribute 'FileHandler' Logged from file ros_mw.py, line 15 ....

On Mon, Oct 29, 2012 at 8:12 PM, Arnaud Degroote <arnaud.degroote@laas.fr wrote:

On 29/Oct - 11:53, Felix Ruess wrote:

I guess the attached patch got stripped by github?

Probably. I send you it again directly

On Mon, Oct 29, 2012 at 6:53 PM, Arnaud Degroote notifications@github.comwrote:

On 29/Oct - 09:49, Felix Ruess wrote:

It actually doesn't seem to happen when running the simulation directly or starting it for the first time. However, stopping GE via Esc and restarting it with p triggers this issue. For example this happens with the scene examples/scenarii/quadrotor_dynamic_example.py

Can you test the following patch ? I'm not sure why it works but it seems to fix the issue. Still, it is quite mysterious!

Arnaud Degroote Postdoc RIA LAAS - CNRS

— Reply to this email directly or view it on GitHubhttps://github.com/laas/morse/issues/167#issuecomment-9883353.

adegroote commented 12 years ago

It does not seem related to previous issue. It is an issue related to ROS only, probably to some picky uses of logging interface in ROS itself. I will open an issue in the bugtracker, but it is not blocking for 0.6, as it works correctly after these errors (at least it emits right values on the topics).

adegroote commented 11 years ago

Nobody import directly bge nor bpy, so close it.