Home » Eclipse Projects » Papyrus for Real Time » 6 ports, 1 protocol. Send to 3 only issue
6 ports, 1 protocol. Send to 3 only issue [message #1798400] |
Fri, 16 November 2018 20:23 |
Twan Dieltjes Messages: 22 Registered: September 2018 |
Junior Member |
|
|
I have to do an assigment for a hexapod machine.
I've created 6 ports to 6 legs which all have the same protocol.
When I send a message to for ex ports 2, 4, 6, I get an error from port 3:
Unexpected message to capsule instance Top.hexaPodController role hexaPodController on port legProtocol3 protocol LegProtocol signal ready
I do not send a message to port 3 at that moment.
How can I fix this?
-
Attachment: Hexapod.zip
(Size: 27.25KB, Downloaded 106 times)
[Updated on: Fri, 16 November 2018 20:30] Report message to a moderator
|
|
| | |
Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798403 is a reply to message #1798402] |
Fri, 16 November 2018 22:45 |
Ernesto Posse Messages: 438 Registered: March 2011 |
Senior Member |
|
|
Sorry. I missed it.
Well, there is a transition in Leg's state machine that does send 'ready' to the controller. In the "Active" state you have a timeout transition. In the controller, in the "Moving" state you have a choice point with two alternatives, one with guard "counter < 3" and the other with "counter > 2". Counter is initialized to 0 in Moving's initial transition. Then the condition counter < 3 is true, and so it goes into the "Group1Moving" state, which sends the 'move' message to legs 1, 3 and 5. These legs will have previously entered state "Active.Standing" (because the controller, on entering its "Moving" state, sends the "stiffen" message to all legs". So since they are in "Active.Standing" and they receive "move", they transition to state "Active.Moving" where you set a random timer. When the timer fires, the timeout transition back to "Active.Standing" is taken, and this transition's action sends the "ready" message to the controller, which is still in "Moving.Group1Moving". On receiving this message, it takes a transition, incrementing the counter, back to the choice point. So in theory, after receiving 3 'ready' messages, it should go to "Group2Moving". But note that each time you enter Group1Moving, you are sending the "move" message again. Is this what you intend? Looks like you are sending three "moves" for each "ready" that you expect. I think you need to refactor your "GroupNMoving" states and the choice point into states that send all the moves and expect the 'ready' messages. For example, you could send all the 'move' messages in the "<3" transition (removing them from the Group1Moving" entry action), and add a new choice point used to count, changing the target of the "TriggerGrp1" transition to the new choice point. Similarly for the other Group2Moving state.
By the way, I noticed a few other odd things in your model, like the fact that you are sending the 'stiffen' message both in "Moving"'s entry actiion as well as its initial transition. So you are sending two 'stiffens' each time. I don't know if that's what you intended.
By the way, since there is a lot of replication, namely the legs, you could use replicated parts and ports, which could simplify the model and action code. Instead of explicitly defining six separate 'leg' parts, you can define just one with replication 6, and the controllwe has one 'legProtocol' port with replication 6 instead of six separate ports. Then you can refer to each of them with an index in action code, e.g. "logProtocol[0].move().send()" And, iin the controller's state machine, transitions can listen to that replicated port, and inside the corresponding action you can use the "msg->sapIndex0()" or "msg->sapIndex()" method to determine which index of the port received the message.
|
|
| | |
Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798469 is a reply to message #1798431] |
Mon, 19 November 2018 15:33 |
Ernesto Posse Messages: 438 Registered: March 2011 |
Senior Member |
|
|
I'm not sure what you mean by "opties", but the problem was a problem with your model, i.e. a problem of design, not a tool problem. In the same way that if you write a program in, say Java or C++, which is incorrect, in the sense that the algorithm doesn't correctly compute what it's supposed to compute, then the Java or C++ compiler won't be able to tell you. A compiler can only give you warnings or errors regarding syntax, types, etc. but not about whether your program is correct. The same is true for modelling tools. If you want a tool that helps you find problems of design, then you have alternatives such as debugging, simulation, testing, or formal verification. Unfortunately Papyrus-RT doesn't include features for these.
It's true that there is a lack of documentation, but you can learn about designing (good) UML-RT models from the "ROOM" book [1,2], and google "Real-Time Object-Oriented Modeling". UML-RT is essentially the same as the ROOM language.
BTW: Papyrus-RT is not Papyrus.
[1] https://en.wikipedia.org/wiki/Real-Time_Object-Oriented_Modeling
[2] https://www.amazon.ca/Real-Time-Object-Oriented-Modeling-Bran-Selic/dp/0471599174
|
|
| | | | |
Goto Forum:
Current Time: Sat Apr 20 00:20:59 GMT 2024
Powered by FUDForum. Page generated in 0.03779 seconds
|