Sending digital message to SoemMaster

Hello everybody,

I've created the following program which connects to an etherCAT stack. The ports are connected to the SoemMaster component.

When I run this code, the analog output does send out an output voltage of 5 volt. However the digital out does not enable the first port.

I can manually enable them by typing SoemMaster.Slave_100b.switchOn(0) in the deployer.

Thanks in advance for your help!

#include <rtt/TaskContext.hpp>
#include <rtt/Port.hpp>
#include <ocl/Component.hpp>
#include <soem_beckhoff_drivers/AnalogMsg.h>
#include <soem_beckhoff_drivers/DigitalMsg.h>
 
using namespace RTT;
using namespace soem_beckhoff_drivers;
using namespace std;
 
class TestProgram 
  : public RTT::TaskContext
{
  private:  
 
  OutputPort<AnalogMsg> analog_out_port;
  OutputPort<DigitalMsg> digital_out_port;
 
  AnalogMsg amsg;
  DigitalMsg dmsg;
 
  std::vector< float, std::allocator<float> > analogvalues; 
  std::vector< uint8_t, std::allocator<uint8_t> > digitalvalues; 
 
  public:
 
  TestProgram(const std::string& name)
      : TaskContext(name),
    //Naming the _ports and variables
    analog_out_port("analog_out"),
    digital_out_port("digital_out")
    {
      addPort(analog_out_port);
      addPort(digital_out_port);
 
      analogvalues.assign(8,0.0);
      digitalvalues.assign(8,0.0);
    }
 
  ~TestProgram(){}
 
  private:
 
  bool startHook()
  {
        // Writing an analog msg, thirth output becomes 5V.
    analogvalues[3] = 5.0;
    amsg.values = analogvalues;
    analog_out_port.write(amsg);
 
 
    // Writing a digital msg to enable the first digital out.
    digitalvalues[1] = 1;
    dmsg.values = digitalvalues;
    digital_out_port.write(dmsg);
 
    return true;
  }
};    
ORO_CREATE_COMPONENT(TestProgram)

Sending digital message to SoemMaster

On Monday 06 December 2010 13:03:42 t [dot] t [dot] g [dot] clephas [..] ... wrote:
> Hello everybody,
>
> I've created the following program which connects to an etherCAT stack. The
> ports are connected to the SoemMaster component.
>
> When I run this code, the analog output does send out an output voltage of
> 5 volt. However the digital out does not enable the first port.
> <!--break-->
>
> I can manually enable them by typing SoemMaster.Slave_100b.switchOn(0) in
> the deployer.

Just to exclude the obvious: you *are* sending the output to the correct
digital channel, aren't you ? The code below sets the second channel:
digitalvalues[1] = 1;

Peter

Sending digital message to SoemMaster

The code in startup.ops is:
&#10;program startup {&#10;SoemMaster.ifname=&quot;eth1&quot;&#10;SoemMaster.configure()&#10;&#10;connectTwoPorts(&quot;TestProgram&quot;,&quot;analog_out&quot;,&quot;SoemMaster&quot;,&quot;Slave_100d_values&quot;)&#10;connectTwoPorts(&quot;TestProgram&quot;,&quot;digital_out&quot;,&quot;SoemMaster&quot;,&quot;Slave_100b_bits&quot;)&#10;}&#10;
and with SoemMaster.Slave_100b.switchOn(0) it works.
So yes, the output is send to the correct digital channel.

The total package can be found in:
https://amigo.wtb.tue.nl/svn/amigo/dev/Tim/orocos_test_package/

Thanks,

Tim

RE: Sending digital message to SoemMaster

The code in startup.ops is:

program startup {
SoemMaster.ifname="eth1"
SoemMaster.configure()
 
connectTwoPorts("TestProgram","analog_out","SoemMaster","Slave_100d_values")
connectTwoPorts("TestProgram","digital_out","SoemMaster","Slave_100b_bits")
}
 and with SoemMaster.Slave_100b.switchOn(0) it works.
So yes, the output is send to the correct digital channel.

The total package can be found in: https://amigo.wtb.tue.nl/svn/amigo/dev/Tim/orocos_test_package/

Thanks,

Tim

Sending digital message to SoemMaster

Hello everybody,

I've created the following program which connects to an etherCAT stack. The ports are connected to the SoemMaster component.

When I run this code, the analog output does send out an output voltage of 5 volt. However the digital out does not enable the first port.
<!--break-->

I can manually enable them by typing SoemMaster.Slave_100b.switchOn(0) in the deployer.

Thanks in advance for your help!

&#10;#include &lt;rtt/TaskContext.hpp&gt;&#10;#include &lt;rtt/Port.hpp&gt;&#10;#include &lt;ocl/Component.hpp&gt;&#10;#include &lt;soem_beckhoff_drivers/AnalogMsg.h&gt;&#10;#include &lt;soem_beckhoff_drivers/DigitalMsg.h&gt;&#10;&#10;using namespace RTT;&#10;using namespace soem_beckhoff_drivers;&#10;using namespace std;&#10;&#10;class TestProgram &#10;  : public RTT::TaskContext&#10;{&#10;  private:  &#10;&#10;  OutputPort&lt;AnalogMsg&gt; analog_out_port;&#10;  OutputPort&lt;DigitalMsg&gt; digital_out_port;&#10;  &#10;  AnalogMsg amsg;&#10;  DigitalMsg dmsg;&#10;&#10;  std::vector&lt; float, std::allocator&lt;float&gt; &gt; analogvalues; &#10;  std::vector&lt; uint8_t, std::allocator&lt;uint8_t&gt; &gt; digitalvalues; &#10;  &#10;  public:&#10;  &#10;  TestProgram(const std::string&amp; name)&#10;      : TaskContext(name),&#10;    //Naming the _ports and variables&#10;    analog_out_port(&quot;analog_out&quot;),&#10;    digital_out_port(&quot;digital_out&quot;)&#10;    {&#10;      addPort(analog_out_port);&#10;      addPort(digital_out_port);&#10;      &#10;      analogvalues.assign(8,0.0);&#10;      digitalvalues.assign(8,0.0);&#10;    }&#10;&#10;  ~TestProgram(){}&#10;  &#10;  private:&#10;  &#10;  bool startHook()&#10;  {&#10;        // Writing an analog msg, thirth output becomes 5V.&#10;    analogvalues[3] = 5.0;&#10;    amsg.values = analogvalues;&#10;    analog_out_port.write(amsg);&#10;    &#10;    &#10;    // Writing a digital msg to enable the first digital out.&#10;    digitalvalues[1] = 1;&#10;    dmsg.values = digitalvalues;&#10;    digital_out_port.write(dmsg);&#10;    &#10;    return true;&#10;  }&#10;};    &#10;ORO_CREATE_COMPONENT(TestProgram)&#10;

Sending digital message to SoemMaster

Hello everybody,

I've created the following program which connects to an etherCAT stack. The ports are connected to the SoemMaster component.

When I run this code, the analog output does send out an output voltage of 5 volt. However the digital out does not enable the first port.
<!--break-->

I can manually enable them by typing SoemMaster.Slave_100b.switchOn(0) in the deployer.

Thanks in advance for your help!

&#10;#include &lt;rtt/TaskContext.hpp&gt;&#10;#include &lt;rtt/Port.hpp&gt;&#10;#include &lt;ocl/Component.hpp&gt;&#10;#include &lt;soem_beckhoff_drivers/AnalogMsg.h&gt;&#10;#include &lt;soem_beckhoff_drivers/DigitalMsg.h&gt;&#10;&#10;using namespace RTT;&#10;using namespace soem_beckhoff_drivers;&#10;using namespace std;&#10;&#10;class TestProgram &#10;  : public RTT::TaskContext&#10;{&#10;  private:  &#10;&#10;  OutputPort&lt;AnalogMsg&gt; analog_out_port;&#10;  OutputPort&lt;DigitalMsg&gt; digital_out_port;&#10;  &#10;  AnalogMsg amsg;&#10;  DigitalMsg dmsg;&#10;&#10;  std::vector&lt; float, std::allocator&lt;float&gt; &gt; analogvalues; &#10;  std::vector&lt; uint8_t, std::allocator&lt;uint8_t&gt; &gt; digitalvalues; &#10;  &#10;  public:&#10;  &#10;  TestProgram(const std::string&amp; name)&#10;      : TaskContext(name),&#10;    //Naming the _ports and variables&#10;    analog_out_port(&quot;analog_out&quot;),&#10;    digital_out_port(&quot;digital_out&quot;)&#10;    {&#10;      addPort(analog_out_port);&#10;      addPort(digital_out_port);&#10;      &#10;      analogvalues.assign(8,0.0);&#10;      digitalvalues.assign(8,0.0);&#10;    }&#10;&#10;  ~TestProgram(){}&#10;  &#10;  private:&#10;  &#10;  bool startHook()&#10;  {&#10;        // Writing an analog msg, thirth output becomes 5V.&#10;    analogvalues[3] = 5.0;&#10;    amsg.values = analogvalues;&#10;    analog_out_port.write(amsg);&#10;    &#10;    &#10;    // Writing a digital msg to enable the first digital out.&#10;    digitalvalues[1] = 1;&#10;    dmsg.values = digitalvalues;&#10;    digital_out_port.write(dmsg);&#10;    &#10;    return true;&#10;  }&#10;};    &#10;ORO_CREATE_COMPONENT(TestProgram)&#10;