I am trying to simulate a scenario in Veins where I want to disable the
right of way checks at the road junctions. I looked up at the Sumo wiki and
found that the bitset is 23 for the purpose. Another lookup in the
TraCIMobility.h header bundled with Veins helped me to know that this can
be done using the function commandSetSpeedMode() for a TraCIDemo11p node
which models the vehicles in the Veins demo simulation. I am trying to
build up my model using this demo bundled with Veins.
But as I am trying to do so, SUMO crashes. I am trying to initialize the
nodes in the initialize() function of TraCIDemo11p through the following
code:
void TraCIDemo11p::initialize(int stage) {
BaseWaveApplLayer::initialize(stage);
if (stage == 0) {
traci = TraCIMobilityAccess().get(getParentModule());
annotations = AnnotationManagerAccess().getIfExists();
ASSERT(annotations);
traci->commandSetSpeedMode(23); // This is the point of modification
sentMessage = false;
lastDroveAt = simTime();
findHost()->subscribe(parkingStateChangedSignal, this);
isParking = false;
sendWhileParking = par("sendWhileParking").boolValue();
}
}
I tried to set the modes with other standard values such as 0 or 31, but
every time I get SUMO crashed.
I am unable to figure out where else I should place this command. I tried
to set the mode in some other initialization stage by adding an else clause
to it but it crashes still. What's more, eve nthe the debugger on, no error
is being shown, either in the OMNeT++ window or the sumolaunchd.py output
in OMNeT++ cmd.
Please help to understand my error. Thanks.
EDIT: adding Error message info
To make things clear, I am not receiving any error message but the exit code. I searched for the code but got no help. The usual 'this app is not responding' window pops up and the sim ends, so I suspect SUMO to crash.
The OMNeT++ environment shows the following message:
Simulation terminated with exit code: -1073741819
Working directory: C:/Users/stes-2/veins-3.0/examples/Cross Roads
Command line: c:/Users/stes-2/omnetpp-4.4/bin/opp_run.exe -r 0 -n ../veins;../../src --tkenv-image-path=../../images -l ../../src/veins omnetpp.ini
Environment variables:
OMNETPP_ROOT=c:/Users/stes-2/omnetpp-4.4
PATH=;C:/Users/stes-2/veins-3.0/src;c:\Users\stes-2\omnetpp-4.4\bin;c:\Users\stes-2\omnetpp-4.4\msys\bin;c:\Users\stes-2\omnetpp-4.4\mingw\bin;c:/Users/stes-2/omnetpp-4.4/ide/jre/bin/client;c:/Users/stes-2/omnetpp-4.4/ide/jre/bin;c:/Users/stes-2/omnetpp-4.4/ide/jre/lib/i386;.;C:\Users\stes-2\omnetpp-4.4\msys\local\bin;c:\Users\stes-2\omnetpp-4.4\mingw\bin;C:\Users\stes-2\omnetpp-4.4\msys\bin;c:\Users\stes-2\omnetpp-4.4\bin;c:\ProgramData\Oracle\Java\javapath;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Python27;c:\Users\stes-2\sumo-0.21.0;c:\Users\stes-2\omnetpp-4.4;
OMNETPP_IMAGE_PATH=c:\Users\stes-2\omnetpp-4.4\images
Since I am running SUMO through the sumoLaunchd.py script, the error message that turns up at the MingW cmd of OMNeT++ is:
Starting SUMO (c:/Users/stes-2/sumo-0.21.0/bin/sumo-gui.exe -c cross.sumo.cfg) o
n port 64161, seed 0
Connecting to SUMO (c:/Users/stes-2/sumo-0.21.0/bin/sumo-gui.exe -c cross.sumo.c
fg) on port 64161 (try 1)
Releasing lock on port
Starting proxy mode
Done with proxy mode
Done with proxy mode, killing SUMO
SIGTERM
Done running SUMO
Cleaning up
Result: "<?xml version="1.0"?>
<status>
<exit-code>15</exit-code>
<start>1433944271</start>
<end>1433944276</end>
<status>Exited with error code 15</status>
<stdout><![CDATA[Loading configuration... done.
]]></stdout>
<stderr><![CDATA[]]></stderr>
</status>
"
Closing connection from 127.0.0.1 on port 64160
I think you are missing some lines.
You have assigned the TraCIMobility to traci, and then you don't even consider the general commandInterface and the vehicleCommandInterface
TraCIMobility* mobility = TraCIMobilityAccess().get(getParentModule());
TraCICommandInterface* traci = mobility->getCommandInterface(); /* missing command interface */
TraCICommandInterface::Vehicle* traciVehicle = mobility->getVehicleCommandInterface(); /* missing vehicle command interface */
traciVehicle->setSpeedMode(someNumber);
I even tried to compile your code but it complains that there is no method available for TraCIMobility called commandSetSpeedMode(). But that could be due to difference in Veins versions.
Multi-stage initialization
A module/variable you are trying to access might not be ready, i.e. still has not been created, by the time you are trying to use it. In that case the multi-stage initialization feature of OMNeT++ can be used.
This means a "task" may be delayed to a later stage of the initialization of the current module:
void SomeModule::initialize(int stage)
{
ApplicationBase::initialize(stage); /* ignore if causes error */
if(stage == 0)
{
/* do this */
else if (stage == 3)
{
/* do this later */
}
}
Related
I'm trying to use the ocaml-mm package (https://github.com/savonet/ocaml-mm) and trying to run one of the examples for sine_wav.ml
I first installed the package and also installed the ao library, which the sine_wav file uses. Everything compiles, but I get this error when I'm trying to run the file:
ddavidjeong#DESKTOP-60PESIS:~/cs3110/ms/test$ make main
Entering directory '/home/ddavidjeong/cs3110/ms'
Fatal error: exception Failure("Failed to open device")
make: *** [Makefile:2: main] Error 2
ddavidjeong#DESKTOP-60PESIS:~/cs3110/ms/test$
I have no idea what this exception could refer to.
This errors means that the libao library failed to open its default audio device. You can at least check which default device was found by the library by using in utop
#require "ao";;
Ao.get_default_driver ()
```ocaml
Similarly, you can get the list of all audio device found by libao with
```ocaml
Ao.drivers;;
If there is no visible issue with the default driver, and there is some non-default driver available that looks like they might work; it would be possible to try to use another device in sin_wave.ml by replacing the instance of the Mm_ao.writer class in
let ao = new Mm_ao.writer channels sample_rate in
by an instance of
class ao_writer driver channels rate = object
object
val dev = Ao.open_live ~driver ~channels ~rate ~byte_format:`LITTLE_ENDIAN ()
method write buf ofs len =
let s = Audio.S16LE.make buf ofs len in
Ao.play dev s
method close = Ao.close dev
end
with the right driver.
But it is probably better to see why libao cannot open the default device that it selected itself.
I am trying to call Matlab Functions from my OMNeT simulation. Therefore I created a shared library using the mwArray API. However, when I try to run the sample code, the simulation terminates with the following error message:
Error in final launch sequence:
Failed to execute MI command:
-exec-run
Error message from debugger back end:
During startup program exited with code 0xc0000135.
Failed to execute MI command:
-exec-run
Error message from debugger back end:
During startup program exited with code 0xc0000135.
During startup program exited with code 0xc0000135.
Did anyone else encounter the same problem?
I am using OMNeT 5.6.2 and Matlab 2020a under Windows
The code for my module is
#include <omnetpp.h>
#include "compilerTest.h"
using namespace omnetpp;
class ExampleModule : public cSimpleModule
{
protected:
simtime_t timerInterval;
cMessage * timer;
protected:
virtual void initialize();
virtual void handleMessage(cMessage *msg);
};
Define_Module(ExampleModule);
void ExampleModule::initialize()
{
timerInterval = 1.0;
timer = new cMessage("timer");
scheduleAt(simTime() + timerInterval, timer);
}
void ExampleModule::handleMessage(cMessage *msg)
{
if (msg->isSelfMessage()){
bool x = mclInitializeApplication(NULL, 0);
scheduleAt(simTime() + timerInterval, timer);
}
}
The message indicates that the error occurred during the startup of the process. It means that the process probably cannot load the Matlab runtime DLL. The directories where the Matlab DLLs reside must be present on the system path so the operating system can load them. On Windows it is especially hard to avoid DLL hell and fix these issues (mostly because of the lack of proper error messages). First, I would try to start the example from the MinGW env command prompt where you can control the PATH manually and try to run from the IDE only after it works in the command line.
I have installed OMNeT++ 5.6.2 and added the INET 4.2.1 framework.
I followed the setup instructions as per the doc given and compiled and did make.
On running ./aloha I seem to encounter parameter unassigned error as follows :
Setting up Cmdenv...
Loading NED files from .: 4
Preparing for running configuration General, run #0...
Assigned runID=General-0-20201227-14:11:08-9189
Setting up network "Aloha"...
<!> Error: The simulation wanted to ask a question, set cmdenv-interactive=true to allow it: "Enter parameter 'Aloha.host[0].iaTime' (unassigned):" -- in module (aloha::Host) Aloha.host[0] (id=3), during network setup
End.
Even on running a different example from INET, from examples, adhoc, seem to get a similar error as follows :
Preparing for running configuration General, run #0...
Assigned runID=General-0-20201223-00:37:38-95889
Setting up network "Net80211"...
<!> Error: The simulation wanted to ask a question, set cmdenv-interactive=true to allow it: "Enter parameter 'Net80211.numHosts' (unassigned):" -- in module (omnetpp::cModule) Net80211 (id=1), during network setup
End.
Simulation terminated with exit code: 1
I did set cmdenv-intercative=true in the config file and yet the error does not go away.
Please do let me know if you need any additional information. Any help, direction or pointer to some resources would be greatly appreciated and will be really really helpful.
You need to set "cmdenv-intercative=true" for the [General] section.
I'm beginner at omnet++ and veins, I have just installed Omnet++ 5.0 (on Windows 10) and installed INET with it as well. I've added a new application traci named "obstacle" to block véhicules, I've changed the files erlangen.launchd.xml and omnetpp.ini and I try to run the examples erlangen. However, it throws an error:
Simulation terminated with exit code: -1073741819.
I am not finding any help regarding this error anywhere.
Please help me .
-1073741819 is equal to 0xC0000005. Try to search using this error number.
Moreover, take a look at Debugging and set in your omnetpp.ini:
debug-on-errors = true
Thanks to that when your simulation crashes, the debugger will show the line that is source of this error.
the debugger open cexecption.cc
the result of debugging
and the error message is :
std::logic_error: basic_string::_m_construct null not valid -- in module (veins::traciscenariomanagerlaunchd) rsuexamplescenario.manager (id=6), at t=1s, event #2
I have followed step by step the tutorial to install Veins, but when I tried running the example scenario (final step) I ended up with the above error.
The whole error was:
Error in module (cModule) RSUExampleScenario (id=1) during network
setup: Class "Veins::ObstacleControl" not found -- perhaps its code
was not linked in, or the class wasn't registered with
Register_Class(), or in the case of modules and channels, with
Define_Module()/Define_Channel().
TRAPPING on the exception above, due to a debug-on-errors=true
configuration option. Is your debugger ready?
Simulation terminated with exit code: -2147483645 Working directory:
C:/Users/user/src/veins-4.3/examples/veins Command line:
../../../omnetpp-4.6/bin/opp_run.exe -r 0 -n .;../../src/veins
--tkenv-image-path=../../images -l ../../src/veins omnetpp.ini
I don't think I have missed a step during the tutorial as I have tried it two times. I did not make any change in anything, I've just strictly followed the tutorial like a robot, so I cannot provide an MCVE with more details than the tutorial.
Here is what I'm using:
- Windows 7 Pro 64 bits
- SUMO 0.25.0 64 bits
All other steps of the tutorial successfully worked until the final step.
I assume this error occurs when running Veins via the OMNeT++ IDE. Or, if you have compiled it with GCC (The error does not happen if you use CLANG)
There are two ways to bypass this error:
Use the .run as executable from your examples directory, which calls veins/run and includes all the required libraries:
Use opp_run as executable and set dynamic libraries to the directory where libveins.so is located (usually src/veins)
PS: to answer #ChristopSommer questions: Veins::ObstacleControl appears in opp_run -l src/veins -h classes
This could be a solution too, but I never tested it: Compiler flags in Eclipse