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.
>

>
> 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:

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

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.

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

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)