*Dear Luning,*
I could fix the Q1.
Thank you!

Best regards,
Shunya

2023年6月20日火曜日 13:42:29 UTC-5 [email protected]:

> Hello Shunya,
>
> I took a look at these two lines,
> render_step_size = 1.0 / 100
> render_steps = math.ceil((1.0 / render_step_size) / step_size)
> the render_steps will be ceil(100/step_size), which means an image is 
> written every (100/step_size) time steps. 
>
> You probably want to do something like,
>
> render_steps = math.ceil((render_step_size) / step_size)
>
> Thank you,
> Luning
> On Monday, June 19, 2023 at 4:15:20 PM UTC-5 Shunya wrote:
>
>> Thanks both of you!
>> I would like to ask an additional question.
>>
>> About Q1:
>> I entered the code you gave me, but only the first render was saved.
>> I saved the code to an image, and I need some advice.
>>
>> About Q2:
>> I would like the acceleration for each calculation step to be added in 
>> csv during the simulation.
>> In the current code (image), only the latest acceleration is saved in csv.
>> This question is far from PyChrono, but I would like to get some advice 
>> on how to implement it.
>>
>> Best regards,
>> Shunya
>>
>> [image: スクリーンショット 2023-06-19 161104.png]
>>
>> 2023年6月16日金曜日 16:38:08 UTC-5 [email protected]:
>>
>>
>> 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/d3f3328d-88b1-4fd0-80d9-3f4ecb4d0623n%40googlegroups.com.

Reply via email to