Castalia : Is it possible to connect a sink node to a router? - simulation

I'm working on a e-health simulation project using Castalia simulator. I'm using the ValueReporting application scenario where all sensor nodes send their sampled medical data to a sink node. From there i want to send them to a remote hospital network. For that, i need to connect the sink node to an eventuel router. Is there any way i can achieve this ? Thank you for your help.

Related

Connect mavlink (on RPi) with QGroundControl

I am trying to connect Mavlink (installed on RPi) with QGroundControl via 3DR Radio Telemetry as to transmit telemetry data from RPi without dependency of Ardupilot/Px4 flightcontrollers. I want to achieve transmitting data such as GPS or Postion using the message format of mavlink without dependency of ardupilot/PX4.
So far, I have taken the example code from mavlink git and have built the code as per instructions. I start the QGroundControl and was able receive the System ID and component ID from QGC. I modified the code to transmit a heartbeat from RPI-mavlink to QGroundControl.
mavlink_msg_heartbeat_pack(system_id, 200, &msg, MAV_TYPE_HELICOPTER, MAV_AUTOPILOT_GENERIC, MAV_MODE_GUIDED_ARMED, 0, MAV_STATE_ACTIVE);
int len_hb = write_message(msg);
After building and executing this code, I was expecting the QGroundControl to connect/show received message, but nothing was available at the QGroundControl.
I need to understand if what I am doing is the right way to do or if there is predefined method to establish such kind of communication. Kindly, help me out with documentations (if any) available to accomplish message transmission without ardupilot/Px4. If someone could guide me on this issue, it would be really helpful.
Thanks
If you use RPi you not need the 3DR Radio Telemetry. You can connect RPi by WiFi or LTE to send/receive the Mavlink data. You need:
Wire the RPi to the flight controller;
Setup the Mavlink port in the QGroundControl, let the flight controller send the data to a telemetry port;
Install the mavlink-router to RPI;
Setup the mavlink-router send data to groundstation;
When you can receive mavlink data in the groundstation, you use pymavlink to send mavlink message. There is a sample code
If I have understood the question correctly, then what you are trying to do is to develop your own flight controller using raspberry pi. And, you want it to be detected as a vehicle in the QGC.
The example code that you are referring to from mavlink repository is used on the ground station to receive messages from a flight controller and send command messages to it. However, you are trying to send message from flight controller to the ground station.
What you will first have to do is to keep sending a heartbeat message at the rate of 1Hz as described in heartbeat microservice on mavlink documentation page. QGroundControl will detect a vehicle if it receives heartbeats from a vehicle I guess for about 5 seconds continuously. You have to keep sending the heartbeat at 1Hz after that as well, otherwise the QGC will state communication loss even if you are sending other mavlink messages to it.
On top of that, there are many mavlink messages which can have different interpretation for different flight controller. So, at some point you either will have to match your code to a certain extent to an existing flight controller or you will have to modify QGC to work with how you implement your flight controller.

How to design a multi-node application network layer?

I need to implement a mater election lib based on PaxosLease.And meeting problem on network layer design.
The network core requirements as follows:
Each node is both a server and a client
System can work without some nodes online
according to the requirements above, I design the network layer as follow:
Use TCP to transport msg.
Each node listen on named port to accept connection(called ReadSession), these connections will only read msg.
Connect to the other nodes by anonymous port(called WriteSession), these connections will only write msg.
The design maybe looks ok. Because some nodes can off-line at the beginnning, problem occurs: ReadSession can be created by new online node connecting to node, and how can I create WriteSession to the new online node? we can't know the off-line node when to online, and we can only know its anonymous port by accepting new connection from new online node rather than its listen port.
It's really a design problem for me. I have these two ideas at the moment:
Try to use UDP to transport msg
register async_connect again in Asio::ip::tcp::socket::async_connect when throw exception(means connect failed).But this idea still has problems:
asio::io_context spend to much IO resource on async_connect's handler.
we can't make WriteSession be ready immediately when we need write msg because of async op.
So, I want a design that can prepare WriteSession ok immediately when new online node connect to present node.
Thank you very much!
Actually, the network topology you create is a distributed system. And the problem you faced has been solved by many famous applications such as zookeeper and chubby.
If you don't want to be so complex, maybe you can try to use some broadcast protocol like LSD in LAN, or using DHT in WLAN.

Can Ubidots send one Nodemcu data to another nodemcu?

I am trying to connect multiple Nodemcu with Ubidots and finally add one master device that can read all the from other slave devices. Can I do it directly from Ubidots IoT Platform?
Yes, you can do it directly with Ubidots. I recommend you to manage your data using MQTT as a communication protocol. Check out Ubidots Docs for detailed info.
You have to use the publish example for the slave nodes, and from the master node, you must use the subscribe example to get the values from the different variables.
The code of this project can serve as a reference for you to subscribe to multiple variables at the same time.

Watson IOT Out node on Raspberry Pi repeatedly disconnecting

I am using a Watson IOT Output (wiotp out) in a Node-RED flow on my Raspberry PI and am having issues with the connection repeatedly disconnecting and then re-connecting.
Here is a screenshot of my Credentials Node and one of my IOT Out Node.
The connection is configured so that I can send messages to the cloud and successfully have them trigger a flow in my cloud Node-RED instance.
The problem I'm having is that when I attempt to send a string array as my payload, very items in the array actually make it through before the service disconnects. I am limited to around 3-5 strings at a time, which is frustrating because I am losing 195-197 of the 200 items I am trying to send to the IOT platform.
How can I keep a persistent connection and make sure my entire payload makes it through to the IOT service?
If you're seeing very frequent disconnects, it can often mean that you're inadvertently performing clientId stealing (i.e., two MQTT clients are fighting over the same clientId). You can confirm this by looking at the device connection logs in the device drilldown panel: you'll see evidence of log messages such as "The client ID was reused."
Ben

Bluemix node-red add multiple IBM IoT nodes

I understand that we can add IBMIoT nodes to node-red in bluemix and then read the data from the node and do any processing of the data as required by the use case. For this we need to give a device id to the node. Is it possible to create a flow where the device id is dynamic. Let's say I have 10000 sensors / devices. I want to read the data for each of these sensors in a mulitplexed fashion by changing the device id.
It is impossible to create 10000 device nodes. So, what is the best way to manage this number of sensors / devices?
For the In nodes, set the deviceId to All.
Then use the msg.deviceId property to figure out which deviceId it is. This can also be used to used with the IBM IoT Out node. When msg.deviceId is set on a message sent to the Out node, it will over-ride what is set in the node itself.
If it isn't working for you, please add your code.
We can tick All option (device Id) in IBM IoT node option pop up , which helps to connect all Registered devices with different deviceId to Single IBM IoT Node.