Connecting ports

Hello,

I'm trying to communicate with an EtherCAT stack through ROS.

In the deployer I've got successfully the HelloRobot and the SoemMaster peers running simultaneously.

I read chapter four of the orocos components manual for connecting TaskContexts. http://people.mech.kuleuven.be/~orocos/pub/documentation/rtt/v1.8.x/doc-xml/orocos-components-manual.html#connect-tasks

However I cannot figure out where to put the connectPeers commands.

For a simple start I would like to connect a port from HelloRobot to a data flow port from a slave. For example Slave_1003_values which is an analog output. (EL4038).

Connecting ports

On Friday 17 September 2010 14:35:47 t [dot] t [dot] g [dot] clephas [..] ... wrote:
> Hello,
>
> I'm trying to communicate with an EtherCAT stack through ROS.
>
> In the deployer I've got successfully the HelloRobot and the SoemMaster
> peers running simultaneously.
>
> I read chapter four of the orocos components manual for connecting
> TaskContexts.
> http://people.mech.kuleuven.be/~orocos/pub/documentation/rtt/v1.8.x/doc-xm
> l/orocos-components-manual.html#connect-tasks

This is a completely wrong link. Be sure to read the v2.0 documentation here:

http://www.orocos.org/stable/documentation/rtt/v2.0.x/doc-xml/orocos-
components-manual.html#connect-tasks

>
> However I cannot figure out where to put the connectPeers commands.
>
>
> For a simple start I would like to connect a port from HelloRobot to a data
> flow port from a slave. For example Slave_1003_values which is an analog
> output. (EL4038).

There is a big difference between 'peers' and 'ports'. The former is for task-
browsing, and calling each other's operations, the latter is for data
streaming.

If you want to connect using the XML file format, consult the deployment
component manual here:
http://www.orocos.org/stable/documentation/ocl/v2.0.x/doc-xml/orocos-
deployment.html (See: 'Connecting Data Ports')

Using the taskbrowser, you can connect two ports using the 'connectPorts'
operation. For example :
connectPorts("HelloRobot","DrivePort","SoemMaster","Slave_1003_values")

Peter

Connecting ports

Thanks, this helped a lot.

I've got two peers running with connected ports. One receives messages from a ros topic and sends it through to the other one.

Of course the types of ports must agree. However SoemMaster uses a type: <AnalogMsg>
I can make a port of that type, but I can't figure out what to send to it.

The file I'm trying to run is this one:

&#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;&#10;using namespace RTT;&#10;&#10;class WritePort : public RTT::TaskContext{&#10;private:  &#10;&#10;  soem_beckhoff_drivers::AnalogMsg msg;&#10;  std::vector&lt;double&gt; values;&#10;  OutputPort&lt;soem_beckhoff_drivers::AnalogMsg&gt; values_port;&#10;  &#10;public:&#10;  WritePort(const std::string&amp; name):&#10;    TaskContext(name),&#10;    values_port(&quot;analog_out&quot;)&#10;  {&#10;    ports()-&gt;addPort(values_port);&#10;  }&#10;  ~WritePort(){}&#10;&#10;private:&#10;  void updateHook(){&#10;    values_port.write(????);&#10;  }&#10;};&#10;ORO_CREATE_COMPONENT(WritePort)&#10;

The question is, what can I put in place of the question marks. I can't figure out how the msg variable is build up.

The AnalogMsg.msg says float32[] values but that isn't of much help.
And the port description says "AnalogMsg containing the desired values of _all_ channels"

Thanks in advance,

Tim

Connecting ports

Thanks, this helped a lot.

I've got two peers running with connected ports. One receives messages from a ros topic and sends it through to the other one.

Of course the types of ports must agree. However SoemMaster uses a type: <AnalogMsg> I can make a port of that type, but I can't figure out what to send to it.

The file I'm trying to run is this one:

#include <rtt/TaskContext.hpp>
#include <rtt/Port.hpp>
#include <ocl/Component.hpp>
#include <soem_beckhoff_drivers/AnalogMsg.h>
 
using namespace RTT;
 
class WritePort : public RTT::TaskContext{
private:  
 
  soem_beckhoff_drivers::AnalogMsg msg;
  std::vector<double> values;
  OutputPort<soem_beckhoff_drivers::AnalogMsg> values_port;
 
public:
  WritePort(const std::string& name):
    TaskContext(name),
    values_port("analog_out")
  {
    ports()->addPort(values_port);
  }
  ~WritePort(){}
 
private:
  void updateHook(){
    values_port.write(????);
  }
};
ORO_CREATE_COMPONENT(WritePort)

The question is, what can I put in place of the question marks. I can't figure out how the msg variable is build up.

The AnalogMsg.msg says float32[] values but that isn't of much help. And the port description says "AnalogMsg containing the desired values of _all_ channels"

Thanks in advance,

Tim

Ruben Smits's picture

Connecting ports

On Wednesday 22 September 2010 13:51:49 t [dot] t [dot] g [dot] clephas [..] ... wrote:
> Thanks, this helped a lot.
>
> I've got two peers running with connected ports. One receives messages from
> a ros topic and sends it through to the other one.
>
> Of course the types of ports must agree. However SoemMaster uses a type:
> <AnalogMsg> I can make a port of that type, but I can't figure out what to
> send to it.
>
> The file I'm trying to run is this one:
>
> &#10;&gt; #include &lt;rtt/TaskContext.hpp&gt;&#10;&gt; #include &lt;rtt/Port.hpp&gt;&#10;&gt; #include &lt;ocl/Component.hpp&gt;&#10;&gt; #include &lt;soem_beckhoff_drivers/AnalogMsg.h&gt;&#10;&gt; &#10;&gt; using namespace RTT;&#10;&gt; &#10;&gt; class WritePort : public RTT::TaskContext{&#10;&gt; private:&#10;&gt; &#10;&gt;   soem_beckhoff_drivers::AnalogMsg msg;&#10;&gt;   std::vector&lt;double&gt; values;&#10;&gt;   OutputPort&lt;soem_beckhoff_drivers::AnalogMsg&gt; values_port;&#10;&gt; &#10;&gt; public:&#10;&gt;   WritePort(const std::string&amp; name):&#10;&gt;     TaskContext(name),&#10;&gt;     values_port(&quot;analog_out&quot;)&#10;&gt;   {&#10;&gt;     ports()-&gt;addPort(values_port);&#10;&gt;   }&#10;&gt;   ~WritePort(){}&#10;&gt; &#10;&gt; private:&#10;&gt;   void updateHook(){&#10;&gt;     values_port.write(????);&#10;&gt;   }&#10;&gt; };&#10;&gt; ORO_CREATE_COMPONENT(WritePort)&#10;&gt;
>
>
> The question is, what can I put in place of the question marks. I can't
> figure out how the msg variable is build up.
>

You have to put a AnalogMsg in place of the question marks.
AnalogMsg msg;
msg.values = ...
values_port.write(msg);

> The AnalogMsg.msg says float32[] values but that isn't of much help.
> And the port description says "AnalogMsg containing the desired values of
> _all_ channels"

The size of the float32 array depends on the beckhoff module you are using, some
have 2 channels, others up to 8. If you send a message of the wrong size the
driver will complain or not send the requested values to the slave.

Ruben
> Thanks in advance,
>
> Tim

Awesome,I went wrong on the

Awesome,

I went wrong on the msg.values=...

Everything is up and running now. The EtherCAT stack can be controlled by ROS with a controller in realtime.

I've got two peers communicating by the command:

connectTwoPorts("Controller","volt3_out","SoemMaster","Slave_1003_values")

This means I have to type this command constantly.
I want to connect the ports through the xml file.

&#10;&lt;struct name=&quot;Controller&quot; type=&quot;Controller&quot;&gt;&#10;  &lt;struct name=&quot;Activity&quot; type=&quot;PeriodicActivity&quot;&gt;&#10;    &lt;simple name=&quot;Period&quot; type=&quot;double&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;    &lt;simple name=&quot;Priority&quot; type=&quot;short&quot;&gt;&lt;value&gt;0&lt;/value&gt;&lt;/simple&gt;&#10;    &lt;simple name=&quot;Scheduler&quot; type=&quot;string&quot;&gt;&lt;value&gt;ORO_SCHED_RT&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;/struct&gt;&#10;  &lt;struct name=&quot;Peers&quot; type=&quot;PropertyBag&quot;&gt;&#10;    &lt;simple type=&quot;string&quot;&gt;&lt;value&gt;SoemMaster&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;/struct&gt;&#10;  &lt;struct name=&quot;Ports&quot; type=&quot;PropertyBag&quot;&gt;&#10;    &lt;simple name=&quot;volt3_out&quot; type=&quot;string&quot;&gt;&lt;value&gt;Voltage3&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;/struct&gt;&#10;  &lt;simple name=&quot;AutoConf&quot; type=&quot;boolean&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;simple name=&quot;AutoStart&quot; type=&quot;boolean&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;simple name=&quot;AutoConnect&quot; type=&quot;boolean&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;&lt;/struct&gt;&#10;&#10;&lt;struct name=&quot;SoemMaster&quot; type=&quot;soem_master::SoemMasterComponent&quot;&gt;&#10;  &lt;struct name=&quot;Activity&quot; type=&quot;PeriodicActivity&quot;&gt;&#10;    &lt;simple name=&quot;Period&quot; type=&quot;double&quot;&gt;&lt;value&gt;0.001&lt;/value&gt;&lt;/simple&gt;&#10;    &lt;simple name=&quot;Priority&quot; type=&quot;short&quot;&gt;&lt;value&gt;0&lt;/value&gt;&lt;/simple&gt;&#10;    &lt;simple name=&quot;Scheduler&quot; type=&quot;string&quot;&gt;&lt;value&gt;ORO_SCHED_RT&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;/struct&gt;&#10;  &lt;struct name=&quot;Peers&quot; type=&quot;PropertyBag&quot;&gt;&#10;    &lt;simple type=&quot;string&quot;&gt;&lt;value&gt;Controller&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;/struct&gt;&#10;  &lt;struct name=&quot;Ports&quot; type=&quot;PropertyBag&quot;&gt;&#10;    &lt;simple name=&quot;Slave_1003_values&quot; type=&quot;string&quot;&gt;&lt;value&gt;Voltage3&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;/struct&gt;&#10;  &lt;simple name=&quot;AutoConf&quot; type=&quot;boolean&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;simple name=&quot;AutoStart&quot; type=&quot;boolean&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;simple name=&quot;AutoConnect&quot; type=&quot;boolean&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;&lt;/struct&gt;&#10;

This should work, but SoemMaster doesn't have any ports until it is configured.

So how to configure first, then connect the port?

Thanks,

Awesome,I went wrong on the

Awesome,

I went wrong on the msg.values=...

Everything is up and running now. The EtherCAT stack can be controlled by ROS with a controller in realtime.

I've got two peers communicating by the command:

connectTwoPorts("Controller","volt3_out","SoemMaster","Slave_1003_values")

This means I have to type this command constantly. I want to connect the ports through the xml file.

<struct name="Controller" type="Controller">
  <struct name="Activity" type="PeriodicActivity">
    <simple name="Period" type="double"><value>1</value></simple>
    <simple name="Priority" type="short"><value>0</value></simple>
    <simple name="Scheduler" type="string"><value>ORO_SCHED_RT</value></simple>
  </struct>
  <struct name="Peers" type="PropertyBag">
    <simple type="string"><value>SoemMaster</value></simple>
  </struct>
  <struct name="Ports" type="PropertyBag">
    <simple name="volt3_out" type="string"><value>Voltage3</value></simple>
  </struct>
  <simple name="AutoConf" type="boolean"><value>1</value></simple>
  <simple name="AutoStart" type="boolean"><value>1</value></simple>
  <simple name="AutoConnect" type="boolean"><value>1</value></simple>
</struct>
 
<struct name="SoemMaster" type="soem_master::SoemMasterComponent">
  <struct name="Activity" type="PeriodicActivity">
    <simple name="Period" type="double"><value>0.001</value></simple>
    <simple name="Priority" type="short"><value>0</value></simple>
    <simple name="Scheduler" type="string"><value>ORO_SCHED_RT</value></simple>
  </struct>
  <struct name="Peers" type="PropertyBag">
    <simple type="string"><value>Controller</value></simple>
  </struct>
  <struct name="Ports" type="PropertyBag">
    <simple name="Slave_1003_values" type="string"><value>Voltage3</value></simple>
  </struct>
  <simple name="AutoConf" type="boolean"><value>1</value></simple>
  <simple name="AutoStart" type="boolean"><value>1</value></simple>
  <simple name="AutoConnect" type="boolean"><value>1</value></simple>
</struct>

This should work, but SoemMaster doesn't have any ports until it is configured.

So how to configure first, then connect the port?

Thanks,

Awesome,I went wrong on the

On Thu, Sep 23, 2010 at 4:45 PM, <t [dot] t [dot] g [dot] clephas [..] ...> wrote:
> Awesome,
>
> I went wrong on the msg.values=...
>
> Everything is up and running now. The EtherCAT stack can be controlled by ROS with a controller in realtime.
>
> I've got two peers communicating by the command:
>
> connectTwoPorts("Controller","volt3_out","SoemMaster","Slave_1003_values")
>
> This means I have to type this command constantly.
> I want to connect the ports through the xml file.

...
> This should work, but SoemMaster doesn't have any ports until it is configured.
>
> So how to configure first, then connect the port?

The current system is far from perfect when you deviate from the
common path. What you could do is make 2 xml files,
one wich you use to kickstart the soem master (ie load it and
configure it). Then kickstart the second one which contains the port
connections. Specifying port connections is a hassle right now in XML.
It's verbose and spread around the whole file.

You can also put everything in a .ops script and load that one in the
deployer. As such you don't need to use the XML
format and you have a more readable file. You could keep the XML file
for just describing which components to load
and the program file to configure/connect them. For example:

&#10;   &lt;struct name=&quot;SoemMaster&quot; type=&quot;soem_master::SoemMasterComponent&quot;&gt;&lt;/struct&gt;&#10;   &lt;struct name=&quot;Controller&quot; type=&quot;Controller&quot;&gt;&lt;/struct&gt;&#10;   &lt;struct name=&quot;Deployer&quot;  type=&quot;PropertyBag&quot;&gt;&#10;      &lt;simple name=&quot;ProgramScript&quot; type=&quot;string&quot;&gt;&lt;value&gt;startup.ops&lt;/value&gt;&#10;   &lt;/struct&gt;&#10;

And the program file startup.ops does:
program startup {
SoemMaster.configure()
connectTwoPorts("Controller","volt3_out","SoemMaster","Slave_1003_values")
/// etc...
}

This might be much easier to do than doing the whole thing in XML.
Take note that
you need to start the startup program manually in the TaskBrowser:
startup.start()

Peter

Not working

Somehow this doesn't work for me. The files I'm using:

&#10;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;!DOCTYPE properties SYSTEM &quot;cpf.dtd&quot;&gt;&#10;&lt;properties&gt;&#10;&lt;simple name=&quot;Import&quot; type=&quot;string&quot;&gt;&lt;value&gt;$(find communicate_with_EtherCAT)/lib/orocos&lt;/value&gt;&lt;/simple&gt;&#10;&#10;&lt;struct name=&quot;Controller&quot; type=&quot;Controller&quot;&gt;&#10;  &lt;struct name=&quot;Activity&quot; type=&quot;PeriodicActivity&quot;&gt;&#10;    &lt;simple name=&quot;Period&quot; type=&quot;double&quot;&gt;&lt;value&gt;0.001&lt;/value&gt;&lt;/simple&gt;&#10;    &lt;simple name=&quot;Priority&quot; type=&quot;short&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;    &lt;simple name=&quot;Scheduler&quot; type=&quot;string&quot;&gt;&lt;value&gt;ORO_SCHED_RT&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;/struct&gt;&#10;  &lt;simple name=&quot;AutoConf&quot; type=&quot;boolean&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;&lt;/struct&gt;&#10;&#10;&lt;struct name=&quot;Deployer&quot;  type=&quot;PropertyBag&quot;&gt;&#10;   &lt;simple name=&quot;ProgramScript&quot; type=&quot;string&quot;&gt;&lt;value&gt;startup.ops&lt;/value&gt;&lt;/simple&gt;&#10;&lt;/struct&gt;&#10;&#10;&lt;/properties&gt;&#10;

And:
startup.ops
&#10;program startup {&#10;do Controller.start()&#10;}&#10;

Gives:

&#10;In Task Deployer[S]&#10; (type &#039;ls&#039; for context info) :ls&#10;&#10; Listing TaskContext Deployer :&#10;&#10; Configuration Properties: &#10;     string RTT_COMPONENT_PATH = /home/s050745/ros/kul-ros-pkg/stacks/orocos_toolchain_ros/trunk/rtt/install/lib/orocos&#10;       bool AutoUnload     = true&#10;     string Target         = gnulinux&#10;&#10; Provided Interface:&#10;  Attributes   : &#10;       bool Valid          = true                &#10;        int ORO_SCHED_RT   = 1                   &#10;        int ORO_SCHED_OTHER = 0                   &#10;        int LowestPriority = 1                   &#10;        int HighestPriority = 99                  &#10;&#10;  Operations      : activate addPeer cleanup ... etc ... unloadComponents update &#10;&#10; Data Flow Ports: (none)&#10;&#10; Services: &#10;       scripting ( Orocos Scripting service. Use this service in order to load or query programs or state machines. ) &#10;         startup ( Orocos Program Script ) &#10;&#10; Requires Operations :  (none)&#10; Requests Services   :  (none)&#10; Programs     : startup[S] &#10;&#10; Peers        : Controller[S] &#10;&#10; In Task Deployer[S]&#10; (type &#039;ls&#039; for context info) :startup.start()&#10;      Got :startup.start()&#10; = true                &#10;&#10; In Task Deployer[S]&#10; (type &#039;ls&#039; for context info) :ls&#10;&#10; Listing TaskContext Deployer :&#10;&#10; Configuration Properties: &#10;     string RTT_COMPONENT_PATH = /home/s050745/ros/kul-ros-pkg/stacks/orocos_toolchain_ros/trunk/rtt/install/lib/orocos&#10;       bool AutoUnload     = true&#10;     string Target         = gnulinux&#10;&#10; Provided Interface:&#10;  Attributes   : &#10;       bool Valid          = true                &#10;        int ORO_SCHED_RT   = 1                   &#10;        int ORO_SCHED_OTHER = 0                   &#10;        int LowestPriority = 1                   &#10;        int HighestPriority = 99                  &#10;&#10;  Operations      : activate addPeer cleanup ... unloadComponents update &#10;&#10; Data Flow Ports: (none)&#10;&#10; Services: &#10;       scripting ( Orocos Scripting service. Use this service in order to load or query programs or state machines. ) &#10;         startup ( Orocos Program Script ) &#10;&#10; Requires Operations :  (none)&#10; Requests Services   :  (none)&#10; Programs     : startup[R] &#10;&#10; Peers        : Controller[S] &#10;&#10; In Task Deployer[S]&#10; (type &#039;ls&#039; for context info) :&#10;

So the Controller component still doesn't start by running the startup.ops script.

Any suggestions?

Thanks,

Tim

Not working

Somehow this doesn't work for me. The files I'm using:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "cpf.dtd">
<properties>
<simple name="Import" type="string"><value>$(find communicate_with_EtherCAT)/lib/orocos</value></simple>
 
<struct name="Controller" type="Controller">
  <struct name="Activity" type="PeriodicActivity">
    <simple name="Period" type="double"><value>0.001</value></simple>
    <simple name="Priority" type="short"><value>1</value></simple>
    <simple name="Scheduler" type="string"><value>ORO_SCHED_RT</value></simple>
  </struct>
  <simple name="AutoConf" type="boolean"><value>1</value></simple>
</struct>
 
<struct name="Deployer"  type="PropertyBag">
   <simple name="ProgramScript" type="string"><value>startup.ops</value></simple>
</struct>
 
</properties>

And: startup.ops

program startup {
do Controller.start()
}

Gives:

In Task Deployer[S]
 (type 'ls' for context info) :ls
 
 Listing TaskContext Deployer :
 
 Configuration Properties: 
     string RTT_COMPONENT_PATH = /home/s050745/ros/kul-ros-pkg/stacks/orocos_toolchain_ros/trunk/rtt/install/lib/orocos
       bool AutoUnload     = true
     string Target         = gnulinux
 
 Provided Interface:
  Attributes   : 
       bool Valid          = true                
        int ORO_SCHED_RT   = 1                   
        int ORO_SCHED_OTHER = 0                   
        int LowestPriority = 1                   
        int HighestPriority = 99                  
 
  Operations      : activate addPeer cleanup ... etc ... unloadComponents update 
 
 Data Flow Ports: (none)
 
 Services: 
       scripting ( Orocos Scripting service. Use this service in order to load or query programs or state machines. ) 
         startup ( Orocos Program Script ) 
 
 Requires Operations :  (none)
 Requests Services   :  (none)
 Programs     : startup[S] 
 
 Peers        : Controller[S] 
 
 In Task Deployer[S]
 (type 'ls' for context info) :startup.start()
      Got :startup.start()
 = true                
 
 In Task Deployer[S]
 (type 'ls' for context info) :ls
 
 Listing TaskContext Deployer :
 
 Configuration Properties: 
     string RTT_COMPONENT_PATH = /home/s050745/ros/kul-ros-pkg/stacks/orocos_toolchain_ros/trunk/rtt/install/lib/orocos
       bool AutoUnload     = true
     string Target         = gnulinux
 
 Provided Interface:
  Attributes   : 
       bool Valid          = true                
        int ORO_SCHED_RT   = 1                   
        int ORO_SCHED_OTHER = 0                   
        int LowestPriority = 1                   
        int HighestPriority = 99                  
 
  Operations      : activate addPeer cleanup ... unloadComponents update 
 
 Data Flow Ports: (none)
 
 Services: 
       scripting ( Orocos Scripting service. Use this service in order to load or query programs or state machines. ) 
         startup ( Orocos Program Script ) 
 
 Requires Operations :  (none)
 Requests Services   :  (none)
 Programs     : startup[R] 
 
 Peers        : Controller[S] 
 
 In Task Deployer[S]
 (type 'ls' for context info) :

So the Controller component still doesn't start by running the startup.ops script.

Any suggestions?

Thanks,

Tim

Not working

On Tuesday 28 September 2010 13:35:17 t [dot] t [dot] g [dot] clephas [..] ... wrote:
> Somehow this doesn't work for me. The files I'm using:
>
> &#10;&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&gt; &lt;!DOCTYPE properties SYSTEM &quot;cpf.dtd&quot;&gt;&#10;&gt; &lt;properties&gt;&#10;&gt; &lt;simple name=&quot;Import&quot; type=&quot;string&quot;&gt;&lt;value&gt;$(find&#10;&gt; communicate_with_EtherCAT)/lib/orocos&lt;/value&gt;&lt;/simple&gt;&#10;&gt; &#10;&gt; &lt;struct name=&quot;Controller&quot; type=&quot;Controller&quot;&gt;&#10;&gt;   &lt;struct name=&quot;Activity&quot; type=&quot;PeriodicActivity&quot;&gt;&#10;&gt;     &lt;simple name=&quot;Period&quot; type=&quot;double&quot;&gt;&lt;value&gt;0.001&lt;/value&gt;&lt;/simple&gt;&#10;&gt;     &lt;simple name=&quot;Priority&quot; type=&quot;short&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;&gt;     &lt;simple name=&quot;Scheduler&quot;&#10;&gt; type=&quot;string&quot;&gt;&lt;value&gt;ORO_SCHED_RT&lt;/value&gt;&lt;/simple&gt; &lt;/struct&gt;&#10;&gt;   &lt;simple name=&quot;AutoConf&quot; type=&quot;boolean&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/simple&gt;&#10;&gt; &lt;/struct&gt;&#10;&gt; &#10;&gt; &lt;struct name=&quot;Deployer&quot;  type=&quot;PropertyBag&quot;&gt;&#10;&gt;    &lt;simple name=&quot;ProgramScript&quot;&#10;&gt; type=&quot;string&quot;&gt;&lt;value&gt;startup.ops&lt;/value&gt;&lt;/simple&gt; &lt;/struct&gt;&#10;&gt; &#10;&gt; &lt;/properties&gt;&#10;&gt;
>
> And:
> startup.ops
> &#10;&gt; program startup {&#10;&gt; do Controller.start()&#10;&gt; }&#10;&gt;
>
> Gives:
>
> &#10;&gt; In Task Deployer[S]&#10;&gt;  (type &#039;ls&#039; for context info) :ls&#10;&gt; &#10;&gt;  Listing TaskContext Deployer :&#10;&gt; &#10;&gt;  Configuration Properties:&#10;&gt;      string RTT_COMPONENT_PATH =&#10;&gt; /home/s050745/ros/kul-ros-pkg/stacks/orocos_toolchain_ros/trunk/rtt/instal&#10;&gt; l/lib/orocos bool AutoUnload     = true&#10;&gt;      string Target         = gnulinux&#10;&gt; &#10;&gt;  Provided Interface:&#10;&gt;   Attributes   :&#10;&gt;        bool Valid          = true&#10;&gt;         int ORO_SCHED_RT   = 1&#10;&gt;         int ORO_SCHED_OTHER = 0&#10;&gt;         int LowestPriority = 1&#10;&gt;         int HighestPriority = 99&#10;&gt; &#10;&gt;   Operations      : activate addPeer cleanup ... etc ... unloadComponents&#10;&gt; update&#10;&gt; &#10;&gt;  Data Flow Ports: (none)&#10;&gt; &#10;&gt;  Services:&#10;&gt;        scripting ( Orocos Scripting service. Use this service in order to&#10;&gt; load or query programs or state machines. ) startup ( Orocos Program&#10;&gt; Script )&#10;&gt; &#10;&gt;  Requires Operations :  (none)&#10;&gt;  Requests Services   :  (none)&#10;&gt;  Programs     : startup[S]&#10;&gt; &#10;&gt;  Peers        : Controller[S]&#10;&gt; &#10;&gt;  In Task Deployer[S]&#10;&gt;  (type &#039;ls&#039; for context info) :startup.start()&#10;&gt;       Got :startup.start()&#10;&gt;  = true&#10;&gt; &#10;&gt;  In Task Deployer[S]&#10;&gt;  (type &#039;ls&#039; for context info) :ls&#10;&gt; &#10;&gt;  Listing TaskContext Deployer :&#10;&gt; &#10;&gt;  Configuration Properties:&#10;&gt;      string RTT_COMPONENT_PATH =&#10;&gt; /home/s050745/ros/kul-ros-pkg/stacks/orocos_toolchain_ros/trunk/rtt/instal&#10;&gt; l/lib/orocos bool AutoUnload     = true&#10;&gt;      string Target         = gnulinux&#10;&gt; &#10;&gt;  Provided Interface:&#10;&gt;   Attributes   :&#10;&gt;        bool Valid          = true&#10;&gt;         int ORO_SCHED_RT   = 1&#10;&gt;         int ORO_SCHED_OTHER = 0&#10;&gt;         int LowestPriority = 1&#10;&gt;         int HighestPriority = 99&#10;&gt; &#10;&gt;   Operations      : activate addPeer cleanup ... unloadComponents update&#10;&gt; &#10;&gt;  Data Flow Ports: (none)&#10;&gt; &#10;&gt;  Services:&#10;&gt;        scripting ( Orocos Scripting service. Use this service in order to&#10;&gt; load or query programs or state machines. ) startup ( Orocos Program&#10;&gt; Script )&#10;&gt; &#10;&gt;  Requires Operations :  (none)&#10;&gt;  Requests Services   :  (none)&#10;&gt;  Programs     : startup[R]&#10;&gt; &#10;&gt;  Peers        : Controller[S]&#10;&gt; &#10;&gt;  In Task Deployer[S]&#10;&gt;  (type &#039;ls&#039; for context info) :&#10;&gt;
>
> So the Controller component still doesn't start by running the startup.ops
> script.
>
> Any suggestions?

In order to see what your program is doing, you can type 'list startup' in the
TaskBrowser. Since 'startup' is still in the 'Running' state ([R], it looks
like the start() operation blocks. I'll try to reproduce it here.

Peter

Not working

On Thursday 30 September 2010 13:49:24 Peter Soetens wrote:
> On Tuesday 28 September 2010 13:35:17 t [dot] t [dot] g [dot] clephas [..] ... wrote:
> > Somehow this doesn't work for me. The files I'm using:
> >
...
> >
> > So the Controller component still doesn't start by running the
> > startup.ops script.

I can confirm this... looking at it.

Peter

Not working

On Thursday 30 September 2010 14:01:54 Peter Soetens wrote:
> On Thursday 30 September 2010 13:49:24 Peter Soetens wrote:
> > On Tuesday 28 September 2010 13:35:17 t [dot] t [dot] g [dot] clephas [..] ... wrote:
> > > Somehow this doesn't work for me. The files I'm using:
> ...
>
> > > So the Controller component still doesn't start by running the
> > > startup.ops script.
>
> I can confirm this... looking at it.

Oh darn ! It's your deployer not having a period. We should probably print a
warning when loading scripts in such components...

Try this XML file:

code>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "cpf.dtd">
<properties>
<simple name="Import" type="string"><value>$(find
communicate_with_EtherCAT)/lib/orocos</value></simple>

<struct name="Controller" type="Controller">
<struct name="Activity" type="PeriodicActivity">
<simple name="Period" type="double"><value>0.001</value></simple>
<simple name="Priority" type="short"><value>1</value></simple>
<simple name="Scheduler"
type="string"><value>ORO_SCHED_RT</value></simple>
</struct>
<simple name="AutoConf" type="boolean"><value>1</value></simple>
</struct>

<struct name="Deployer" type="PropertyBag">
<simple name="ProgramScript"
type="string"><value>startup.ops</value></simple>
<struct name="Activity" type="Activity">
<simple name="Period" type="double"><value>0.1</value></simple>
<simple name="Priority" type="short"><value>0</value></simple>
<simple name="Scheduler"
type="string"><value>ORO_SCHED_OTHER</value></simple>
</struct>
</struct>

</properties>
</code>

Alternatively, you can just call 'setPeriod(0.1)' at the deployer's prompt in
your current configuration...

Peter

PS: 'PeriodicActivity' should only be used in special cases. Please use the
flexible 'Activity' in most cases.

Awesome,I went wrong on

Apparently I'm deviating from the common path.

This makes me wonder what the common path is. I'm trying to control a motor through an EtherCAT stack. And a ROS node generates the reference path.

So the way I have done it now: One component reads the reference value from a ros topic. A controller is implemented in C++ code to run with UpdateHook().

These resulting value (voltage in this case) is send through a port to the SoemMaster which communicates it to the EtherCAT stack.

This seemed logical to me, but if there's a more common path to do this, I'm curious to learn :)

Awesome,I went wrong on the

Apparently I'm deviating from the common path.

This makes me wonder what the common path is. I'm trying to control a motor through an EtherCAT stack. And a ROS node generates the reference path.

So the way I have done it now: One component reads the reference value from a ros topic. A controller is implemented in C++ code to run with UpdateHook().

These resulting value (voltage in this case) is send through a port to the SoemMaster which communicates it to the EtherCAT stack.

This seemed logical to me, but if there's a more common path to do this, I'm curious to learn :)

Awesome,I went wrong on

On Mon, 27 Sep 2010, t [dot] t [dot] g [dot] clephas [..] ... wrote:

> Apparently I'm deviating from the common path.
>
> This makes me wonder what the common path is. I'm trying to control a motor through an EtherCAT stack. And a ROS node generates the reference path.
>
> So the way I have done it now: One component reads the reference value from a ros topic. A controller is implemented in C++ code to run with UpdateHook().
>
> These resulting value (voltage in this case) is send through a port to the SoemMaster which communicates it to the EtherCAT stack.
>
> This seemed logical to me, but if there's a more common path to do this, I'm curious to learn :)

This approach sounds normal and decent :-)

You _could_ opt for another architecture:
- the Orocos component is also doing the trajectory generation (because
this is simpler to keep in sync with the controller)
- in a first state of the Orocos component, you initialize the trajectory
generation, if needed
- after that, you call the update function for the trajectory generator
(maybe not every sample period of the controller, but only once every ten
times or so).
- you do your control as in your suggestion.

Herman

Connecting ports

Hello,

I'm trying to communicate with an EtherCAT stack through ROS.

In the deployer I've got successfully the HelloRobot and the SoemMaster peers running simultaneously.

I read chapter four of the orocos components manual for connecting TaskContexts.
http://people.mech.kuleuven.be/~orocos/pub/documentation/rtt/v1.8.x/doc-...

However I cannot figure out where to put the connectPeers commands.

For a simple start I would like to connect a port from HelloRobot to a data flow port from a slave. For example Slave_1003_values which is an analog output. (EL4038).