• Welcome to PiBoSo Official Forum. Please login or sign up.
 
May 04, 2024, 05:22:57 AM

News:

GP Bikes beta21c available! :)


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - D4rw1n

16
Is this dragstrip available already?
17
I'm currently looking for such track so much as well. Need something to enable trying a simulator platform and check behaviour at low speed but with a higher surface than a track, a bit like a parking or airport.
18
Plugins / Re: UDP Proxy
April 18, 2019, 11:31:05 AM
@Piboso:
I have updated my code that is pulling matrix elements from the payload with offsets as you have shown in your last post, but I keep getting different angle values between what is given from m_fYaw, m_fPitch and m_fRoll offsets and what I calculate from the matrix.

Example:

Condition: Motorcycle at rest (vertical, stopped).

m_fYaw, m_fPitch & m_fRoll I get:
Yaw: -37.37
Pitch: 1.32
Roll: -2.51

Whilst matrix I get is:

[ 0.79   -0.04   0.61 ]
[ 1.00   0.04    1.32 ]
[ 0.79   -2.51   0.06 ]

Considering that following elements:
[ R11 R12 R13 ]
[ R21 R22 R23 ]
[ R31 R32 R33 ]

are mapped like so:

R11 @offset 73
R12 @offset 85
R13 @offset 97
R21 @offset 77
R22 @offset 89
R23 @offset 101
R31 @offset 81
R32 @offset 93
R33 @offset 105


I'm using these references to calculate angles from the matrix:

http://nghiaho.com/?page_id=846
http://planning.cs.uiuc.edu/node102.html
http://planning.cs.uiuc.edu/node101.html#fig:yawpitchroll

Taking for instance X (roll) with values from the example matrix above:



with R32 = -2.51 & R33 = 0.06, I get 178.63 degrees for Roll (used https://planetcalc.com/7954/).
That does not fit the -2.51 degrees I get from m_fRoll.


See also a screenshot attached with all other values.


I feel I'm missing something somewhere, but can't find what  :o  :-\

EDIT: don't pay attention to suspension length, forgot to multiply it by 1000 (i.e. right now it is displayed in meter unit)
19
Plugins / Re: UDP Proxy
April 18, 2019, 10:20:51 AM
Yep ethernet shield will enable you to directly get UDP packets to your arduino.

Based on other experiments, you would get a ~3mbits limitation due to arduino's microcontroller. That is more than enough for your application.
Check https://www.reddit.com/r/arduino/comments/9qn2fx/max_transfer_speed_possible_for_the_ethernet_2/

You should find such shield around 5 dollars on aliexpress.

Also, check you private messages ;)
20
Plugins / Re: UDP Proxy
April 18, 2019, 07:24:22 AM
@poupou: For that, you will need to add an ethernet shield on your arduino and follow that example to capture UDP packets: https://www.arduino.cc/en/Reference/EthernetUDPRead

Another way (cheaper) would be to create a local program (for instance in python) that captures the telemetry data from UDP on the localhost and forward it straight away on the serial port to the arduino.

Keep in mind typical baud rate used on serial com port for arduino is 115200bps.
UDP payload of telemetry being 220bytes by default (more if you enable some options), it's 1760 bits per packet payload.

Dividing 115200 by 1760, you get a max rate of ~65x telemetry snapshots per second (it could even be less as you have some overhead on the serial bus).

So keep this in mind while setting up your proxy_udp.ini file.
I'd lower the frames per second to 50 max. That means 20ms, or 2 hundredths of a second.

Your proxy_udp.ini file should be set as followed:

[params]
(rest of the config as you want)
delay = 2

EDIT: There are higher baud rates values possible on arduino, you might need to check some of following links:
https://forum.arduino.cc/index.php?topic=98364.0
http://forum.arduino.cc/index.php/topic,61381.msg444421.html#msg44442
https://www.quora.com/What-is-the-baud-rate-and-why-does-Arduino-have-a-baud-rate-of-9-600


@Piboso: Thanks for the clarification. Will look at the result and come back if I have more questions.
21
Plugins / Re: UDP Proxy
April 07, 2019, 07:34:56 AM
Hi,

I'm trying to figure out how to read/understand following data from UDP payload:

float m_aafRot[3][3]; /* rotation matrix of the chassis. It incorporates lean and wheeling */

When reading data at offsets 73,77,81,85,89,93,97,101,105, I get such matrix (motorcycle idle, perpendicular to ground, 0 km/h):

Rotation chassis matrix
[-0.53] [-0.05] [0.85]
[-0.04] [1.00] [0.03]
[-0.85] [-0.02] [-0.53]

I'm not an expert in algebra but I have some knowledge though. Reading through Wikipedia page (https://en.wikipedia.org/wiki/Rotation_matrix), I'm unsure whether I'm decoding the values in the wrong order (rows/columns) or whether it's a special matrix shape I don't see in wikipedia.

Could someone clarify how to:
1) read the 9 values in the correct order for display it in 3x3 matrix (like shown in wikipedia)
Does that reflect Ry in following picture?

If so, how could this be lean + wheeling? My current understanding is that lean would be one of the 3 R{x,y,z} and wheeling another one of them.

2) how to summarise the meaning of such values? I'm looking to know whether this can be handful for a motorcycle simulator platform (6DOF or something else) or is it just a different way to express values already gathered in a different shape, such as:
float m_fYaw,m_fPitch,m_fRoll;                           /* degrees, -180 to 180, offsets 109,113,117 */

Thanks in advance for any information!


FYI this is my python code that displays the matrix:

tm_rot_chassis = struct.unpack_from("fffffffff", data, offset=73)
print("Rotation chassis matrix\n"\
"[{v1:.2f}] [{v2:.2f}] [{v3:.2f}]\n"\
"[{v4:.2f}] [{v5:.2f}] [{v6:.2f}]\n"\
"[{v7:.2f}] [{v8:.2f}] [{v9:.2f}]\n"\
.format(\
v1=tm_rot_chassis[0], v2=tm_rot_chassis[1], v3=tm_rot_chassis[2],\
v4=tm_rot_chassis[3], v5=tm_rot_chassis[4], v6=tm_rot_chassis[5],\
v7=tm_rot_chassis[6], v8=tm_rot_chassis[7], v9=tm_rot_chassis[8]\
))