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

DM-28452: update the ports #34

Merged
merged 5 commits into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/compensation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
43 changes: 36 additions & 7 deletions python/lsst/ts/mthexapod/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand All @@ -20,21 +20,16 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

__all__ = [
"CAM_SYNC_PATTERN",
"M2_SYNC_PATTERN",
"MAX_ACCEL_LIMIT",
"MAX_LINEAR_VEL_LIMIT",
"MAX_ANGULAR_VEL_LIMIT",
"MAX_POSITION_LIMITS",
"IndexControllerConstants",
]

from . import base
from . import enums

# Required value of command.sync_pattern for MTHexapod commands.
CAM_SYNC_PATTERN = 0x6666
M2_SYNC_PATTERN = 0xB4B4

# Limits for the configureAcceleration command (deg/sec^2).
MAX_ACCEL_LIMIT = 500.0

Expand All @@ -51,3 +46,37 @@
maxXY=10500, minZ=-8900, maxZ=8900, maxUV=0.175, minW=-0.05, maxW=0.05,
),
}


class ControllerConstants:
"""Constants needed to communicate with a low-level MTHexapod controller.

Parameters
----------
port : `int`
Configuration and telemetry port.
The command port is one larger than this value.
sync_pattern : `int`
Sync pattern for commands to the low-level controller.
config_frame_id : `int`
Frame ID for configuration messages from the low-level controller.
telemetry_frame_id : `int`
Frame ID for telemetry messages from the low-level controller.
"""

def __init__(self, port, sync_pattern, config_frame_id, telemetry_frame_id):
self.port = port
self.sync_pattern = sync_pattern
self.config_frame_id = config_frame_id
self.telemetry_frame_id = telemetry_frame_id


# Dict of SalIndex: ControllerConstants
IndexControllerConstants = {
enums.SalIndex.CAMERA_HEXAPOD: ControllerConstants(
port=5560, sync_pattern=0x6666, config_frame_id=0x1B, telemetry_frame_id=0x7,
),
enums.SalIndex.M2_HEXAPOD: ControllerConstants(
port=5550, sync_pattern=0xB4B4, config_frame_id=0x1C, telemetry_frame_id=0x8,
),
}
14 changes: 2 additions & 12 deletions python/lsst/ts/mthexapod/enums.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand All @@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

__all__ = ["SalIndex", "CommandCode", "FrameId", "SetEnabledSubstateParam"]
__all__ = ["SalIndex", "CommandCode", "SetEnabledSubstateParam"]

import enum

Expand All @@ -46,16 +46,6 @@ class CommandCode(enum.IntEnum):
OFFSET = 0x8010


class FrameId(enum.IntEnum):
"""Frame IDs for Camera and M2 MTHexapod telemetry and configuration.
"""

CAM_TELEMETRY = 0x7
CAM_CONFIG = 0x1B
M2_TELEMETRY = 0x8
M2_CONFIG = 0x1C


class SetEnabledSubstateParam(enum.IntEnum):
"""Substates for the ENABLED state.
"""
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/fourier_series.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/hexapod_commander.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
30 changes: 3 additions & 27 deletions python/lsst/ts/mthexapod/hexapod_csc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down Expand Up @@ -39,31 +39,6 @@
from . import utils


class ControllerConstants:
"""Constants needed to communicate with an MTHexapod controller.
"""

def __init__(self, sync_pattern, config_frame_id, telemetry_frame_id):
self.sync_pattern = sync_pattern
self.config_frame_id = config_frame_id
self.telemetry_frame_id = telemetry_frame_id


# Dict of SalIndex: ControllerConstants
IndexControllerConstants = {
enums.SalIndex.CAMERA_HEXAPOD: ControllerConstants(
sync_pattern=constants.CAM_SYNC_PATTERN,
config_frame_id=enums.FrameId.CAM_CONFIG,
telemetry_frame_id=enums.FrameId.CAM_TELEMETRY,
),
enums.SalIndex.M2_HEXAPOD: ControllerConstants(
sync_pattern=constants.M2_SYNC_PATTERN,
config_frame_id=enums.FrameId.M2_CONFIG,
telemetry_frame_id=enums.FrameId.M2_TELEMETRY,
),
}


class HexapodCsc(hexrotcomm.BaseCsc):
"""MTHexapod CSC.

Expand Down Expand Up @@ -120,7 +95,7 @@ def __init__(
simulation_mode=0,
):
index = enums.SalIndex(index)
controller_constants = IndexControllerConstants[index]
controller_constants = constants.IndexControllerConstants[index]

# The maximum position limits configured in the low-level controller.
# The limits specified by the configureLimits command must be
Expand Down Expand Up @@ -152,6 +127,7 @@ def __init__(
super().__init__(
name="MTHexapod",
index=index,
port=controller_constants.port,
sync_pattern=controller_constants.sync_pattern,
CommandCode=enums.CommandCode,
ConfigClass=structs.Config,
Expand Down
19 changes: 10 additions & 9 deletions python/lsst/ts/mthexapod/mock_controller.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down Expand Up @@ -53,12 +53,12 @@ class MockMTHexapodController(hexrotcomm.BaseMockController):
Logger.
host : `str` (optional)
IP address of CSC server.
command_port : `int` (optional)
Command socket port. This argument is intended for unit tests;
use the default value for normal operation.
telemetry_port : `int` (optional)
Telemetry socket port. This argument is intended for unit tests;
use the default value for normal operation.
command_port : `int` or `None` (optional)
Command socket port.
If `None` then use the default port for this device.
telemetry_port : `int` or `None` (optional)
Telemetry socket port.
If `None` then use the default port for this device.
initial_state : `lsst.ts.idl.enums.MTHexapod.ControllerState` (optional)
Initial state of mock controller.

Expand Down Expand Up @@ -119,12 +119,13 @@ def __init__(
index,
log,
host=hexrotcomm.LOCAL_HOST,
command_port=hexrotcomm.COMMAND_PORT,
telemetry_port=hexrotcomm.TELEMETRY_PORT,
command_port=None,
telemetry_port=None,
initial_state=ControllerState.OFFLINE,
):
index = enums.SalIndex(index)
self.max_pos_limits = constants.MAX_POSITION_LIMITS[index]

# Amplitude of jitter in various measured values,
# to simulate encoder jitter. This add realism
# and exercises jitter rejection in HexapodCommander.
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/ranged_polynomial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/simple_hexapod.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/structs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/mthexapod/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion tests/test_compensation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
4 changes: 1 addition & 3 deletions tests/test_csc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down Expand Up @@ -78,7 +78,6 @@ async def make_csc(
settings_to_apply="",
simulation_mode=1,
log_level=None,
timeout=STD_TIMEOUT,
):
# TODO DM-28005: add a controller for the temperature
async with super().make_csc(
Expand All @@ -87,7 +86,6 @@ async def make_csc(
settings_to_apply=settings_to_apply,
simulation_mode=simulation_mode,
log_level=log_level,
timeout=timeout,
), salobj.Controller(
name="MTMount",
) as self.mtmount_controller, salobj.Controller(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fourier_series.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ranged_polynomial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion tests/test_simple_hexapod.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_mthexapod.
#
# Developed for the LSST Data Management System.
# Developed for the Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand Down