I guess, finally I reached the result. I used only accelerometer sensor to give a message to the driver that 'You Started Driving'. For that I did two things. 1) Check if a person was not driving before he begins to drive. ie, 1.a) Confirm first that the driver was not driving 1.b) Confirm second that driver is driving. Now play an audio message as 'You started Driving'. (Numerical values set in this example are only for experimental purpose).
If there is any unnoticed error or if there is better idea, please share here.
NOTE: Only Player 3 audio has volume and all other players are muted. And, Player 1 audio file length is very short, may be around or less than a second. Short audio file in player 1 is given , so that the player 1 will be completed quickly to proceed further tasks.
I tried location sensor by being inside home. It is taking time to update the value. My plan for these blocks is to give immediate message to the driver that 'You started to drive' as quickly as possible.
Because of the delay in location sensor, I ignored it temporarily because the purpose is to give quick message.
Yes, we have to check distance as well to differentiate Jump Rope and driving. I will work on it.
I guess, if we check the stability of the speed then we can differentiate if a person 'started to drive' from his/her 'other actions'. This can be done by using accelerometer sensor itself, I guess.
And, I found an error, there are x axis, y axis and z axis values for accelerometer. In this example, I set the x axis value. That is Forward movement of phone. But, while driving people may keep their phone in different position. So, I am going to create blocks to detect speed in any direction and then say 'You Started to Drive'. Yes, there will be the disadvantage that you mentioned.
I have a doubt about sensors. If we use sensors like accelerometer, we can see options like x axis, y axis and z axis directions in both forward and backward, up and down etc. My question is that will the direction reading for x axis got changed when user change the position of his phone? ie, if a phone is kept on a table by facing the display up, then there will be default x axis (x accel), right? My question is if I put the phone upside down, will the x axis position also get changed or the sensors can maintain the x axis direction even if user change the position of the phone as his wish?
UPDATE:
I saw this,
AccelerometerSensor
Non-visible component that can detect shaking and measure acceleration approximately in three dimensions using SI units (m/s2). The components are:
xAccel: 0 when the phone is at rest on a flat surface, positive when the phone is tilted to the right (i.e., its left side is raised), and negative when the phone is tilted to the left (i.e., its right size is raised).
yAccel: 0 when the phone is at rest on a flat surface, positive when its bottom is raised, and negative when its top is raised.
zAccel: Equal to -9.8 (earth’s gravity in meters per second per second when the device is at rest parallel to the ground with the display facing up, 0 when perpendicular to the ground, and +9.8 when facing down. The value can also be affected by accelerating it with or against gravity.
I think, if we create blocks in such a way to compare the 1) current latitude & longitude value with 2) past latitude & longitude, for every given time interval, we can calculate the distance and speed as well using this extension.
Let me check, how quickly the extension will provide the reading updates.
I am not satisfied with this sensor (ACCELEROMETER), because even if i kept the phone on table without moving it, it is showing values around 10 in one or two of axis. And, when I check in google to covert this value (m/s2) into km/hr, it says to multiply with 3.6. So, if we do calculation, the speed is 3.6 * 10 = 36 km/hr when I simply keeping it in table. GUIDE ME GEEKS.
UPDATE: I can guess that approximately 10 is the base value of accelerometer sensor in all positions. ie, if I keep my phone on table, y axis value is going to around 10 or -10, if i keep my phone vertically z axis values are behaving like this around -10 or + 10 and the same to x axis in other position.
UPDATE 2: If I use orientation sensor to detect the phone position, then I may be able to focus only on specific axis value of accelerometer to check the speed.
@Taifun, just before now I started driving my two wheeler with the app ON (I was screen recording to know the raise and fall of accelerometer values x, y and z.). I was driving at around 40 km/hr speed. I don't see big raise in accelerometer values. I was expecting that the value of some axis (x or y or z) will increase when the bike speed increases.
The accelerometer can't tell if its acceleration spike is caused by you hitting a bump or pot hole in the road, versus you pressing the gas or brake pedals.
To allow such differentiation, you would need to clamp the phone to the car, pointing it correctly.
May I know why accelerometer sensor is also functioning like orientation sensor, ie, If I change the position/angle of phone, both sensors are showing some fixed values (even if the phone is fixed somewhere without giving any further movement). But, I expexted that accelerometer will give values based on how fast the device is moved in x or y or z axis. Right now, I can't find differences between both sensors, Both sensors are giving some fixed values for each phone position/angle.
MY EXPECTATION:
Accelerometer sensor must be in 0 (or some initial value) when it is in rest regardless of the phone's position or angle. Now, when the phone moved in any angle, the value of that angle must go up. This is what I expected.
How can I loop the 'Orientation sensor block' and 'Accelerometer sensor block', so they will check the changes each other and perform accordingly consistently.
Right now the blocks within acceleromer block are functioning only one time without repetition. ie, these blocks are not going back and checking the players named as player5Roll and player5Pitch.