Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with current OpenSim #8

Open
RTnhN opened this issue Dec 12, 2023 · 18 comments
Open

Does not work with current OpenSim #8

RTnhN opened this issue Dec 12, 2023 · 18 comments

Comments

@RTnhN
Copy link

RTnhN commented Dec 12, 2023

If you want to try to replicate this without the custom OpenSenseRT RPI image, it will not work. The ikSolver.addOrientationValuesToTrack method was removed in favor of the BufferedOrienationReference.putValues method. Until this PR, there were some problems for the API, but those should be fixed now. You should be able to run it with the following changes to the ik_streaming.py file:

# Was line 97
oRefs = osim.OrientationsReference(orientationsData)

# Is 
oRefs = osim.BufferedOrientationsReference()
rowVecView = orientationsData.getNearestRow(0)
rowVec = osim.RowVectorRotation(rowVecView)     
oRefs.putValues(0, rowVec)

# Was line 97 (actually line 154)
ikSolver.addOrientationValuesToTrack(time_s+dt, rowVec)

# Is
oRefs.putValues(time_s+dt, rowVec)

I can make this into a PR.

@Hari-techi-96
Copy link

Hari-techi-96 commented Dec 14, 2023

hi @RTnhN After making these changes to the ik_streaming.py file and As per #3644 i made changes to BufferedOrientationReference.h file, i still got an error

Traceback (most recent call last):
  File "/home/raspi/VR/RealTimeKin/ik_streaming.py", line 101, in <module>
    oRefs.putValues(0, rowVec)
  File "/usr/local/lib/python3.10/dist-packages/opensim-4.5-py3.10.egg/opensim/simulation.py", line 34527, in putValues
    return _simulation.BufferedOrientationsReference_putValues(self, time, dataRow)
TypeError: in method 'BufferedOrientationsReference_putValues', argument 3 of type 'SimTK::RowVector_< SimTK::Rotation > const &'

and ikSolver.addOrintationValuesToTrack(time_s=dt, rowVec) was in line 154.

@RTnhN
Copy link
Author

RTnhN commented Dec 14, 2023

Hi @Hari-techi-96, how are you installing/building opensim? When built, the test suite checks if you can append data to the oRef object: opensim-org/opensim-core@e9c4930

@Hari-techi-96
Copy link

Hi @RTnhN i build Opensim in ubuntu 22.04.3 LTS version for my raspberry pi 4B with this instruction. I got suggestions from this repo for troubleshooting. This "test_BufferedOrientationReferencePut()" method was not their in that test_opensense.py file but i added it after going through this link but i didn't run that file after editing. What do i need edit to solve that error?

@RTnhN
Copy link
Author

RTnhN commented Dec 14, 2023

Hi @Hari-techi-96, if you run the shell script to set up OpenSim, there should be no files to edit. It pulls the main branch which has the needed changes. When you "made changes to BufferedOrientationReference.h", you just changed that file, right? You did not do any rebuilding of OpenSim, right? I think the problem is not really in that file, but it is in the interface that SWIG makes based off of that file.

I think the best bet would be to delete any directories that the OpenSim installer made and rerun the script to completely rebuild OpenSim. I know that it is a bummer to wait the 4+ hours for it to build, but I think a clean build is the best way to get it working.

@Hari-techi-96
Copy link

@RTnhN Thanks for suggestion I'll try this, can you provide any link where i can get the modified instructions for the New build.

@RTnhN
Copy link
Author

RTnhN commented Dec 14, 2023

@Hari-techi-96 You can use the same instructions that you found here. Just delete the folders that OpenSim created and follow the instructions again.

@Hari-techi-96
Copy link

@RTnhN Thankyou so much the changes after the re building of opensim actually worked.

@RTnhN
Copy link
Author

RTnhN commented Dec 16, 2023

Glad to hear @Hari-techi-96 ! Thanks for coming back to this issue and letting us know.

@Hari-techi-96
Copy link

hi @RTnhN, the ik_streaming.py ran and it generated raw_imu.npy , timestam.npy and recording.sto files but as per the instructions given in this page the ik_streaming.py file didn't generated the .mot files which is used to visualize the output in opensim.exe . So how should i get the visualization?

@RTnhN
Copy link
Author

RTnhN commented Dec 22, 2023

Hi @Hari-techi-96, I have not gotten that far yet. You do have visualization enabled on line 34, right?

Actually, I think that maybe the instructions are outdated. Mot files are legacy. Maybe you might be able to just use the .sto file.

@Hari-techi-96
Copy link

Hari-techi-96 commented Jan 1, 2024

hi @RTnhN sorry for the late replay , i didn't had access to my hardware from the past few days, but today i got the hardware, as you said .mot is legacy and .sto file will work in the opensim . I'm working with 3 IMUs one attached to pelvis and one to left shank and another to left thigh. But in the .sto file i got only one data with timestamp as shown in the below image.
Screenshot (33)
and if i enable visualization on line 34 , the visualizer just pops up and no movement is detected in the simulation.
Button,Pelvis,L_thigh,L_shank, 1,0,9,9, 60 online test_6 500 ISM330DHCX
This is my setting.txt file. i connected the sensor to mux port of 0,6,7 even if i change 1,0,9,9 to 1,0,6,7 same output.

@RTnhN
Copy link
Author

RTnhN commented Jan 2, 2024

Hi @Hari-techi-96, it might be a good idea to test the hardware first to make sure that you are getting the IMU data correctly. I am actually using different hardware, so I can't help much with the specifics.

@Hari-techi-96
Copy link

I tested the same hardware with different code for collecting IMUs data , it is working . But when i run this ik_streaming.py i don't get any data in the output. Anyway thanks for the Help.

@RTnhN
Copy link
Author

RTnhN commented Jan 3, 2024

I tested the same hardware with different code for collecting IMUs data , it is working . But when i run this ik_streaming.py i don't get any data in the output. Anyway thanks for the Help.

I actually realized that I am having the same problem too. I think the problem is that the names of the segments is not being loaded into the IK. This will take some time to debug though.

@Hari-techi-96
Copy link

can you suggest any alternatives for simulating the IMU data with model?

@RTnhN
Copy link
Author

RTnhN commented Jan 5, 2024

can you suggest any alternatives for simulating the IMU data with model?

No, not really. I am trying Swig 4.2.0 that came out a couple days ago. I might be able to rerun and generate better bindings that work. I think that this version of swig fixes that problem.

@Hari-techi-96
Copy link

No, not really. I am trying Swig 4.2.0 that came out a couple days ago. I might be able to rerun and generate better bindings that work. I think that this version of swig fixes that problem.

If this works can you just let me know how to update Swig 4.2.0.

@cpchandrasekharan
Copy link

Dear Sir

I hope this message finds you well. My name is Chandrasekharan, and I am currently pursuing my research at NIT Calicut. I am planning to collect data for my research using OpenSenseRT.

While setting up OpenSenseRT on my Raspberry Pi, I encountered some issues. After flashing the OpenSenseRT image to the SD card and booting the Raspberry Pi, I see the error message shown in the attached figure.

To resolve this, I copied start4.elf and fixup4.dat files from an updated Raspberry Pi image to the OpenSenseRT SD card. However, after this step, nothing is displayed on the monitor, and the system does not boot.

I would appreciate your guidance on resolving this issue. Is there a specific step I might have missed, or are there additional configurations required for Raspberry Pi 4 model?

Thank you for your time and for creating this wonderful tool. I look forward to your advice.

Best regards,
Chandrasekharan
Screenshot 2024-12-03 135827

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants