Yash Naidu
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 2/7/2024 in #middleware-and-os
Converting Real-World Objects to 3D Models
In my exploration of transforming real-world environments into simulations for Extended Reality (XR), I've identified a series of steps that can facilitate the creation of 3D models. Here are the steps that i followed to achive it :
Requirements
- A mobile device (though a DSLR camera is preferable for higher quality)
- A depth camera (optional, but beneficial for capturing depth information)
Step 1: Data Collection
The initial challenge lies in data collection. To ensure the best results:
- Position the object in a well-lit setting to avoid harsh shadows.
- Capture images from various angles without limiting the number of photos.
Use the following camera settings for optimal captures:
- ISO Settings: Keep it at 100 for minimal noise; avoid exceeding 800.
- Aperture: Maintain between f/9 and f/13 to ensure sufficient depth.
- Shutter Speed: Set to 1/200 or faster to minimize motion blur.
- White Balance: Set a fixed color temperature.
- File Type: Use JPG for convenience, or RAW/TIFF..
- Focus: Utilize autofocus for ease and consistency.
- Flash: Keep it off to prevent unnatural lighting.
Step 2: Image Editing
Refine the captured images by:
- Cropping to highlight the object.
- Enhancing highlights and sharpness to accentuate details.
- Adjusting contrast and brightness for clarity.
- Ensure the edges and features are distinct for the next step.
Step 3: Photogrammetry Process
Use Reality Capture, a tool that's free until the point of export, for the photogrammetry process.
Import the edited images from Step 2 and start the photogrammetry.
Step 4: Model Refinement
In the tool, make necessary adjustments to:
- Align images correctly.
- Register photos for accurate positioning.
- Determine the level of mesh generation for model detail.
- Apply texturing and coloring for realism.
Step 5: Exporting the 3D Model
The final 3D model is now ready to be exported to simulation engines like Unity or Unreal Engine for use in XR applications.
2 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 1/25/2024 in #middleware-and-os
Attacks in Embedded System.
Although I am not an expert in Embedded Security or Cybersecurity, I'm eager to share some insights I gathered in my study of Embedded Security.
As embedded systems increasingly implemented in various sectors and the demand for robust security grows, this post aims to outline common attack that are targeted in any device.
Buffer Overflow Attacks:
Buffer overflow attacks occur when a program writes more data to a buffer than it can hold. This can lead to adjacent memory spaces being overwritten, potentially allowing an attacker to execute arbitrary code. Embedded systems often have limited memory resources, making them particularly susceptible to such attacks.
Denial-of-Service (DoS) Attacks:
DoS attacks aim to make a device or network resource unavailable to its intended users. In the context of embedded systems, this could mean overloading a networked device with traffic, or sending it commands at a rate faster than it can process, causing the system to crash or become unresponsive.
Fault Injection Attacks:
These attacks involve deliberately causing faults in a system to study its responses. These faults can be induced through various means like voltage spikes, temperature variations, or clock glitches. The aim is to cause the system to malfunction in a way that compromises security, such as bypassing a security check or revealing sensitive information.
Side-Channel Attacks:
Side-channel attacks exploit physical implementations of a system rather than weaknesses in the algorithms themselves. These attacks observe patterns in power consumption, electromagnetic leaks, or even sound to extract confidential data, especially cryptographic keys. Examples include Differential Power Analysis (DPA) and Electromagnetic Analysis (EMA) attacks.
3 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 1/25/2024 in #code-review
Swap Odd and Even Bits
Write a C function to swap all odd and even bits in an unsigned integer. Bit positions 0, 2, 4, ... are considered even bits, and positions 1, 3, 5, ... are odd bits.
Ex input: 10101010 (in binary),
Expected O/P: 01010101.
It may look simple at first, well, like just outputting its complement, but is that right?
What if the input is 11010010?
How would you proceed with this question?
4 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 1/3/2024 in #middleware-and-os
Lidar photogrammetry Pipeline for a 3D model
Hi,
I am working on generating a 3D model from Lidar data and Images. I am unclear about the pipeline on how it works. If anyone has experience with this, could you please share about the pipeline?
Example:
Step 1. Gather point cloud data from Lidar and capture images.
Step 2. Registration
...
Also, any information about how to get started with Photogrammetry will be helpful.
Please also to mention about the tools that needs to be used in each stage of the pipeline.
Thanks
1 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 11/28/2023 in #code-review
Find the bug
#include <stdio.h>
#include <stdlib.h>
int main() {
int *array = malloc(5 * sizeof(int));
int i;
for (i = 0; i <= 5; i++) {
array[i] = i * 2;
}
printf("Array values:\n");
for (i = 0; i < 5; i++) {
printf("%d\n", array[i]);
}
int value = 10;
int result = value / (5 - i);
free(array);
return 0;
}
Expected output:
0
2
4
6
8
23 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 11/28/2023 in #code-review
Reverse words without using any library method.
Reverse words in a given sentence without using any library method.
What to Do : Invert the order of words in a given sentence, maintaining the order of characters within each word. (e.g.: I/P: "Hello Word" ,O/P: "World Hello")
What to Do : Invert the order of words in a given sentence, maintaining the order of characters within each word. (e.g.: I/P: "Hello Word" ,O/P: "World Hello")
66 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 11/28/2023 in #middleware-and-os
Understanding the Compiler Optimization Flags
Here is a quick write up on the Compiler Optimization flags we use.
O0: The Bare Bones
At O0, the compiler’s role is straightforward: translate the source code into machine code with minimal intervention. This level avoids any changes that could alter the code’s behavior, making it an ideal setting for debugging.
O1: The Initial Enhancements
- Dead Code Elimination: Removing parts of the code that never execute.
- Basic Loop Optimization: Simplifying loops where the number of iterations is known beforehand.
- Function Inlining for Small Functions: Replacing function calls with the function's actual code when the function is small, reducing call overhead.
O2: The Performance Gear
O2 is where significant performance enhancements kick in, including:
- Advanced Loop Optimizations: Such as loop unrolling (expanding loops to reduce the number of iterations) and loop fusion (combining similar loops).
- Instruction Scheduling: Rearranging instructions to avoid CPU stalls and make better use of instruction pipelines.
- Constant Propagation: Replacing variables that act as constants with their actual values to reduce computation.
O3: Maximum Throttle
O3 extends O2 optimizations with a focus on speed, employing strategies like:
- Aggressive Loop Unrolling and Vectorization: Further enhancing loop processing efficiency by using vector operations.
- Cross-Module Inlining: Inlining functions across different modules or files.
- Advanced Instruction Scheduling: Further optimization for CPU pipeline efficiency.
Ofast: Breaking the Boundaries
Ofast disregards standard compliance for speed. It includes all O3 optimizations plus:
- Ignoring Strict Overflow Rules: This allows certain assumptions for integer overflows, which can speed up arithmetic operations but might lead to undefined behaviors.
- Fast Math Operations: Assumes associative and commutative properties in floating-point operations, which isn't always accurate but faster.
5 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 11/26/2023 in #middleware-and-os
Loop Unrolling in Compilers
Loop unrolling is a fundamental compiler optimization technique that has significant implications in the performance of programs, especially in systems based on the RISC-V architecture. This technique involves expanding the loop body multiple times in the compiled code, reducing the loop's iteration count. The RISC-V instruction set, known for its simplicity and efficiency, offers an exemplary context to understand and leverage the benefits of loop unrolling.
In traditional loop structures, each iteration involves checking the loop condition and updating the loop counter. By unrolling, these operations are reduced, as multiple iterations of the loop body are executed in a single pass.
Unrolling a loop can expose more opportunities for parallel execution of instructions. RISC-V’s consistent instruction length and format enable efficient pipelining and execution, which is further optimized by spreading out dependent operations across the unrolled loop.
Loops involve branching, where the processor predicts whether to continue the loop or exit. Each iteration in a loop is a potential branch prediction. Unrolling reduces the number of iterations, thereby decreasing the number of branch predictions and potentially improving prediction accuracy.
While it presents challenges such as increased code size and the need for careful tuning, the benefits in terms of reduced loop overhead and enhanced parallelism make it a valuable tool in the optimization arsenal.
I Find that the loop unrolling, the compiler magic will keep the hardware pipeline busy and will have the best use of pipeline.
What's your view on this?
1 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 11/26/2023 in #pcb-and-analog
Virtualization in Embedded Systems
Why do we need it?
In the automotive industry, virtualization is pivotal in creating virtual test environments. Modern vehicles, equipped with cameras, radar, and LiDAR, continuously scan their environment, generating massive data streams.
Virtualization enables the simulation of real-world conditions in a controlled setting. Engineers can recreate complex traffic scenarios or hazardous conditions within a virtual environment, allowing for extensive testing of vehicle response and safety systems without physical risks.
This approach significantly accelerates development cycles and enhances the safety features of autonomous vehicles.
Virtualized Sensor Networks:
For environmental monitoring, virtualization helps in managing vast sensor networks. Embedded sensors deployed across various ecosystems can feed data into a virtual model of the environment.
This model can predict changes, simulate the impact of various factors, and aid in decision-making for environmental conservation. For instance, virtualized models of forest areas can help predict and manage forest fires, contributing to more effective environmental protection strategies.
Virtual Test Environments:
In the automotive industry, virtualization is pivotal in creating virtual test environments. Modern vehicles, equipped with cameras, radar, and LiDAR, continuously scan their environment, generating massive data streams.
Virtualization enables the simulation of real-world conditions in a controlled setting. Engineers can recreate complex traffic scenarios or hazardous conditions within a virtual environment, allowing for extensive testing of vehicle response and safety systems without physical risks.
This approach significantly accelerates development cycles and enhances the safety features of autonomous vehicles.
What are your views on this? Do you think the Embedded field should also focus more in this area? What has been your experience?
5 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 11/26/2023 in #code-review
Heap Metadata Inspector
Implement a function to inspect and print the metadata of the heap, like block sizes and free/used status.
(e.g.: I/P: Allocate 5, Free 2; O/P: Block 1: Used, Block 2: Free)
How to Do?
- Create a simulated heap with an array and metadata structures for each block.
- Upon allocation or freeing, update the block's metadata.
- Create a function to loop through the metadata structures and print out their status.
Example:
Your metadata might contain fields like isFree and blockSize. When you allocate 5 and then
free 2, your function could print out: Block 1: Used, size 5; Block 2: Free, size 2.
How would you tackle this problem? What actions, end cases, data types, algorithms would you be using while solving this?
Do Type out your Pseudo Solution.
2 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 11/26/2023 in #code-review
Creating a Segmented Memory Allocator
The Problem statement goes this way,
Create multiple fixed-size buffers (arrays) to act as segments.
(e.g.: I/P: Allocate 10 bytes in Segment A, Allocate 20 bytes in Segment B; O/P: Addresses
allocated in segments)
An top level view on how to Do?
- Create an array of structures, where each structure represents a memory segment with its
own memory buffer and stack top.
- Implement allocate and free functions that take an additional parameter to specify the
segment.
- Inside these functions, use the corresponding segment's stack top to allocate or free
memory.
- Update the stack top for the specified segment when memory is allocated or freed.
Example:
If you allocate 10 bytes in Segment A and 20 bytes in Segment B, each segment's stack top
should move accordingly.
How would you tackle this problem? What actions, end cases, data types, algorithms would you be using while solving this?
Do Type out your Pseudo Solution.
7 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 10/31/2023 in #pcb-and-analog
Exploring Devices to map a room.
I am currently exploring learning about unreal engine and integrating the LIDAR mapped points onto a simulator. For Mapping the room, what are your suggestions on which LIDAR to use? or is LIDAR the only option to map the room?
LIDAR would get the geometry of the object, what if i need to simulate even the color and the texture of an object (lets say, of a table in the room). Which device should i be using?
Any inputs are highly appreciated.
7 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 10/26/2023 in #middleware-and-os
Slow context switching in FreeRTOS?
Heard that FreeRTOS context switching time is usually longer than other commercially available RTOSs. There were suggestions that I heard from professionals that it might be due to the working of memory management. What is your take on this? How to optimize the memory management in FreeRTOS to improve the context switching time?
4 replies
DIIDevHeads IoT Integration Server
•Created by Yash Naidu on 10/21/2023 in #middleware-and-os
Seeking Recommendations: Tools for Whitebox Integration testing in Embedded Systems.
Hey everyone! I'mstarting to learn about whitebox integration testing for embedded systems. Can anyone recommend some effective tools or best practices in this area? I'd appreciate any insights or experiences you can share. Thanks in advance!
5 replies