Skip to content

Commit

Permalink
Merge pull request #26 from lsst-ts/tickets/DM-44072
Browse files Browse the repository at this point in the history
DM-44072: CameraRotator VMS
  • Loading branch information
pkubanek authored May 28, 2024
2 parents 4a1c8a6 + a6c72c6 commit dad159b
Show file tree
Hide file tree
Showing 18 changed files with 144,127 additions and 28,937 deletions.
26,661 changes: 0 additions & 26,661 deletions Bitfiles/NiFpga_VMS_CameraRotator.lvbitx

This file was deleted.

69,475 changes: 69,475 additions & 0 deletions Bitfiles/NiFpga_VMS_CameraRotator_Controller.lvbitx

Large diffs are not rendered by default.

69,946 changes: 69,946 additions & 0 deletions Bitfiles/NiFpga_VMS_CameraRotator_Responder.lvbitx

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ SAL_CPPFLAGS += $(PKG_CPPFLAGS) \
-I${SAL_WORK_DIR}/MTM1M3/cpp/src -I${SAL_WORK_DIR}/MTMount/cpp/src -I${SAL_WORK_DIR}/include \
-I${SAL_HOME}/include -I${LSST_SDK_INSTALL}/include

LIBS := $(shell pkg-config yaml-cpp --libs $(silence)) \
$(shell pkg-config fmt --libs $(silence)) \
$(shell pkg-config fftw3 --libs $(silence)) \
-ldl -ldcpssacpp -ldcpsgapi -lddsuser -lddskernel \
-lpthread -lddsserialization -lddsconfparser -lddsconf \
-lddsdatabase -lddsutil -lddsos \
${SAL_WORK_DIR}/lib/libSAL_MTVMS.a

PKG_LIBS := \
$(shell pkg-config yaml-cpp --libs $(silence)) \
$(shell pkg-config fftw3 --libs $(silence)) \
Expand Down
1 change: 0 additions & 1 deletion SettingFiles/CameraRotator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Subsystem : "CameraRotator"
IsController : true
Period: 5
OutputType: 3
RIO : "rio://139.229.178.192/RIO"
XCoefficients : [1.0,1.0,1.0]
YCoefficients : [1.0,1.0,1.0]
ZCoefficients : [1.0,1.0,1.0]
Expand Down
3 changes: 2 additions & 1 deletion default_ts-VMS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Configurations to start on this VMS
#VMS="M1M3"
#VMS="M2 CameraRotator"
#VMS="M2"
#VMS="CameraRotator"

OSPL_HOME=/opt/OpenSpliceDDS/V6.10.4/HDE/x86_64.linux
OSPL_RELEASE=6.10.4
Expand Down
5 changes: 5 additions & 0 deletions doc/version-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
Version History
===============

v1.2.1
------

* New CameraRotator cRIO module

v1.2.0
------

Expand Down
6 changes: 4 additions & 2 deletions src/LSST/VMS/Commands/EnterControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#ifndef _VMS_Command_EnterControl_
#define _VMS_Command_ENterControl_

#include <cRIO/Task.h>
#include <SAL_MTVMS.h>
#include <VMSPublisher.h>
#include <cRIO/Command.h>
Expand All @@ -33,13 +34,14 @@ namespace LSST {
namespace VMS {
namespace Commands {

class EnterControl : public cRIO::Command {
class EnterControl : public cRIO::Task {
public:
void execute() override {
cRIO::task_return_t run() override {
SPDLOG_DEBUG("EnterControl");
VMSPublisher::instance().logSoftwareVersions();
VMSPublisher::instance().logSimulationMode();
Events::SummaryState::setState(MTVMS::MTVMS_shared_SummaryStates_StandbyState);
return Task::DONT_RESCHEDULE;
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/LSST/VMS/Commands/Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

using namespace LSST::VMS::Commands;

void Update::execute() {
LSST::cRIO::task_return_t Update::run() {
VMSPublisher::instance().putMiscellaneous(FPGA::instance().chassisTemperature(),
FPGA::instance().chassisTicks());
return Task::DONT_RESCHEDULE;
}
6 changes: 3 additions & 3 deletions src/LSST/VMS/Commands/Update.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <mutex>

#include <cRIO/Command.h>
#include <cRIO/Task.h>

namespace LSST {
namespace VMS {
Expand All @@ -36,12 +36,12 @@ namespace Commands {
* This command is responsible for running a periodic update.
* This is an internal command only and cannot be issued via SAL.
*/
class Update : public cRIO::Command {
class Update : public cRIO::Task {
public:
Update() {}
virtual ~Update() {}

void execute() override;
cRIO::task_return_t run() override;
};

} /* namespace Commands */
Expand Down
18 changes: 12 additions & 6 deletions src/LSST/VMS/FPGA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
#include <NiFpga_VMS_3_Responder.h>
#include <NiFpga_VMS_6_Controller.h>
#include <NiFpga_VMS_6_Responder.h>
#include <NiFpga_VMS_CameraRotator.h>
#include <NiFpga_VMS_CameraRotator_Controller.h>
#include <NiFpga_VMS_CameraRotator_Responder.h>
#include <VMSApplicationSettings.h>
#include <VMSPublisher.h>
#include <cRIO/NiError.h>
Expand All @@ -50,6 +51,7 @@ FPGA::FPGA(token) : SimpleFPGA(LSST::cRIO::VMS) {}

#define NiFpga_VMS_6_Responder_ControlBool_Operate -1
#define NiFpga_VMS_3_Responder_ControlBool_Operate -1
#define NiFpga_VMS_CameraRotator_Responder_ControlBool_Operate -1

#define POPULATE_FPGA(type) \
_bitFile = "/var/lib/MTVMS/" NiFpga_VMS_##type##_Bitfile; \
Expand All @@ -71,22 +73,26 @@ void FPGA::populate(VMSApplicationSettings *vmsApplicationSettings) {
_vmsApplicationSettings = vmsApplicationSettings;
session = 0;
remaining = 0;
if (_vmsApplicationSettings->Subsystem == "CameraRotator") {
if ((_vmsApplicationSettings->Subsystem == "M1M3")) {
_channels = 3;
POPULATE_FPGA(CameraRotator);
if (_vmsApplicationSettings->IsController) {
POPULATE_FPGA(3_Controller);
} else {
POPULATE_FPGA(3_Responder);
}
} else if (_vmsApplicationSettings->Subsystem == "M2") {
_channels = 6;
if (_vmsApplicationSettings->IsController) {
POPULATE_FPGA(6_Controller);
} else {
POPULATE_FPGA(6_Responder);
}
} else if (_vmsApplicationSettings->Subsystem == "M1M3") {
} else if ((_vmsApplicationSettings->Subsystem == "CameraRotator")) {
_channels = 3;
if (_vmsApplicationSettings->IsController) {
POPULATE_FPGA(3_Controller);
POPULATE_FPGA(CameraRotator_Controller);
} else {
POPULATE_FPGA(3_Responder);
POPULATE_FPGA(CameraRotator_Responder);
}
}
}
Expand Down
25 changes: 13 additions & 12 deletions src/LSST/VMS/VMSSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ constexpr int32_t ACK_COMPLETE = 303; /// Command is completed.
constexpr int32_t ACK_FAILED = -302; /// Command execution failed.

VMSSubscriber::VMSSubscriber(std::shared_ptr<SAL_MTVMS> vmsSAL, std::shared_ptr<SAL_MTVMS> allvmsSAL) {
#define ADD_SAL_COMMAND(name) \
_commands[#name] = [vmsSAL]() { \
MTVMS_command_##name##C data; \
int32_t commandID = vmsSAL->acceptCommand_##name(&data); \
if (commandID <= 0) return; \
cRIO::ControllerThread::instance().enqueue(new Commands::SAL_##name(commandID, &data)); \
#define ADD_SAL_COMMAND(name) \
_commands[#name] = [vmsSAL]() { \
MTVMS_command_##name##C data; \
int32_t commandID = vmsSAL->acceptCommand_##name(&data); \
if (commandID <= 0) return; \
cRIO::ControllerThread::instance().enqueue( \
std::make_shared<Commands::SAL_##name>(commandID, &data)); \
}

ADD_SAL_COMMAND(start);
Expand All @@ -52,12 +53,12 @@ VMSSubscriber::VMSSubscriber(std::shared_ptr<SAL_MTVMS> vmsSAL, std::shared_ptr<
ADD_SAL_COMMAND(exitControl);
ADD_SAL_COMMAND(changeSamplePeriod);

#define ADD_SAL_EVENT(name) \
_events[#name] = [allvmsSAL]() { \
MTVMS_logevent_##name##C data; \
int32_t result = allvmsSAL->getEvent_##name(&data); \
if (result == SAL__NO_UPDATES) return; \
cRIO::ControllerThread::instance().enqueueEvent(new Commands::SAL_##name(&data)); \
#define ADD_SAL_EVENT(name) \
_events[#name] = [allvmsSAL]() { \
MTVMS_logevent_##name##C data; \
int32_t result = allvmsSAL->getEvent_##name(&data); \
if (result == SAL__NO_UPDATES) return; \
cRIO::ControllerThread::instance().enqueue(std::make_shared<Commands::SAL_##name>(&data)); \
}

ADD_SAL_EVENT(timeSynchronization);
Expand Down
Loading

0 comments on commit dad159b

Please sign in to comment.