How to connect between Simulated Vehicle and Companion Computers at the same time? - dronekit-python

I was wondering if it was possible to connect to a virtual drone and physical drone at the same time, UDP and USB. This is to test ground station like functionality to be able to control multiple drones. I only have 1 physical and want to test between both.
Or to at least prove my suspicion that
api = local_connect() # Get an APIConnection
all_vehicle = api.get_vehicles()
Does in fact give me all possible connected vehicles.
And just play with it from there.
Edit:
What my process was is looking at MAVProxy and read up on it. I can connect to a physical drone Iris+ and a virtual copter by following
this.
I run the instance with this command
sim_vehicle.sh -v ArduCopter -L PLACE --map --console --out :14550
It works well and I can connect to it using MavProxy via the following command
start up
mavproxy.py --master=127.0.0.1:14550
Now I can connect to the physical as well with
mavproxy.py --master=/dev/USB0
When I try to use with both
mavproxy.py --master=127.0.0.1:14550 --master=/dev/USB0
It doesn't work and I don't even know if it would work to begin with I was just trying.
All in all what i am trying to do is being able to connect to 2 drones and be able to control them with 1 ground control station.
API: to connect to multiple vehicles

Related

How to let a raspberry pi 3b connect to wifi with wps from within a c program

I have a machine controlled by a raspberry pi. For servicing I want to connect the local wifi network. The machine has no controls with which you could enter ssid and password. With a combination of button pushes a connection to the wifi must be made.
In my program I have the following code:
void start_Wps(void) {
if (!fork())
execl("wpa_cli","-i","wlan0","wps_pbc", NULL);
}
If I start my program from a ssh terminal it works most of the time. However when I let my code start from rc.local the rpi never connects to my wifi network.
In case your project shall work in an enterprise environment, can you be sure that WPS is supported on the client’s access points?
Another thing to consider: WPS is in decline. It is not supported e.g. in Android since Android 9, WPA3 security won’t be supported by WPS and its successor has already been presented by Wi-Fi Alliance.
It is called “Wi-Fi Easy Connect” and it basically is a device provisioning protocol that also allows the connection of “headless” device, i.e. without display or input. You could connect your mobile phone to the Wi-Fi network on the customer’s premise, read the QR code that you previously put on your machine and then the phone takes care of connecting the machine to the network.
More detailed information is provided on Wi-Fi Alliance’s website: https://www.wi-fi.org/discover-wi-fi/wi-fi-easy-connect
If you want to make sure that your project is future-proof and will be maintainable for years to come, you might want to look into that.

Read SMBIOS of a remote PC

I know that when a PC is OFF, some components still working ,like the motherboard, the NIC (network card), and others. I thought that like the 'magic packet' send to the NIC on the Wake-on-Lan do, there is a form of sending another signal to this one.
How can I get the SMBIOS table, through the Network Card of a remote and power-off PC?
If someone knows of some code example, or manual which can read to learn, it would be very helpful.
How can I get the SMBIOS table, through the Network Card of a remote and power-off PC?
You can't. WoL is a function of the NIC. When it receives a magic packet it triggers a PMI event, waking up the mainboard - that's it. You can't magically talk through the NIC to the powered down system.
There are two solutions, depending on your actual goal:
Many servers, some workstations and PCs feature lights-out management through a baseboard management controller - features differ, you'll need to select the appropriate product.
Wake the machine, run whatever queries you need and shut it down again. This is a standard procedure for client management.

Tcp needed when i2c and ssh are used?

I'm doing a project where I have 2 raspberry pi zeros connected and a psoc 5 connected to one of the rpi's.
The connection between them are all i2c.
One of the rpi's are considered the "master" and from my android phone I will use ssh to remote control the master.
[Phone] = SSH = [RPi Master] = I2C = [RPi Slave]
||
[PSOC 5]
My teacher told me to consider tcp/ip, but I will still have the 2 rpi's and the psoc connected by wires.
My question therefore is - are there any benefits in doing tcp in my project?
There is no clear way to answer whether TCP is better than I2C without more info about your project, as that is an application-specific question. This question would be easier to answer with a little more detail on your project, including requirements, data rates, etc., but I will try to give you some info based on personal experience.
The only reason to consider TCP/IP between the devices is if the data rate needed is higher than I2C can support, or if it would be useful to keep them separated beyond I2C range.
Creating a program that utilizes TCP to run on your phone and the master would make the system a little more complete, as you would have a program running on the master constantly to automatically accept information from the user and run the commands, rather than having to control it from the command line. This would also force you to create some sort of user-facing program for the phone. From a design perspective for a class project, this could be preferable.
Without knowing why your teacher suggested that it is hard to give you a straight answer; it is possible the suggestion was given not for any real performance reasons but for you to learn about networking, TCP/IP protocols, or to be able to say you have "IoT experience".

Use Psexec to get Connected USB Device names

I'm wondering if it's possible to use Psexec to return a list of connected USB Devices on remote windows 8 computers. Ideal output would be something like this:
USB1: Keyboard
USB2: Barcode Scanner
Obviously the device name would be displayed instead of 'keyboard' ect, is there an easy way to do this? I'm working within a secure environment with hundreds of remote machines, so unable to install any new Microsoft Tools such as Devcon myself.
Any suggestions would be appreciated.

Get system date/time via USB

Is there any way to query the system's date/time via USB without installing anything on the host computer (maybe just drivers)?
Background of the original problem
To avoid the XY problem, let me explain a bit what I'm trying to do.
To be able to calculate a TOTP token for 2FA (e.g. like Google Authenticator app does) you need a real-time clock to get the date and time.
There's this USB device called SC4-HSM that I would like to use to calculate the tokens, however it doesn't have a clock and according to the designer, adding one would be too expensive (needs a battery, etc).
Possible solution to the original problem
This device is going to be used with a computer which already has an RTC of course. Thus I had the idea of querying the system for a date/time which would solve the issue.
(Note: I know that a USB device can be connected to all sorts of hosts and not all hosts will have an RTC, but since this only needs to work with a computer, I thought this shouldn't be an issue)
My first thought was that there might be some USB device class that had date/time needs, so I could register the device as that type and then I would be able to query the values.
After going through the device class codes list (Internet Archive) nothing jumped at me as needing date/time. The closest ones I could think of were:
Content Security (PDF)
Personal Healthcare
Smart Card Class (PDF)
I skimmed the device class documents in the USB Implementers Forum but there's nothing in there even remotely related to date or time.
Current problem
Since the USB specs seemed like a dead-end I thought that maybe there was a way to write a very simple USB driver that can be auto-loaded when the device is plugged in to a computer and then we can use the driver to return the date/time when the device asks for it (unless I'm misunderstanding something).
I am now looking through USB development docs like Michael Opdenacker's Linux USB drivers course, I tried the Linux USB Project which seems dead. Skimmed through Driver Development for Windows NT just to get an idea, however I am still not able to figure out if this is possible or not, and how hard it would be.
I'm a complete beginner at this and maybe this is something out of my skill level, but I would like to figure out if will I need weird hacks and workarounds or is there a much more straightforward way to do this?
There seems to be little information about it or I'm just searching the wrong places.
Any ideas/or pointers on either solving the original problem or the current one?
system time is not necessarily the general time i.e. the 'atomic' time you get from a NTP server
the most obvious solution is to use autorun, this is also possible on linux but normally autorun is blocked so the user explicitely has to activate it
https://askubuntu.com/questions/642511/how-to-autorun-files-and-scripts-in-ubuntu-when-inserting-a-usb-stick-like-autor
the linux command to get the time is date or hwclock or if the computer is connected to the net it may be possible to contact a NTP server (if the firewall does not block this)
then your autorun program has to send the data to the SC4-HSM. i do not know what USB classes the SC4-HSM implements if it implements CDC ACM (virtual COM port) this is easy:
Unable to sync computer time to Arduino via USB
(something like echo "T$(($(date +%s)+60*60*$TZ_adjust))" >/dev/tty.usbmodemfa131)
maybe it is possible to access system time over the USB drivers, i do not know this right now

Resources