Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging of raw laser data + fixup for turning off in navpat #34

Merged
merged 2 commits into from
Dec 5, 2017

Conversation

m3d
Copy link
Member

@m3d m3d commented Oct 21, 2017

This is the second pull request from recent feature/testYYMMDD related to laser logging and debugging issue with 20s gaps. They were caused by previously turned off laser, but detailed logging of communication could be useful also in the future (and now I would need it also for Velodyne, so some kind of reuse is expected).

@m3d m3d requested a review from zwn October 21, 2017 07:17
Copy link
Member

@zwn zwn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please not that I have not actually tried to run the code.

laser.py Show resolved Hide resolved
self._buffer = ""
Laser.__init__( self, **kw )
self.sendCmd( 'sMN SetAccessMode 03 F4724744' )

def __del__( self ):
self.socket.close()
self.raw_log.close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__del__ is not guaranteed to be called. The only way to be sure close() is really called is to use context manager. It might not cause problem in this particular case because you call flush after each write but in general I would not consider this to be a good practice. For the future please consider using context managers for such cases.

@@ -69,6 +69,7 @@ def attach_sensor(robot, sensor_name, metalog):
function2 = SourceLogger(None, remission_log_name).get
else:
robot.laser = LaserIP(remission=True)
robot.laser.stopOnExit = False # for faster boot-up
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the naming here - stopOnExit? If it is False something should not stop on exit. That something is laser. So, is stop actually a shutdown? And exit is end of the program? I don't have a much better name though 😟

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is on sys.exit() of the program - it is rather "legacy" variable (taken from Eduro).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning to handle somehow the act of shutting down everything? I remember one of the problems was not waiting for the threads to really finish/exit.

@m3d
Copy link
Member Author

m3d commented Dec 5, 2017

This code block will be replaced by newer logger (from https://github.com/robotika/naio), so I will merge it to simplify also Python3 transition.

- add timestamp into laserraw binary log
- add tool for parsing raw laser data
@m3d m3d merged commit 73c748c into master Dec 5, 2017
@m3d m3d deleted the feature/laserraw branch December 5, 2017 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants