Skip to content

Fix misspellings + readme #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AirSim Handler/AirSimControls.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def ChannelControllers(self, id):
# Handshake Message -> IN: "Hello Gardien!"
buff = c.recv(1024).decode("utf-8")
if buff == "Hello Gardien!":
print("Connection to overlord successfull!")
print("Connection to overlord successful!")
c.send(b"Hello Overloard!") # Handshake
else:
print("Connection Failed!, Got Back this handshake -->")
Expand All @@ -115,14 +115,14 @@ def ChannelControllers(self, id):
bb = bytes(a[tmp.rfind(b".") :], "utf-8") # Get the index of the last dot and store it for future
b = str(a).split(".")
except Exception as e:
print("Error in Recieving and parsing...")
print("Error in Receiving and parsing...")
del self.connections[id]
del c
break
print(b)
for i in b: # For multiple logged commands
cmd = i.split(":")
if len(cmd) == 3: # We recieved the command properly
if len(cmd) == 3: # We received the command properly
# print("Got Request nicely...")
val = float(int(cmd[1]))
print("Got Request "+ self.channelTable[id]["name"] + " :"+ str(val))
Expand Down
4 changes: 2 additions & 2 deletions ManualController/Controls/DirectControls/DirectControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ void DirectController::InitSequence()
for (int i = 0; i < 6; i++)
{
send(server_fd[i], HANDSHAKE_IN_MSG, strlen(HANDSHAKE_IN_MSG), 0);
// TODO: Place mechanism to recieve back handshake and if not matching, Panic!
// TODO: Place mechanism to receive back handshake and if not matching, Panic!
char *buff = (char *)malloc(1024);
int valread = read(server_fd[i], buff, 1024);
if (strncmp(buff, HANDSHAKE_OUT_MSG, strlen(HANDSHAKE_OUT_MSG)))
{
std::cout << "Gardien Could not establish Connection / Handshake Failure...\n";
throw "Handshake Failed!";
}
printf("Handshake Successfull, Connection Established!\n");
printf("Handshake Successful, Connection Established!\n");
}
disarm();
balance();
Expand Down
2 changes: 1 addition & 1 deletion ManualController/Controls/README
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ the Microsoft AirSim Simulatior.
DirectControl/ --> Code and APIs for handling over commands to the remote drone computers

AbstractControls --> Abstract classes to provide APIs for control and communicating to the drone
DirectControls --> Implemntations of the Controller class for Actual Real Drone Controls
DirectControls --> Implementations of the Controller class for Actual Real Drone Controls
2 changes: 1 addition & 1 deletion ManualController/Controls/RemoteDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main()
case 0:
exit(0);
default:
cout << "Incorrect Option choosen!\n";
cout << "Incorrect Option chosen!\n";
}
}
return 0;
Expand Down
8 changes: 4 additions & 4 deletions ManualController/ManualController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class RunningAverage
double alpha;

public:
RunningAverage(int blength, int seed, double alph)
RunningAverage(int blength, int seed, double alpha)
{
for (int j = 0; j < blength; j++)
avgBuffs.push_back(seed);
alpha = alph;
alpha = alpha;
buffLength = blength;
}

Expand All @@ -55,9 +55,9 @@ class RunningAverage
return y;
}

void Reset(double alph)
void Reset(double alpha)
{
alpha = alph;
alpha = alpha;
}
};

Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Use any Radio Controller easily with AirSimRC++
## This software stack allows you to integrate any Radio Controller hasle-free, to use with Unreal Engine 4 based AirSim Simulator as well as to provide extended APIs for general use.
### Wanted to use your Radio Controller but its not supported by AirSim? or just wanted to get data from a Radio Controller to a PC for god knows what reason? Well this might just end your search.

## AirSimRC++ allows you to connect your random radio controller to a PC, via an **_intermediate Arduino_** (or stm8/32 or any other microcontroller really), and provide a useful set of APIs and tools to do stuff with the data, for example, connect to the AirSim Simulator of Unreal Engine 4, without **_EXPLICITLY coding for a new RX_**.
This software stack allows you to integrate any Radio Controller hasle-free, to use with Unreal Engine 4 based AirSim Simulator as well as to provide extended APIs for general use.

### _For the Architecture, check the bottom note_
Wanted to use your Radio Controller but its not supported by AirSim? or just wanted to get data from a Radio Controller to a PC for god knows what reason? Well this might just end your search.

AirSimRC++ allows you to connect your random radio controller to a PC, via an **_intermediate Arduino_** (or stm8/32 or any other microcontroller really), and provide a useful set of APIs and tools to do stuff with the data, for example, connect to the AirSim Simulator of Unreal Engine 4, without **_EXPLICITLY coding for a new RX_**.

## _For the Architecture, check the bottom note_

## **_Usage:_**
> First upload the **_ArduinoInterface_** sketch onto an arduino board (or stm etc.). Tweak the serial speed as the max available on that board.
Expand All @@ -17,7 +19,7 @@

> Open a terminal in the **_ManualController_** Directory and type **_make_** to compile and generate binaries.

> **_Switch on the Radio controller_** and make sure it is binded to the reciever.
> **_Switch on the Radio controller_** and make sure it is binded to the receiver.

> **_Execute the ManualController_** Binary.

Expand All @@ -27,13 +29,12 @@
### Following the steps, You should now be able to fly the MultiCopter using the controller, intuitively. Report any bugs/problems if found.

### **_The Architecture is as follows_**
> The Radio Reciever is **connected to an Arduino**, with **provided Code uploaded on it**. The Radio Reciever sends data recieved from the transmitter via _PWM_ signals. Arduino then writes the data onto a _Serial_ port as stream to a PC attached.
> The Radio Receiver is **connected to an Arduino**, with **provided Code uploaded on it**. The Radio Receiver sends data received from the transmitter via _PWM_ signals. Arduino then writes the data onto a _Serial_ port as stream to a PC attached.

> The **_ManualController_** Program reads from this Serial port, unpacks the data, calibrates it when needed, and applies some signal processing to sanitize and smoothen it, and converts it into a range of _0-255_. **_ManualController_** program then connects to a local server, created by the **_AirSimControls.py_** and begins sending RX data over via sockets.

> The **_AirSimControls.py_** is a Python 3 script that connects to the AirSim module running along Unreal Engine 4, sets up a local server, listens for RX data from **_ManualController_**, and then calls AirSim's internal APIs to forward the commands and thus control the virtual drone as if real.

One might wonder why so much trouble setting up local servers and passing data via sockets. well, This code is a part of a greater project, where I needed to control a Real Drone, via a PC itself. This ManualController was developed to just test all the protocols and APIs involved. And to test the offboard side of things, I created a simple 'Drone Emulating' server, which mimicked the Drone's APIs that I had developed, but instead of commanding a real drone, commanded a virtual one in Unreal Engine itself. I thought this can be useful for someone as a standalone system itself, thus this.
The overhead of data transfers isn't significant as compared to the main bottleneck, which is the Reciever to Arduino communication, which can't be optimized.
Still, Suggestions, Bug alerts and possible fixes as well as any optimization you well are welcomed, Do open a pull request.

The overhead of data transfers isn't significant as compared to the main bottleneck, which is the Receiver to Arduino communication, which can't be optimized.
Still, Suggestions, Bug alerts and possible fixes as well as any optimization you well are welcomed, Do open a pull request.
2 changes: 1 addition & 1 deletion Real Drone/ControlServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ControlServer
CreateChannel(portBase + 5, 5); // Aux2 is 5*/
// We Create six channels, each corresponding to six basic controls of drone

// We would then create serveral threads, which would in turn listen to sockets
// We would then create several threads, which would in turn listen to sockets
LaunchListenerThreads();
}
~ControlServer()
Expand Down
2 changes: 1 addition & 1 deletion Real Drone/SPI/SPIdrivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define SPI_SPEED 1000000

/*
SPI Drivers, to send and recieve data packets over SPI
SPI Drivers, to send and receive data packets over SPI
*/

int SPI_init(char* file);
Expand Down
2 changes: 1 addition & 1 deletion Real Drone/test/test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ISR(SPI_STC_vect)
{
Serial.println("Got...");
//buff[0] = g;
SPDR = ACCEPT_SIGNAL; // Recieved Signal
SPDR = ACCEPT_SIGNAL; // Received Signal
index = 0;
process = false;
}
Expand Down