How to add more RSU node on Veins - omnet++

I'm facing some problem when trying to add more RSU node on veins example code.
Here's the code I added in RSUExampleScenario.ned
rsu[2]: RSU {
#display("p=162,140;i=veins/sign/yellowdiamond;is=vs");
}
And more codes in .ini
*.rsu[1].mobility.x = 1800
*.rsu[1].mobility.y = 1800
*.rsu[1].mobility.z = 2
When I try to start the simulation,error message says
Error: Name 'rsu' is not unique within its component
I'd really appreciate with some help to solve this problem

The example is a bit confusing here. You should not add this code, but rather replace rsu[1] with rsu[n], where n is the amount of nodes you want. You can then specify the location of each in the omnetpp.ini as you're doing here. Check out this part of the OMNeT++ tutorial for more details. This has the following example:
network Tictoc10
{
submodules:
tic[6]: Txc10;
Here we created 6 modules as a module vector...

Related

Loading protocol buffer in ruby or java similar to node

I have a .proto file that contains my schema and service definition. I'm looking for a method in ruby/java that is similar to how Node loads and parses it (code below). Looking at the grpc ruby gem, I don't see anything that can replicate how Node does it.
Digging around I see this (https://github.com/grpc/grpc/issues/6708) which states that dynamically loading .proto files is only available in node. Hopefully, someone can provide me with an alternative.
Use case: Loading .proto files dynamically as provided in the client but I can only use either ruby or java to do it.
let grpc = require("grpc");
let loader = require("#grpc/proto-loader");
let packageDefinition = loader.loadSync(file.file, {});
let parsed = grpc.loadPackageDefinition(packageDefinition);
I've been giving this a try for the past few month and it seems like Node is the only way to read a protobuf file on runtime. Hopefully this helps anyone in the future that needs it.

Yolov4 error when trying to display image on custom model

I have trained my own model, using my own custom dataset, using Yolov4, and I have downloaded the .cfg, .weights and .data files.
When I try to run my model using:
darknet.exe detector test cfg/obj.data cfg/yolov4-og.cfg custom-yolov4-detector_best.weights
I get the error:
Error: l.outputs == params.inputs filters= in the [convolutional]-layer doesn't correspond to classes= or mask= in [yolo]-layer
I don't know if this is an error on my part, with the command I am running, or an error from the model I trained.
Any help would be appreciated.
I am assuming you are using the main darknet repo AlexeyAB. Please make sure you follow the following instructions:
Make sure you assign the correct classes number in the config file.
Change filters=255 to filters=(classes + 5)x3 in the 3
[convolutional] before each [yolo] layer, keep in mind that it only
has to be the last [convolutional] before each of the [yolo] layers
https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L603
https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L689
https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L776
So if classes=1 then should be filters=18. If classes=2 then write filters=21
(Generally filters depends on the classes, coords and number of masks, i.e. filters=(classes + coords + 1)*, where mask is indices of anchors. If mask is absent, then filters=(classes + coords + 1)*num)
Reference: https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects

Controlling a servo at Raspberry Pi with Springboot and ServoBlaster

I am trying to control a servo motor from a web interface. I am using SpringBoot 2.0, ServoBlaster and pi4j.
In order to start the application I am running as root ./gradlew bootrun --no-daemon. It has to be root in order to handle the GPIOs and I don't have any security worries about the device.
In simplified (a class with just the main function) Java/Kotlin I achieved to control the servo by any of the following ways:
RPIServoBlasterProvider
val servoProvider = RPIServoBlasterProvider()
val servo0 = servoProvider.getServoDriver(servoProvider.definedServoPins[5])
println("Go to 150") //middle
servo0.servoPulseWidth = 150
println("Went to ${servo0.servoPulseWidth}")
Thread.sleep(1550)
Write to /dev/servoblaster
val out = PrintWriter(FileOutputStream("/dev/servoblaster"), true)
println("Go to 65 again")
out.println("5=65")
out.flush()
out.close
Call a secondary script which writes to /dev/servoblaster
val servoId = 5
val script = "/home/pi/ServoHardwareSteering.sh"
val cmdMinPosition = "$script $servoId 65"
val cmdMidPosition = "$script $servoId 150"
val cmdMaxPosition = "$script $servoId 235"
val runtime = Runtime.getRuntime()
println(cmdMidPosition)
runtime.exec(cmdMidPosition)//.waitFor()
Thread.sleep(1550)
Write the value to a file and have a secondary execute reading this file and applying this value to the servo
I have tried all of the above in Springboot but without success.
So the question is, could somebody tell me how could I:
use the RPIServoBlasterProvider class from Springboot? OR
write to /dev/servoblaster? OR
execute any terminal script? OR
where to save the script in order to be able to call it OR
write to a simple file (ex. afile.txt)? OR
solve the issue in a better way that I did not think about already.
Solutions at any of the above questions could help me solve my problem.
PS: Is there anything wrong with the blockquote for the source code in stackoverflow? I could not format it as a block and I used the line code formatting!
use the RPIServoBlasterProvider class from Springboot? OR
The same you did before - its Java (kotlin is based on) - or just use Kotlin with Spring https://spring.io/guides/tutorials/spring-boot-kotlin/
write to /dev/servoblaster? OR
The same like you did - everything is a file in linux, thus its writing to a ordinary file
execute any terminal script? OR
Runtime.getRuntime.exec - any variant or ProcessBuilder
where to save the script in order to be able to call it OR
Anywhere
write to a simple file (ex. afile.txt)? OR
point 2.
solve the issue in a better way that I did not think about already.
No experience with servo blaster.
The whole problem was with the servod of the ServoBlaster. It was accidentally killed and I had to run it once again!
I followed the No 5 solution.

No visualization in Rviz when publishing on (collision_object) topic?

I am trying to add a collision object using another way than
planning_scene.addCollisionObjects(std::vector<moveit_msgs::CollisionObject>)
so I am trying to publish on (collision_object) and (attached_collision_object) topics using
ros::Publisher pub_co = nh2.advertise<moveit_msgs::CollisionObject>("collision_object", 10);
ros::Publisher pub_aco = nh2.advertise<moveit_msgs::AttachedCollisionObject>("attached_collision_object", 10);
However nothing shows in Rviz, when i echo the topic the msg is shown but nothing in Rviz
I also tried using moveit_visual_tools method
visual_tools_->publishCollisionBlock(------)
but also i get nothing !
any ideas why ?
The Problem was just simply not listening to the correct planning scene Topic, the strange thing is that the topic name was the .cpp file name (does moveit_visual_tools publish the .cpp as a topic name?)
After the correct planning scene topic was chosen visualization in Rviz was perfect.

Can't import NED files to use channels OMNeT++

I'm not able to import channel types from one .ned file to another in OMNet++.
I have A.ned where I define a channel called Ether.
channel Ether extends ned.DatarateChannel
{
datarate = 10bps;
delay = 10ms;
ber = 1e-10;
}
I want to then use that channel in B.ned without having to repeat the definition. I've tried:
import A;
module B extends A
{
...
}
Both files are in the same package. A.ned contains a network and not a compound module but I tried making it a module and adding the #isNetwork tag and that did not work. The error is "Cannot resolve channel type Ether" when I use it as such:
router.port[i] <--> Ether <--> switch[i].port[0];
I feel like this should be easy but I haven't been able to find much help online or in the Simulation Manual. Any help is greatly appreciated!
You need to link the project that includes the A.ned to the project that includes B.ned using the project references.

Resources