Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Impossible to call a method through a port in the entry of the starting state of a state machine
Impossible to call a method through a port in the entry of the starting state of a state machine [message #1808439] Mon, 24 June 2019 15:55 Go to next message
Yoann Farre is currently offline Yoann FarreFriend
Messages: 116
Registered: November 2017
Senior Member
Hello,

I detected an issue with the generation of state machine in C++ code. When the state in which the state machine is initialized contains a call to an operation through a port, the program crash at runtime. The code is well compiled. No issue for other states, no issue for calling intern operations.

Example of code :
broadcast->myOperation();

I built a minimal model to reproduce this issue (DemoIssue). If I remove the call through the port, no more issue. It is probably due to the fact that at the instantiation of the class and the initialisation of the state machine, the port is not yet initialized and we found a nullptr.

Regards.

Yoann.
Re: Impossible to call a method through a port in the entry of the starting state of a state machine [message #1808793 is a reply to message #1808439] Mon, 01 July 2019 17:22 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 228
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi Yoann,

I could reproduce the issue. The problem is that the state-machine starts executing the entry action of the first state immediately after being instantiated (startBehavior is called from the constructor). This happens before the connections between the component instances are set-up (done by the "main" function). Since connections are not setup, the call via the reference fails.
In the context of Papyrus-for-Robotics, we will do a proper life-cycle handling, i.e. handling component states such as "unconfigured", "configured", "active", in addition to the user defined state-machine (see also ROS2 life cycle). The latter should probably not be started before the component becomes active. I'll check if we can do that in a way that the standard designer code generation functions profit as well.

Ansgar
Re: Impossible to call a method through a port in the entry of the starting state of a state machine [message #1808808 is a reply to message #1808793] Tue, 02 July 2019 06:57 Go to previous messageGo to next message
Yoann Farre is currently offline Yoann FarreFriend
Messages: 116
Registered: November 2017
Senior Member
Hi Ansgar,

Thank you for your reply. The lifecycle that you propose seems to be more appropriate to handle this case. When do you think this will be implemented in Papyrus For Robotics, (and so maybe for standard designer code generation feature)?

Regards.

Yoann.
Re: Impossible to call a method through a port in the entry of the starting state of a state machine [message #1810604 is a reply to message #1808808] Wed, 14 August 2019 07:57 Go to previous message
Yoann Farre is currently offline Yoann FarreFriend
Messages: 116
Registered: November 2017
Senior Member
Just to say I reported the bug in bug tracker : https://bugs.eclipse.org/bugs/show_bug.cgi?id=550045

Yoann.
Previous Topic:State machine diagram using papyrus
Next Topic:Property in a custom palette
Goto Forum:
  


Current Time: Mon Dec 16 02:02:48 GMT 2019

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

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

Back to the top