Commit a3d8f6a5 authored by Jacques Ratel's avatar Jacques Ratel

New encoder: RDC (resolver to digital converter).

Start and read the positions histograms.
parent 3501b595
......@@ -88,6 +88,7 @@ void AxisCommon::constructor() {
wantedResolutionMotorSpeedMode.init(this, SAVE, "wanted_resolution_motor_speedmode");
plotEnabled.init(this, NOSAVE, "plot_enabled");
plotHistoStarted.init(this, NOSAVE, "plot_histo_started");
registerCategory("axis");
......
......@@ -112,6 +112,7 @@ public:
Property<int32> wantedResolutionMotorSpeedMode; //! Motor resolution property
Property<bool> plotEnabled; //! allow reading plots
Property<bool> plotHistoStarted; //! allow reading Rdc Histogram plot
// Manual direction
static const int32 DOWN_DIRECTION;
......
......@@ -435,6 +435,7 @@ void AxisController::start() {
commandProgression = 0;
axisDriver->plotEnabled = false;
axisDriver->plotHistoStarted = false;
try {
if (useRelativePosition() == true) {
......
......@@ -42,6 +42,8 @@ static const uint32 VME_CURVES_AXIS_OFFSET = 0x1000;
static const uint32 VME_MAC_POSITION_CURVE_REGISTER = 0x100000;
static const uint32 VME_MAC_SPEED_CURVE_REGISTER = VME_MAC_POSITION_CURVE_REGISTER + 8 *((NB_AXIS * VME_CURVES_AXIS_OFFSET));
static const uint32 VME_MAC_COMMAND_CURVE_REGISTER = VME_MAC_POSITION_CURVE_REGISTER + 16 *((NB_AXIS * VME_CURVES_AXIS_OFFSET));
// Curve register rdc
static const uint32 VME_MAC_CURVE_RDC_REGISTER = VME_MAC_POSITION_CURVE_REGISTER + 24 *((NB_AXIS * VME_CURVES_AXIS_OFFSET));
// IO mode
static const uint32 VME_IO_ON_OFF_REGISTER = 0x18;
static const uint32 VME_IO_ACTION_REGISTER = 0x1C;
......@@ -89,6 +91,14 @@ static const uint32 MODE_REGISTER_4_7 = 0X40;
static const uint32 OUTPUT_REGISTER_0 = 0X2;
static const uint32 OFFSET_OUTPUT_REGISTER = 0X10;
// values for the SCI RDC.
static const uint32 HISTOGRAM_CHANNEL_REGISTER = 0X90;
static const uint32 START_HISTOGRAM_REGISTER = 0Xf4;
static const uint32 ERASE_HISTOGRAM_REGISTER = 0Xf8;
static const uint32 HISTOGRAM_BASE = 0X40000;
static const uint32 HISTOGRAM_DEPTH = 0X10000;
// Motor Type
enum MotorType {
......@@ -183,6 +193,8 @@ enum Commands {
MANUAL_MOVE_COMMAND = 12,
READ_TUNE_UP_FILES_COMMAND = 13,
IN_OUT_COMMAND = 14,
START_HISTOGRAM_COMMAND = 15,
READ_HISTOGRAM_COMMAND = 16,
REBOOT_COMMAND = 0xF1,
TEST_COMMAND = 777
};
......
......@@ -40,6 +40,12 @@ const std::string MacAxisDriver::MAC_SAVE_PARAM_COMMAND = "saveParam";
const std::string MacAxisDriver::MAC_WRITE_COMMAND = "write";
const std::string MacAxisDriver::MAC_READ_TUNEUP_COMMAND = "readTuneup";
const std::string MacAxisDriver::MAC_IN_OUT_COMMAND = "inOut";
const std::string MacAxisDriver::MAC_START_HISTOGRAM_COMMAND = "startHistogram";
const std::string MacAxisDriver::MAC_READ_HISTOGRAM_COMMAND = "readHistogram";
//initCommand(MAC_START_HISTOGRAM_COMMAND);
//initCommand(MAC_READ_HISTOGRAM_COMMAND);
/*
* Constructor
......@@ -113,6 +119,7 @@ MacAxisDriver::MacAxisDriver(const string& name) {
calculatedSpeed.init(this, NOSAVE, "calculated_speed");
//achievedSpeed.init(this, NOSAVE, "achieved_speed");
commandAmplitude.init(this, NOSAVE, "command_amplitude");
rdcHistogram.init(this, NOSAVE, "rdc_histogram");
registerStates(new RealMacAxisDriver(this), new PerfectMacAxisDriver(this), new SimulatedMacAxisDriver(this));
......@@ -122,6 +129,8 @@ MacAxisDriver::MacAxisDriver(const string& name) {
initCommand(MAC_SAVE_PARAM_COMMAND);
initCommand(MAC_WRITE_COMMAND);
initCommand(MAC_READ_TUNEUP_COMMAND);
initCommand(MAC_START_HISTOGRAM_COMMAND);
initCommand(MAC_READ_HISTOGRAM_COMMAND);
initCommand(MAC_IN_OUT_COMMAND);
deviceType = LEAF_DEVICE_TYPE_DEVICE_CONTAINER;
......@@ -244,6 +253,12 @@ void MacAxisDriver::execute(const string& aCommand) {
currentState->write();
} else if (aCommand == MAC_READ_TUNEUP_COMMAND) {
currentState->readTuneupFiles();
} else if (aCommand == MAC_START_HISTOGRAM_COMMAND) {
//cout << "MAC_START_HISTOGRAM_COMMAND"<< endl;
currentState->startHistogram();
} else if (aCommand == MAC_READ_HISTOGRAM_COMMAND ) {
//cout << "MAC_READ_HISTOGRAM_COMMAND"<< endl;
currentState->readHistogram();
} else if (aCommand == MAC_IN_OUT_COMMAND) {
currentState->inOut();
} else if (aCommand == InOutCommon::IN_OUT_COMMAND) {
......@@ -403,6 +418,23 @@ void MacAxisDriver::setFileSizeTuneup(const int32 newSize) {
commandAmplitude.setSize(newSize);
}
/*
* setFileSizeHistogram
*/
void MacAxisDriver::setFileSizeHistogram(const int32 newSize) {
// Achieved position
if (rdcHistogram() != 0) {
delete[] rdcHistogram();
}
rdcHistogram = new int32[newSize];
if (rdcHistogram() == 0) {
throw NotEnoughMemory2(getType(), getName(), this, "FileSizeHistogram");
}
rdcHistogram.setSize(newSize);
}
/*
* calculateProgression
*/
......@@ -461,3 +493,5 @@ void MacAxisDriver::computeAxisStatus(int32 value) {
}
}
......@@ -68,6 +68,12 @@ public:
*/
void setFileSizeTuneup(const int32 newSize);
/*!
* \brief Resize the histogram plot table
* \param[in] newSize The new size
*/
void setFileSizeHistogram(const int32 newSize);
/*!
* Local values
*/
......@@ -82,6 +88,7 @@ public:
ArrayProperty<float64> calculatedSpeed; //! Tune-up calculated speed property
//ArrayProperty<float64> achievedSpeed; //! Tune-up achieved speed property
ArrayProperty<float64> commandAmplitude; //! Tune-up command property
ArrayProperty<int32> rdcHistogram; //! Histogram from the rdc encoder.
Property<bool> keepParam; //! Flag keep rio axis parameters property
......@@ -214,6 +221,8 @@ private:
static const std::string MAC_SAVE_PARAM_COMMAND;
static const std::string MAC_WRITE_COMMAND;
static const std::string MAC_READ_TUNEUP_COMMAND;
static const std::string MAC_START_HISTOGRAM_COMMAND;
static const std::string MAC_READ_HISTOGRAM_COMMAND;
static const std::string MAC_IN_OUT_COMMAND;
};
......
......@@ -130,6 +130,16 @@ public:
*/
virtual void readTuneupFiles() = 0;
/*!
* \brief startHistogram in the case of an Rdc encoder.
*/
virtual void startHistogram() = 0;
/*!
* \brief readHistogram in the case of an Rdc encoder.
*/
virtual void readHistogram() = 0;
/*!
* \brief Input Output function.
*/
......
......@@ -117,6 +117,20 @@ void PerfectMacAxisDriver::readTuneupFiles(){
}
/*
* startHistogram()
*/
void PerfectMacAxisDriver::startHistogram(){
}
/*
* readHistogram()
*/
void PerfectMacAxisDriver::readHistogram(){
}
/*
* inOut
*/
......
......@@ -134,6 +134,16 @@ public:
*/
virtual void readTuneupFiles();
/*!
* \brief Implement startHistogram command implementation
*/
virtual void startHistogram();
/*!
* \brief Implement readHistogram command implementation
*/
virtual void readHistogram();
/*!
* \brief Implement input output command implementation
*/
......
......@@ -599,6 +599,32 @@ void RealMacAxisDriver::readTuneupFiles() {
owner()->commandAmplitude.sendEvent();
}
void RealMacAxisDriver::startHistogram() {
function(START_HISTOGRAM_COMMAND, true);
owner()->plotHistoStarted = true;
}
/*
* readHistogram
*/
void RealMacAxisDriver::readHistogram() {
int32 the_size;
function(READ_HISTOGRAM_COMMAND, true);
the_size = HISTOGRAM_DEPTH;
owner()->setFileSizeHistogram(the_size);
/*
* The size
*/
int32* buf = owner()->rdcHistogram();
owner()->read(VME_MAC_CURVE_RDC_REGISTER, Vme::LONGWORD_WIDTH, the_size, (void*) buf , owner());
owner()->rdcHistogram.sendEvent();
}
/*
* manualMove
*/
......
......@@ -134,6 +134,16 @@ public:
*/
virtual void readTuneupFiles();
/*!
* \brief Implement startHistogram command implementation
*/
virtual void startHistogram();
/*!
* \brief Implement readHistogram command implementation
*/
virtual void readHistogram();
/*!
* \brief Implement input output command implementation
*/
......
......@@ -247,6 +247,18 @@ void SimulatedMacAxisDriver::moveSinu() {
void SimulatedMacAxisDriver::readTuneupFiles() {
}
/*
* startHistogram
*/
void SimulatedMacAxisDriver::startHistogram() {
}
/*
* readHistogram
*/
void SimulatedMacAxisDriver::readHistogram() {
}
/*
* inOut
*/
......
......@@ -136,6 +136,16 @@ public:
*/
virtual void readTuneupFiles();
/*!
* \brief startHistogram command implementation
*/
virtual void startHistogram();
/*!
* \brief readHistogram command implementation
*/
virtual void readHistogram();
/*!
* \brief Implement input output command implementation
*/
......
......@@ -359,6 +359,9 @@ macAxis.writeParam=Write
macAxis.readParam=Read
macAxis.manualMove=Move
macAxis.stop=Stop
macAxis.startHistogram=Start
macAxis.readHistogram=Read
macAxis.clearHistogram=Clear
#Commands(command = role + server command)
rioAxis.readTuneupCommand=readTuneup
......@@ -367,7 +370,9 @@ macAxis.StopCommand=Stop
macAxis.speedMoveCommand=Move
macAxis.SinusCommand=Move
macAxis.inoutCommand=inOut
macAxis.startHistogramCommand=startHistogram
macAxis.readHistogramCommand=readHistogram
macAxis.histogram.group=Histogram
#Plot legend
macAxis.testingPlotTitle=Test Plots
......@@ -378,7 +383,7 @@ macAxis.calculated_speed_legend=Calculated Speed
#macAxis.achieved_speed_legend=Achieved Speed
#macAxis.command_ident_legend=Command Amplitude
#macAxis.speed_ident_legend=Speed Amplitude
macAxis.rdc_histogram_legend = Rdc Histogram
#Group InOut
macAxis.inoutOnOffSuffix=In/Out
macAxis.inoutOnOffCheckedValue=1
......
......@@ -11,6 +11,9 @@
<plotdata key="calculated_speed_plot" legend_key="macAxis.calculated_speed_legend" color="006600" plugins="SETUP">
<dataY p_role="MacAxis1" p_name="calculated_speed"/>
</plotdata>
<plotdata key="rdc_histogram_plot" legend_key="macAxis.rdc_histogram_legend" color="006600" plugins="SETUP">
<dataY p_role="MacAxis1" p_name="rdc_histogram"/>
</plotdata>
<!-- <plotdata key="achieved_speed_plot" legend_key="macAxis.achieved_speed_legend" color="006600" plugins="SETUP"> -->
<!-- <dataY p_role="MacAxis1" p_name="achieved_speed"/> -->
<!-- </plotdata> -->
......
......@@ -197,6 +197,9 @@
<property name="plot_enabled" type="Boolean">
</property>
<property name="plot_histo_started" type="Boolean">
</property>
<property name="sim_uphardstop" type="Boolean">
</property>
......
......@@ -25,6 +25,8 @@
switcher_key="testTypeSwitchKey" />
<property_switcher role="MacAxis1" property="plot_enabled"
switcher_key="plotEnabledSwitchKey" />
<property_switcher role="MacAxis1" property="plot_histo_started"
switcher_key="HistoStartedSwitchKey" />
<property_switcher role="MacAxis1" property="inout_open"
switcher_key="inoutOpenSwitchKey" />
<property_switcher role="MacAxis1" property="inout_config"
......@@ -108,20 +110,39 @@
<switchable_composite switch_values="2"
switcher_key="encoderTypeSwitchKey">
<switchable_composite switch_values="104,105,106"
<switchable_composite switch_values="104"
switcher_key="encoderSpecificationSwitchKey">
<group title="macAxis.baud.group">
<radio role="MacAxis1" property="encoderBaudRate"
valuesAndLabels="macAxis.baudK500,macAxis.baudK250,macAxis.baudK125,macAxis.baudK62_5"
spaceBefore="false" />
</group>
</switchable_composite>
<switchable_composite switch_values="105,106"
switcher_key="encoderSpecificationSwitchKey">
<group title="macAxis.histogram.group">
<switchable_composite switch_values="false"
switcher_key="HistoStartedSwitchKey">
<button role="MacAxis1" command="startHistogram" prefix="macAxis.startHistogram" />
</switchable_composite>
<switchable_composite switch_values="true"
switcher_key="HistoStartedSwitchKey">
<button role="MacAxis1" command="readHistogram" prefix="macAxis.readHistogram" />
<button role="MacAxis1" command="startHistogram" prefix="macAxis.clearHistogram" />
<plot_launcher role="MacAxis1" data="rdc_histogram_plot"
title="macAxis.testingPlotTitle" height="20" />
</switchable_composite>
</group>
</switchable_composite>
<!--<switchable_composite switch_values="37,36,35,34,33" switcher_key="encoderBitsNumberSwitchKey">
<combo role="MacAxis1" property="encoderShift" prefix="macAxis.encoderShiftPrefix"
valuesAndLabels="macAxis.Shift0,macAxis.Shift1,macAxis.Shift2,macAxis.Shift3,macAxis.Shift4,macAxis.Shift5"
/> </switchable_composite> -->
</switchable_composite>
</switchable_composite>
<!--</switchable_composite> -->
<newLine />
......@@ -151,7 +172,7 @@
<switchable_composite switch_values="2"
switcher_key="encoderTypeSwitchKey">
<switchable_composite switch_values="104,105,106"
<switchable_composite switch_values="104"
switcher_key="encoderSpecificationSwitchKey">
<group title="macAxis.code.group">
<radio role="MacAxis1" property="encoderCode"
......@@ -176,13 +197,13 @@
<switchable_composite switch_values="1,2,3,4"
switcher_key="encoderTypeSwitchKey">
<switchable_composite
switch_values="2,3,4,5,101,102,103,104,105,106,200,201,202,203,300,301,302,303,304"
switch_values="2,3,4,5,101,102,103,104,200,201,202,203,300,301,302,303,304"
switcher_key="encoderSpecificationSwitchKey">
<text role="MacAxis1" property="encoderBitsNumber"
prefix="macAxis.encoderBitsNumberPrefix" />
</switchable_composite>
<switchable_composite switch_values="103,104,105,106"
<switchable_composite switch_values="103,104"
switcher_key="encoderSpecificationSwitchKey">
<combo role="MacAxis1" property="encoderShift" prefix="macAxis.encoderShiftPrefix"
valuesAndLabels="macAxis.Shift0,macAxis.Shift1,macAxis.Shift2,macAxis.Shift3,macAxis.Shift4,macAxis.Shift5" />
......@@ -356,8 +377,8 @@
<switchable_composite switch_values="3"
switcher_key="motorTypeSwitchKey">
<combo role="MacAxis1" property="controlType"
valuesAndLabels="macAxis.controlTypeTORD6030Position,macAxis.controlTypeTORD6060Position" prefix="macAxis.controlTypePrefix"
spaceBefore="false" />
valuesAndLabels="macAxis.controlTypeTORD6030Position,macAxis.controlTypeTORD6060Position"
prefix="macAxis.controlTypePrefix" spaceBefore="false" />
</switchable_composite>
......@@ -545,7 +566,7 @@
<newLine />
<!--pp,dc,piezzo motor type test -->
<!--pp,dc,piezzo motor type test -->
<switchable_composite switch_values="0,1,2"
switcher_key="motorTypeSwitchKey">
......@@ -614,7 +635,7 @@
</group>
</switchable_composite>
<!--usm motor type test -->
<!--usm motor type test -->
<switchable_composite switch_values="3"
switcher_key="motorTypeSwitchKey">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment