For Q1, there's an API, WriteImageToFile(filename) , for taking a snapshot
of the irrlicht visualization at each rendering frame, then you can stitch
together the pictures to make a video.
vis.BeginScene()
vis.Render()
vis.EndScene()
if (steps % render_steps == 0):
filename = 'img_'+ str(render_frame).zfill(4) +'.jpg'
vis.WriteImageToFile(filename)
render_frame += 1
Thank you,
Luning
On Friday, June 16, 2023 at 4:24:35 PM UTC-5 Nevindu Batagoda wrote:
> Hello Shunya,
>
> For Q2, I don't believe there is a direct API call to do this but what you
> can do is,
>
> 1. Push a data access filter for the IMU (either for the
> accelerometer, gyro, or magnetometer) after constructing it. Ex: acc
> .PushFilter(sens.ChFilterAccelAccess())
> 2. Then during the simulation loop, access the IMU data and publish
> them into a CSV file. Here is an example of accessing and printing
> accelerometer data,
>
> while (ch_time < end_time):
>
> # Access the sensor data
> acc_data = acc.GetMostRecentAccelBuffer()
> # Check data is present
> # If so, print out the max value
> if acc_data.HasData():
> print("Accelerometer:",acc_data.GetAccelData().shape,"max:",np
> .max(acc_data.GetAccelData()))
>
> A full demo can be seen here:
> https://github.com/projectchrono/chrono/blob/main/src/demos/python/sensor/demo_SEN_sensors.py
>
> Let me know if there's anything else.
>
> Best,
> Nevindu M. Batagoda
> On Friday, June 16, 2023 at 3:28:16 PM UTC-5 Shunya wrote:
>
> *Dear all,*
> I hava two questions about PyChrono's API.
> Q1:Is it possible to record video of the simulation using PyChrono's API?
> Q2: Is it possible to save IMU data to CSV using PyChrono's API?
>
> Background of questions:
> I am making the vehicle runnning model in PyChrono, referring to
> "demo_MBS_tracks.cpp".
> I would like to save the data from IMU to CSV in order to check the
> running status.
> And I would like to save the video of the nehicle running in the
> simulation.
>
> Best regards,
>
>
--
You received this message because you are subscribed to the Google Groups
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/projectchrono/54539b9d-d225-4bac-b352-7f014228a516n%40googlegroups.com.