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

henthorn/sim pblog #44

Merged
merged 25 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
658239f
Created buoy-type logging for buoy_sim
rhenthorn Mar 16, 2023
aaa329b
Clean up formatting to match buoy logging
rhenthorn Mar 16, 2023
4410cc6
Fix flake8 and pep8 erros
rhenthorn Mar 17, 2023
5f17a56
Fix flake8 and pep8 errors 2
rhenthorn Mar 17, 2023
48edd2f
Fix flake8 and pep8 errors 3
rhenthorn Mar 17, 2023
3eb209c
Formatting erros in launch script - empty line needed
rhenthorn Mar 17, 2023
d24f247
Add epoch seconds offset to simulation time, log that value as the ti…
rhenthorn Mar 22, 2023
eee7544
Corrected header line
rhenthorn Mar 23, 2023
b6e8558
Move log home and file interval to class attributes
rhenthorn Mar 27, 2023
dd40061
Merge branch 'main' into henthorn/sim_pblog
andermi Apr 11, 2023
a6ad9cb
Add pblog args (#47)
andermi May 3, 2023
9542728
Merge branch 'main' into henthorn/sim_pblog
andermi May 3, 2023
6732d21
Corrected error: using pc_header to calculate the 'blank' cells in a …
rhenthorn May 4, 2023
cfc6b2d
Merge branch 'main' into henthorn/sim_pblog
andermi May 10, 2023
accde04
tweak msg time a little
andermi May 11, 2023
73a5b27
Fix pbcmd terminate (#50)
andermi May 15, 2023
1877a19
line buffered csv
andermi May 16, 2023
e3061da
linter
andermi May 16, 2023
5118cbf
Update sim_pblog/sim_pblog/sim_pblog.py
andermi May 16, 2023
53f45d5
fix data loss with log rolling
andermi May 16, 2023
c497a0c
Merge branch 'henthorn/sim_pblog' of https://github.com/osrf/mbari_we…
andermi May 16, 2023
35e3ad2
bugfix
andermi May 16, 2023
0b57d39
linter
andermi May 16, 2023
c48f52c
linter
andermi May 16, 2023
a20591c
Convert SC values from newtons and meters to lbs and inches
rhenthorn May 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 129 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,132 @@ __pycache__
*.swp
*.save*

splinter/include/splinter
splinter/lib
splinter/splinter
splinter/assets
splinter/CREDITS.md
splinter/docs
splinter/README_SPLINTER.md
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
28 changes: 24 additions & 4 deletions buoy_api_py/buoy_api/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,36 +233,56 @@ def use_sim_time(self, enable=True):
self.set_parameters([Parameter('use_sim_time', Parameter.Type.BOOL, enable)])

# set publish rate of PC Microcontroller telemetry
def set_pc_pack_rate_param(self, rate_hz=50.0):
def set_pc_pack_rate_param(self, rate_hz=50.0, blocking=True):
return asyncio.run(self._set_pc_pack_rate_param(rate_hz, blocking))

async def _set_pc_pack_rate_param(self, rate_hz=50.0, blocking=True):
request = SetParameters.Request()
request.parameters = [Parameter(name='publish_rate',
value=float(rate_hz)).to_parameter_msg()]
self.pc_pack_rate_param_future_ = self.pc_pack_rate_param_client_.call_async(request)
self.pc_pack_rate_param_future_.add_done_callback(self.param_response_callback)
if blocking:
await self.pc_pack_rate_param_future_

# set publish rate of SC Microcontroller telemetry
def set_sc_pack_rate_param(self, rate_hz=50.0):
def set_sc_pack_rate_param(self, rate_hz=50.0, blocking=True):
return asyncio.run(self._set_sc_pack_rate_param(rate_hz, blocking))

async def _set_sc_pack_rate_param(self, rate_hz=50.0, blocking=True):
request = SetParameters.Request()
request.parameters = [Parameter(name='publish_rate',
value=float(rate_hz)).to_parameter_msg()]
self.sc_pack_rate_param_future_ = self.sc_pack_rate_param_client_.call_async(request)
self.sc_pack_rate_param_future_.add_done_callback(self.param_response_callback)
if blocking:
await self.sc_pack_rate_param_future_

# set publish rate of PC Microcontroller telemetry
def set_pc_pack_rate(self, rate_hz=50):
def set_pc_pack_rate(self, rate_hz=50, blocking=True):
return asyncio.run(self._set_pc_pack_rate(rate_hz, blocking))

async def _set_pc_pack_rate(self, rate_hz=50, blocking=True):
request = PCPackRateCommand.Request()
request.rate_hz = int(rate_hz)

self.pc_pack_rate_future_ = self.pc_pack_rate_client_.call_async(request)
self.pc_pack_rate_future_.add_done_callback(self.default_service_response_callback)
if blocking:
await self.pc_pack_rate_future_

# set publish rate of SC Microcontroller telemetry
def set_sc_pack_rate(self, rate_hz=50):
def set_sc_pack_rate(self, rate_hz=50, blocking=True):
return asyncio.run(self._set_sc_pack_rate(rate_hz, blocking))

async def _set_sc_pack_rate(self, rate_hz=50, blocking=True):
request = SCPackRateCommand.Request()
request.rate_hz = int(rate_hz)

self.sc_pack_rate_future_ = self.sc_pack_rate_client_.call_async(request)
self.sc_pack_rate_future_.add_done_callback(self.default_service_response_callback)
if blocking:
await self.sc_pack_rate_future_

def send_pump_command(self, duration_mins, blocking=True):
return asyncio.run(self._send_pump_command(duration_mins, blocking))
Expand Down
4 changes: 2 additions & 2 deletions pbcmd/pbcmd/pbcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def sc_pack_rate(parser):
print('Executing sc_pack_rate to Set the CANBUS packet rate ' +
f'from the Spring Controller: {args.rate_hz} Hz')
_pbcmd = _PBCmd()
_pbcmd.set_sc_pack_rate_param(args.rate_hz)
_pbcmd.set_sc_pack_rate(args.rate_hz)


def pc_PackRate(parser):
Expand All @@ -169,7 +169,7 @@ def pc_PackRate(parser):
print('Executing pc_PackRate to Set the CANBUS packet rate ' +
f'from the Power Controller: {args.rate_hz} Hz')
_pbcmd = _PBCmd()
_pbcmd.set_pc_pack_rate_param(args.rate_hz)
_pbcmd.set_pc_pack_rate(args.rate_hz)


def pc_Scale(parser):
Expand Down
Loading