Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Movement commands through 4diac(4diac, ros integration, movement commands)
Movement commands through 4diac [message #1770386] Thu, 10 August 2017 15:48 Go to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
Hello, I am new to 4diac. I am trying to use function blocks to create a ros program, that will give movement commands to a robot. I have found this presentation
https://eclipse.org/4diac/uws/2016/UW_05_Eisenmenger.pdf
that helps a bit, to understand the integration, but I can't find more details anywhere. Can anyone help me?
  • Attachment: fgdfg.png
    (Size: 114.87KB, Downloaded 234 times)
Re: Movement commands through 4diac [message #1770431 is a reply to message #1770386] Fri, 11 August 2017 09:14 Go to previous messageGo to next message
Waldemar Eisenmenger is currently offline Waldemar EisenmengerFriend
Messages: 4
Registered: February 2016
Junior Member
Hi Sofia

there is a ros branch in the git forte repository. The code for the function blocks you will find in /src/modules/ros directory. To establish communication between forte and ros you have three possibilities. You could use a topic communication which is the simpliest way. Therefor you just need the standard publish and/or subscribe function blocks and set the ID as it is described in the example which you have attached to your post. The other two ways of communication are the "services" and "actions". Here you would need to develop an own function block for each ros data type. in the git repository you can find some examples.

I hope this helps you.

Best regards,

Waldemar
Re: Movement commands through 4diac [message #1770677 is a reply to message #1770431] Wed, 16 August 2017 08:08 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Hi Sofia,

I'm currently working on the documentation about 4diac's ROS communication interface.

The slide you mentioned shows the ROS datatypes that are currently supported by 4diac and the appropriate mapping to a IEC61499 (4diac) datatype.

Would you need other datatypes for your use case?

Best regards,
Ben
Re: Movement commands through 4diac [message #1771035 is a reply to message #1770677] Mon, 21 August 2017 11:59 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
No Message Body
Re: Movement commands through 4diac [message #1771036 is a reply to message #1771035] Mon, 21 August 2017 12:01 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
No, data types are adequate.
Re: Movement commands through 4diac [message #1772165 is a reply to message #1771036] Wed, 06 September 2017 08:53 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
The documentation for 4diac's ROS interface has been updated :-)

Have a look at http://www.eclipse.org/4diac/en_help.php under "Using Communication Protocols/ROS".

Cheers,
Ben
Re: Movement commands through 4diac [message #1773262 is a reply to message #1772165] Mon, 25 September 2017 18:44 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
Great news, thanks!!
Re: Movement commands through 4diac [message #1773263 is a reply to message #1773262] Mon, 25 September 2017 18:44 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
No Message Body

[Updated on: Thu, 28 September 2017 20:41]

Report message to a moderator

Re: Movement commands through 4diac [message #1773862 is a reply to message #1773263] Thu, 05 October 2017 14:04 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
How should my system configuration be like?
Re: Movement commands through 4diac [message #1773911 is a reply to message #1773862] Fri, 06 October 2017 12:22 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
I am sorry to bother you, I have a deadline coming up and can't figure this out. I have attached a picture of my App and my system configurations. What I get when I launch Forte is one error <Response ID="3" Reason="UNSUPPORTED_TYPE"/> and multiple errors <Response ID="4" Reason="NO_SUCH_OBJECT">. Of course, my model in Gazebo does not move. I have compiled the package "org.eclipse.4diac.forte-ros.zip", because, according to the instructions of "ROS with IEC 61499 Tutorial", the command "git checkout ros" does not work. I hope, it gives the same result.
Re: Movement commands through 4diac [message #1774114 is a reply to message #1773911] Tue, 10 October 2017 17:13 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Hi Sofia,

I just tried whether the commands specified in the 4diac help work and unfortunately I missed some small details.. (the directory from which the different commands need to be invoked)
The following instruction list should build forte with ROS communication support:

$ git clone git://git.eclipse.org/gitroot/4diac/org.eclipse.4diac.forte.git

"git checkout" works if you change the directory to the root of the repository after cloning, like follows:
$ cd org.eclipse.4diac.forte
then
$ git checkout ros

After that you can set the appropriate CMake variables like follows:
$ chmod +x setup_posix.sh
$ ./setup_posix.sh
$ cd bin/posix/
$ cmake-gui // or via command line with your favorite text editor e.g.
$ nano CMakeCache.txt

The variables you need to change are:
CMAKE_BUILD_TYPE=Debug
FORTE_MODULE_ROS=On
FORTE_COM_ROS=On
FORTE_RTTI_AND_EXCEPTIONS=TRUE

Build forte with: (these have to be invoked from the org.eclipse.4diac.forte/bin/posix folder)
$ cmake ../..
$ make

You can find the built forte in the org.eclipse.4diac.forte/bin/posix/src folder.

The unsupported_type error usually shows that the function blocks you want to deploy are not compiled with your current forte executable. So you need to make sure that you enabled the correct modules in CMAKE and compiled the FBs.

Cheers,
Ben
Re: Movement commands through 4diac [message #1774133 is a reply to message #1774114] Tue, 10 October 2017 21:03 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
Thank you for your reply. I tried what you proposed, but I get the same errors. Another thing that goes wrong during the installation (which did happen before) is that when I try to $ ./setup_posix.sh, I get an error " set_property could not find CACHE variable FORTE_LOGLEVEL. Perhaps it has not yet been created.". So I changed the CMakeLists.txt and define the variable as NOLOG. Could that mess up my forte build?

Re: Movement commands through 4diac [message #1774162 is a reply to message #1774133] Wed, 11 October 2017 07:44 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Hi,

you can not deploy the IN_ANY FB to forte, because it is an FBRT based FB and has no implementation in forte. You could use FBRT to the deploy the IN_ANY FB and send the input that you get from the HMI to forte via a publish/subscribe connection.

Which CMakeLists did you change? I would recommend setting the FORTE_LOGLEVEL to LOGINFO or LOGDEBUG otherwise you won't see any errors during runtime.

Best,
Ben
Re: Movement commands through 4diac [message #1774175 is a reply to message #1774162] Wed, 11 October 2017 10:00 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
I changed the CMakeLists that is in the main folder "org.eclipse.4diac.forte". Now that I change the variables directly in the CMakeCache.txt, I get "warning: variadic templates only available with -std=c++11 or -std=gnu++11 [enabled by default]" in every Cpp object I build. And when I run Forte I get :
WARNING: T#01001ms: Boot file forte.fboot could not be opened
INFO: T#01001ms: CBSDSocketInterface: Opening TCP-Server connection at: localhost:61499
ERROR: T#01001ms: CBSDSocketInterface: bind() failed: Address already in use
INFO: T#02000ms: FORTE is up and running

but the X+3 example works. You are so right about IN_ANY FB. How did I miss that? I will change my application. Thank you
Re: Movement commands through 4diac [message #1774209 is a reply to message #1774175] Wed, 11 October 2017 17:31 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Hi,

Good news ;-) The console output of forte looks as expected!

Are the Publishers and Subscribers to ROS working?

Cheers,
Ben

[Updated on: Wed, 11 October 2017 17:34]

Report message to a moderator

Re: Movement commands through 4diac [message #1774215 is a reply to message #1774209] Wed, 11 October 2017 18:46 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
Not wet, I did some changes but I might be doing something wrong. I didn't have time to experiment with the application. I even tried to do a very simple one just by passing a value to a publish_1 fb but I can't find a fb that passes a specific value, as output data. Here is what my app looks for now.
  • Attachment: FBRT.png
    (Size: 156.91KB, Downloaded 250 times)
  • Attachment: Application.png
    (Size: 171.01KB, Downloaded 302 times)
  • Attachment: FORTE.png
    (Size: 167.93KB, Downloaded 187 times)
Re: Movement commands through 4diac [message #1774227 is a reply to message #1774215] Wed, 11 October 2017 20:12 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

have you tried to use 4diac's monitoring feature to see the interface values? If you get the bind error messages as shown in above it means that there is already a forte running. Here it would be good to check that no other forte instance is running in the background.
Re: Movement commands through 4diac [message #1774263 is a reply to message #1774227] Thu, 12 October 2017 11:03 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
I had to change "localhost" and "ros" to myIP:something. Now The publish function block gets the LREAL number I want to pass as "std_msgs/Float64", but QO is False, and STATUS is NO_SOCKET. I am running both programs at the same computer.

[Updated on: Thu, 12 October 2017 11:04]

Report message to a moderator

Re: Movement commands through 4diac [message #1774264 is a reply to message #1774263] Thu, 12 October 2017 11:05 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Could you provide your exact ID data input?
Re: Movement commands through 4diac [message #1774276 is a reply to message #1774264] Thu, 12 October 2017 12:22 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
ID: 127.0.0.1:11311[armbot/joint1_position_controller/command:std_msgs/Float64]
The Console output looks like this:
WARNING: T#0999ms: Boot file forte.fboot could not be opened
INFO: T#0999ms: CBSDSocketInterface: Opening TCP-Server connection at: localhost:61499
INFO: T#01999ms: FORTE is up and running
INFO: T#05600ms: CBSDSocketInterface: Opening UDP receiving connection at: 127.0.0.1:61500
INFO: T#06585ms: Connection closed by peer
Re: Movement commands through 4diac [message #1774278 is a reply to message #1774276] Thu, 12 October 2017 12:28 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Your ID should look like follows:

ros[armbot/joint1_position_controller/command:std_msgs/Float64]


according to

ros[topic_name:message_name]


You dont need to specify ip and port, as they will be automatically mapped by the ROS master.
Re: Movement commands through 4diac [message #1774280 is a reply to message #1774278] Thu, 12 October 2017 12:58 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
If I don't, I get an error at the console output "Couldn't find an AF_INET address for []". Does this mean that, it can't find "armbot/joint1_position_controller/command:std_msgs/Float64"? I can send commands to that topic with rostopic.

[Updated on: Thu, 12 October 2017 13:02]

Report message to a moderator

Re: Movement commands through 4diac [message #1774312 is a reply to message #1774280] Thu, 12 October 2017 15:01 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Hmm..

Not sure, but you could try this:
https://answers.ros.org/question/227410/couldnt-find-an-af_inet-address-for-hostname/
https://answers.ros.org/question/163556/how-to-solve-couldnt-find-an-af_inet-address-for-problem/

Does this help?
Re: Movement commands through 4diac [message #1774328 is a reply to message #1774312] Thu, 12 October 2017 21:01 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
No, I tried the solution proposed but none of it worked. The whole console message is:
INFO: T#09612ms: CBSDSocketInterface: Opening UDP receiving connection at: 127.0.0.1:61500
[FATAL] [1507828778.013953527]: You must call ros::init() before creating the first NodeHandle
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
[ERROR] [1507828778.073570955]: [registerPublisher] Failed to contact master at [:0]. Retrying...
Couldn't find an AF_INET address for []
.
.
.
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
INFO: T#010603ms: Connection closed by peer
Couldn't find an AF_INET address for []
.
.
.
Re: Movement commands through 4diac [message #1774760 is a reply to message #1774328] Thu, 19 October 2017 11:53 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
This is a bug. Try the following as a work around. An official fix will follow.

Please change forte's main.cpp (org.eclipse.4diac.forte/src/arch/posix/main.cpp) file as follows:
add ROS includes:
...
#include <ros/ros.h>
...


and change the main function (line 79) to:

int main(int argc, char *arg[]){
  checkEndianess();
  if(argc <= 1){ //! Default Value (localhost:61499)
    std::string rosdistro = "indigo";
    if (rosdistro == (std::string)std::getenv("ROS_DISTRO")){
      DEVLOG_INFO("path to forte.exe: %s \n", arg[0]);
      ros::init(argc, arg, "ROS_Functionblocks_in_FORTE");
    }
    createDev("localhost:61499");
  }
...


This worked for me. Could you test it in your environment?

Cheers,
Ben
Re: Movement commands through 4diac [message #1774846 is a reply to message #1774760] Fri, 20 October 2017 13:35 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
This is giving me a headache... So I tried to do exactly as you described, but that changed nothing. Then I tried to change the main() like this
int main(int argc, char *arg[]){
  checkEndianess();
 std::string rosdistro = "indigo";
    if (rosdistro == (std::string)std::getenv("ROS_DISTRO")){
      DEVLOG_INFO("path to forte.exe: %s \n", arg[0]);
      ros::init(argc, arg, "ROS_Functionblocks_in_FORTE");
    }
  if(argc <= 1){ //! Default Value (localhost:61499)
   
    createDev("localhost:61499");
  }

but i got an error
"terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct null not valid"
and then I tried to just skip the if statement, because I really have ros indigo installed, but I got this error
"INFO: T#notime: path to forte.exe: /home/sofia/org.eclipse.4diac.forte/bin/posix/src/forte
 [1508502037.873067018]: ROS_MASTER_URI is not defined in the environment. Either type the following or (preferrably) add this to your ~/.bashrc file in order set up your local machine as a ROS master:

export ROS_MASTER_URI=http://localhost:11311

then, type 'roscore' in another shell to actually launch the master program."
even though I have edited my ~/.bashrc file, as I should have.
So now, after I red every similar error that was ever posted on the internet, I will try to install ros, gazebo etc to another computer to see if there is something wrong with my installation. Thank you for your help.
Re: Movement commands through 4diac [message #1775036 is a reply to message #1774846] Mon, 23 October 2017 21:26 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
I did a full format on my pc, installed every package I could remember, my ros model is moving on Gazebo simulation. 4diac is ok, but I can't build forte. I get the error
"reapp_msgs/ExecuteAction.h: No such file or directory"
Did I forget to install something?

EDIT: I had forgotten to install ros-indigo-reapp-msgs

[Updated on: Tue, 24 October 2017 08:23]

Report message to a moderator

Re: Movement commands through 4diac [message #1775151 is a reply to message #1775036] Wed, 25 October 2017 12:21 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Hi,

sounds good!

dont hesitate to ask if there are further questions.

Cheers,
Ben
Re: Movement commands through 4diac [message #1775156 is a reply to message #1775151] Wed, 25 October 2017 13:28 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
Well... I am getting the exact same errors.... If I send you my robot packages, could you run a gazebo simulation on your pc and see if you can publish at the ros topics?

[Updated on: Wed, 25 October 2017 13:30]

Report message to a moderator

Re: Movement commands through 4diac [message #1775159 is a reply to message #1775156] Wed, 25 October 2017 13:47 Go to previous messageGo to next message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Hi,

you might be able to solve this issue
Quote:
31m [1508502037.873067018]: ROS_MASTER_URI is not defined in the environment. Either type the following or (preferrably) add this to your ~/.bashrc file in order set up your local machine as a ROS master ...

by sourcing your ROS workspace.

Can you show me your .bashrc file?

What does
$ echo $ROS_MASTER_URI

show?

You can also remove the "ifs" that check the ROS distro and the OS version in forte's main.

Regards,
Ben

[Updated on: Wed, 25 October 2017 13:57]

Report message to a moderator

Re: Movement commands through 4diac [message #1775162 is a reply to message #1775159] Wed, 25 October 2017 14:45 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
$ echo $ROS_MASTER_URI gives "http://localhost:11311". I am sourcing workspace in the ~/.bashrc file. The only thing I changed to main.cpp was to add
"ros::init(argc, arg, "ROS_Functionblocks_in_FORTE");" right after "checkEndianess();"
I started a topic at Ros forum.
https://answers.ros.org/question/274044/ros_master_uri-set-but-program-gives-related-error/
but no lack so far.
Re: Movement commands through 4diac [message #1775205 is a reply to message #1775162] Thu, 26 October 2017 09:31 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
Hello, I added the following code in main()
 char const* masteruri = getenv("ROS_MASTER_URI");
if (masteruri!=NULL){
    printf ("The current masteruri is: %s",masteruri);
}
  char const* rosdis = getenv("ROS_DISTRO");
if (rosdis!=NULL){
    printf ("\n The current rosdis is: %s",rosdis);
}


It doesn't print anything, but when I tried to add the same code in simple ros talker, I got the expected result
 The current masteruri is: http://localhost:11311
The current rosdis is: indigo


Do you have any idea why would that happen?
Re: Movement commands through 4diac [message #1775243 is a reply to message #1775205] Thu, 26 October 2017 16:24 Go to previous messageGo to next message
Sofia Syrianidou is currently offline Sofia SyrianidouFriend
Messages: 22
Registered: August 2017
Junior Member
Ben!! It works!!!!! I exported Ros variables at an .sh file in /etc/profile.d. Thank you so much and I'm sorry if I was too tiring.
http://s2.quickmeme.com/img/2a/2a6a94a3493ba9fe8b0a7e26f49f9b24fc136dd8044d647cb35f992000eecff8.jpg
Re: Movement commands through 4diac [message #1776338 is a reply to message #1775243] Wed, 15 November 2017 13:06 Go to previous message
Ben Schneider is currently offline Ben SchneiderFriend
Messages: 25
Registered: February 2017
Junior Member
Great news :-D

No worries! Thank you for your feedback and power of endurance!#

Cheers,
Ben
Previous Topic:OPC UA with IEC 61499 Tutorial Issues
Next Topic:FORTE - Compile your own Function Blocks and code
Goto Forum:
  


Current Time: Fri Mar 29 02:05:35 GMT 2024

Powered by FUDForum. Page generated in 0.07430 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top