Discussion of future Bullet Example contributions (Join us!)

benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Discussion of future Bullet Example contributions (Join us!)

Post by benelot » Tue Apr 19, 2016 12:27 pm

Hello guys!

I have been working with Bullet during my Master's Thesis (https://github.com/benelot/minemonics, a 3D virtual creature simulator) for about a year and I have collected some experience in implementing several basic and advanced things. Since I do not want to stop now, I would be willing to do some contributions to Bullet, probably beginning with Examples and Documentation more than core code, but I have no idea where to start. Is there a roadmap or a list of missing examples somewhere? I know that for issues, I can refer to the github issues, but I feel that they are a bit too advanced issues for a starting point. Any recommendations what else can be done?

Things that come to my mind as examples are:
-DoublePendulum Example (Chaotic movement, could be very interesting to see in a Bullet Simulation)
-A "fix your time step" example which works according to the wiki entry (Already implemented that in my simulator, but it could be nice as a bullet starter example)
-A space simulation (gravity from planets instead of simple (0,-9.81,0) gravity, (three body problem simulation for instance, another chaotic example)
-Single Rigid Body simulation vs. Featherstone simulation
-Single Rigid Body with different solvers to switch (Is that even possible? It would require to setup the world again when changing the options in the GUI)

Any comments on these ideas?

Furthermore I heard that there are some old examples that have not been ported yet, how can I find them and port them? Also how do I integrate a new example into the example browser? If I know how it is done, I could document it on the wiki. Just give me the chance to do something :)

Cheers,
Last edited by benelot on Sat Aug 13, 2016 8:52 am, edited 3 times in total.

User avatar
Erwin Coumans
Site Admin
Posts: 4189
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: [SOLVED] Discussion of future contributions and roadmap

Post by Erwin Coumans » Sat May 07, 2016 11:14 pm

bkeys totally messed up the discussion about improving the Bullet examples etc, so I decided to stop this non-constructive feedback and removed the topic.

I think it is a good idea to contribute examples. Note that examples can be executed as standalone (as a console application), standalone OpenGL and as part of the Example Browser.
bullet_example_framework.png
bullet_example_framework.png (239.45 KiB) Viewed 10581 times
Documentation in the wiki is welcome, and it would be good to review it and copy parts in the Bullet_User_Manual.pdf.

User avatar
Erwin Coumans
Site Admin
Posts: 4189
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: [SOLVED] Discussion of future contributions and roadmap

Post by Erwin Coumans » Sat May 07, 2016 11:18 pm

Mobeen wrote:
Thanks benelot for the help. I have already corrected formatting issues. Sure do edit as u feel appropriate.

The first tutorial is done. URL: http://bulletphysics.org/mediawiki-1.5. ... Simple_Box

Comments/Suggestions welcome :)

bkeys
Posts: 1
Joined: Sat May 07, 2016 11:22 pm

Re: [SOLVED] Discussion of future contributions and roadmap

Post by bkeys » Sat May 07, 2016 11:27 pm

Erwin Coumans wrote:bkeys totally messed up the discussion about improving the Bullet examples etc, so I decided to stop this non-constructive feedback and removed the topic.

I think it is a good idea to contribute examples. Note that examples can be executed as standalone (as a console application), standalone OpenGL and as part of the Example Browser.
bullet_example_framework.png
Documentation in the wiki is welcome, and it would be good to review it and copy parts in the Bullet_User_Manual.pdf.
:^)

Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: [SOLVED] Discussion of future contributions and roadmap

Post by Basroil » Sun May 08, 2016 3:42 am

Erwin Coumans wrote:bkeys totally messed up the discussion about improving the Bullet examples etc, so I decided to stop this non-constructive feedback and removed the topic.

Documentation in the wiki is welcome, and it would be good to review it and copy parts in the Bullet_User_Manual.pdf.
How would you propose we move forward with suggesting, submitting, and tracking progress of documentation/tutorials? I feel that PMs alone might be a bit restrictive and introduce quite a bit of inbox management headaches for those who don't check up every single day, but moving the discussions outside the forum entirely could introduce other issues.

There is a pretty intensive one I would like to submit on motorized joints for robotics that has been requested for a few years now. (The primary part is of course explaining in simpler terms how motorized joints work, robot simply being the example method. This is not actually covered in the bullet user manual however, so it might require additional feedback. )

teddy_salmon
Posts: 1
Joined: Sun May 08, 2016 4:38 am

Re: [SOLVED] Discussion of future contributions and roadmap

Post by teddy_salmon » Sun May 08, 2016 4:43 am

Erwin Coumans wrote:bkeys totally messed up the discussion about improving the Bullet examples etc, so I decided to stop this non-constructive feedback and removed the topic.

I think it is a good idea to contribute examples. Note that examples can be executed as standalone (as a console application), standalone OpenGL and as part of the Example Browser.

Documentation in the wiki is welcome, and it would be good to review it and copy parts in the Bullet_User_Manual.pdf.
If they can be run as a standalone application, how do you run them as standalone without a main function, or without the integration of the example browser? I think it would be more beneficial not to use the example browser in future examples.

Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: [SOLVED] Discussion of future contributions and roadmap

Post by Basroil » Sun May 08, 2016 5:01 am

teddy_salmon wrote:If they can be run as a standalone application, how do you run them as standalone without a main function, or without the integration of the example browser? I think it would be more beneficial not to use the example browser in future examples.
The examples themselves are independent of the application, and you can just copy the files into the basic example or gui basic example
For example, directly from app_basicexamplegui:

Code: Select all

int main(int argc, char* argv[])
{

	SimpleOpenGL3App* app = new SimpleOpenGL3App("Bullet Standalone Example",1024,768,true);
	
	OpenGLGuiHelper gui(app,false);
    
	CommonExampleOptions options(&gui);
	CommonExampleInterface*    example = StandaloneExampleCreateFunc(options);
        
	example->initPhysics();
...
StandaloneExampleCreateFunc and it's files are replaced by whatever example you want to be standalone. Eventually the documentation will reflect that, but you can see why this is actually helpful to both the user and documentation developers (who only need to make the example once regardless of GUI changes in the future).

benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Discussion of future contributions and roadmap

Post by benelot » Sun May 08, 2016 6:59 am

Erwin, so that means you deleted the whole roadmap we put together, the ideas I posted to remember etc. by deleting the other thread? I see, I have to make notes somewhere else :/

Luckily I made a copy of our roadmap to the wiki earlier. Next time, please make the thead read-only or so.

benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Discussion of future contributions and roadmap

Post by benelot » Sun May 08, 2016 7:39 am

Basroil, we now track the progress of our tutorials and demos here:

http://bulletphysics.org/mediawiki-1.5. ... /Tutorials

Except for that, I think we can either discuss things here or make separate threads called "[Tutorial] YourTutorialName" to not interfere with different tutorial examples. I would not go for PMs, because I think we do not want to keep things on a personal or private basis. It is better if others can comment your work as well in my opinion.

mobeen
Posts: 122
Joined: Thu May 05, 2011 11:47 am

Re: Discussion of future contributions and roadmap

Post by mobeen » Sun May 08, 2016 6:01 pm

I woke up today and saw the whole thread disappeared but thankfully benelot your roadmap from the wiki should keep us on track. OK I am done with the following tutorials:

Getting Started
Understanding ExampleBrowser framwork
Simple Box
Multiple Boxes
Picking

I am now currently on the SimpleJoint tutorial. I hope to finish my part by this week. Awaiting response on the content so far from others.

User avatar
Erwin Coumans
Site Admin
Posts: 4189
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Discussion of future contributions and roadmap

Post by Erwin Coumans » Sun May 08, 2016 7:34 pm

Excuses for deleting the thread, I should have locked it instead but it cannot be undone. I'll be more careful next time.

Examples can be used standalone with very few dependencies, but you will have to look at the build file
(CMakeLists.txt or premake) to see where all the required files are located.
Examples are not really written to be copied into some other game engine or demo framework, but we could make it easier:

Of course we could duplicate all files needed for an individual example/tutorial in the same folder.
For example, I moved the files from the objImportDemo in one folder in a separate bitbucket repo:
https://bitbucket.org/erwincoumans/stan ... ImportDemo
Originally the same files are spread over various folders (ignore BasicDemo and HelloWorld, they are unused).
https://bitbucket.org/erwincoumans/stan ... ImportDemo

I don't view merging files from multiple folders into a single folder as 'removing dependencies'.

If we would copy all required files for each example/demo in its own folder, there would be a huge amount of duplication, which is not a good idea I think. An alternative is to move parts of the examples/tutorial that are truly reusable (in other graphics/game engines) into a few libraries, for example an BulletImporter library, that can load meshes (.obj, .dae. .stl, .ply), images (.png, .tga ) and rigid bodies (.urdf, .sdf).
Would that help?

Over the upcoming years, I expect there to be hundreds of examples (tutorials etc), so the Example Browser will be the only reasonably way to let developers explore all features of Bullet. If you have to start each example individually that is very inefficient. Still, it is good for people to have the option to run and investigate an individual example outside of the Example Browser.
benelot wrote: Things that come to my mind as examples are:
-Single Rigid Body simulation vs. Featherstone simulation
The URDF import demo can setup a world in either Rigid Body + TypedConstraint or btMultiBody.
benelot wrote: -Single Rigid Body with different solvers to switch (Is that even possible? It would require to setup the world again when changing the options in the GUI)
Yes, you can switch the constraint solver, the ExampleBrowser/Vehicles/ForkLift is an example of this. It may not be enabled at the moment (switching used to work in a previous build).
basroil wrote: There is a pretty intensive one I would like to submit on motorized joints for robotics that has been requested for a few years now.
There are various examples in the Example Browser that allow motorized robots, loading the robot from a .urdf file, using btMultiBody (or btRigidBody+btTypedConstraint, but those joints would be less rigid with the default PGS LCP constraint solver at 10 iterations, hence most prefer Featherstone btMultiBody). See for example ExampleBrowser/InverseDynamics/Inverse Dynamics URDF example that lets you control a KUKA arm. Also the ExampleBrowser/Importers/ImportURDF/URDF (MultiBody) allows you to see the target velocity (using a velocity motor contraint). We have tested this for robotic arms, robot vehicles and humanoid / biped robots and it works very well.

I merged Mobeen's by hand here, there are no standalone CMakeLists.txt files for those yet.
https://github.com/bulletphysics/bullet3/pull/620

Thanks for the help!

Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Discussion of future contributions and roadmap

Post by Basroil » Mon May 09, 2016 5:06 am

Erwin Coumans wrote:There are various examples in the Example Browser that allow motorized robots, loading the robot from a .urdf file, using btMultiBody (or btRigidBody+btTypedConstraint, but those joints would be less rigid with the default PGS LCP constraint solver at 10 iterations, hence most prefer Featherstone btMultiBody). See for example ExampleBrowser/InverseDynamics/Inverse Dynamics URDF example that lets you control a KUKA arm. Also the ExampleBrowser/Importers/ImportURDF/URDF (MultiBody) allows you to see the target velocity (using a velocity motor contraint). We have tested this for robotic arms, robot vehicles and humanoid / biped robots and it works very well.
Yes, I'm aware of the examples. However, I have had some complaints from graduate students complaining that those are difficult to understand in a short time. Mixing urdf, multibody, and inverse dynamics all in one may be a bit much to spring on people, especially if they aren't looking for perfect robot control and an all-in-one solution. I'm currently suggesting people try the old motor control demo, but that one again lacks a full explanation of how motors work.

I was thinking something on the lines of a simple RRR or RRP (we can call them "backhoes" to match the forklift demo if calling it a "robot" is the issue) configuration to explain the relationship between max torque and desired velocity in standard (non-multibody) constraints, and likely how to have offsets (start at joint angle != 0). Not everyone needs purely torque based control after all, and in some cases it's actually a detriment to understanding the device ("smart servo" based toys/robots/etc especially, since they don't actually have torque input). I'll make a small write-up to go along with the files and link it all in a new thread. If it's beneficial to the community as a whole, good, if not at least I know the graduate students in my lab will use it and it won't go to waste.

I'm glad your team was able to test the multibody simulation with real-world examples with good results, some universities have been having issues with their own multibody systems not living up to the theoretical improvements over other methods. I saw that the google team is expanding their robot group a bit, so I assume we'll see even larger emphasis on high quality robot simulation using the engine (and hopefully overtaking ODE as the go-to solution).

benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Discussion of future contributions and roadmap

Post by benelot » Mon May 09, 2016 11:33 am

I would love to see some programmatic setups of more complex robots as well. URDF is very cool and definitely the way to go to design and run robots, but to learn how to build one from scratch, I think it would be interesting to get an example from Basroil. Also, if you want to get 100s of examples in the browser, you should allow some variety on the same type of example. Especially for learning, variety really makes sense to me, because one example might show something better than another. I like examples that do one thing well (Unix-style). Especially on the higher order examples, I would prefer to have more of these examples.
Erwin Coumans wrote: An alternative is to move parts of the examples/tutorial that are truly reusable (in other graphics/game engines) into a few libraries, for example an BulletImporter library, that can load meshes (.obj, .dae. .stl, .ply), images (.png, .tga ) and rigid bodies (.urdf, .sdf).
Would that help?
I think it would be a good idea to have a BulletImporter library at some point. That sounds like a good idea to go, making bullet include other formats, hence simplifying the use of data representations from other engines. For other truly reusable parts, yes of course.

Basroil, we could also port the old motor control demo and some other old demos and improve them. As soon as I have Erwin's spreadsheet, I can start doing that as well. I had some problems understanding the older demo's setups, but I will get there in time.
Erwin Coumans wrote: Yes, you can switch the constraint solver, the ExampleBrowser/Vehicles/ForkLift is an example of this. It may not be enabled at the moment (switching used to work in a previous build).
Cool, I will try to find out how it is done. I think a demo having multiple constrained objects with increasing complexity would be interesting. Then, when the solver is changed or their options, it would be possible to see which things blow up with what options.
Erwin Coumans wrote: The URDF import demo can setup a world in either Rigid Body + TypedConstraint or btMultiBody.
When I run the URDF demos, I always get

b3Printf: Selected demo: URDF (RigidBody)
URDF file not found
b3Printf: using new URDF

b3Printf: Selected demo: URDF (MultiBody)
URDF file not found
b3Printf: using new URDF

What do I have to do about this? I am working on Linux. Shouldn't there be any standard URDF to load? Or even multiples, which can be changed using a dropdown box? Currently, it is not really showing off in any way.

Additionally, I get a memory corruption crash when I switch back and forth from Inverse Dynamics URDF and Inverse Dynamics Prog. Not sure what is going on...

Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Discussion of future contributions and roadmap

Post by Basroil » Mon May 09, 2016 12:57 pm

benelot wrote: Basroil, we could also port the old motor control demo and some other old demos and improve them. As soon as I have Erwin's spreadsheet, I can start doing that as well. I had some problems understanding the older demo's setups, but I will get there in time.

When I run the URDF demos, I always get

b3Printf: Selected demo: URDF (RigidBody)
URDF file not found
b3Printf: using new URDF

b3Printf: Selected demo: URDF (MultiBody)
URDF file not found
b3Printf: using new URDF

What do I have to do about this? I am working on Linux. Shouldn't there be any standard URDF to load? Or even multiples, which can be changed using a dropdown box? Currently, it is not really showing off in any way.

Additionally, I get a memory corruption crash when I switch back and forth from Inverse Dynamics URDF and Inverse Dynamics Prog. Not sure what is going on...
The motor control demo was already working a while back, should still work as of ~3 days ago when I last rebased the fork I'm on. Although updating it is an option, the spider leg code and control code would need to be made a bit easier to understand (bit too much joint transform chaining for people just starting to understand it without writing the transform equations). The one I'm working on is in part based on the motor control demo (same style of control using pre-tick callback) though, so I can port the core parts over with a bit of extra testing.

As for URDF, the definitions should be in \examples\Importers\ImportURDFDemo\urdf_samples.h , so perhaps there's a path error in your setup? Haven't had an issue using the VS2010 project, but haven't checked on cmake/premake or linux yet (my VM machine is unfortunately out of memory right now). You should be able to set up a dropdown using the strings in that file (still trying to learn the ins and outs of the example browser's sliders/buttons/dropdowns/outputs unfortunately, not sure anything I code will be up to par just yet)

I just checked the inverse dynamics URDF and inverse dynamics prog in VS2015's memory consumption profiling and indeed it seems that there's ~500kb increased memory use each time I click on one or the other that doesn't show up when I switch between Basic Example and Rolling Friction. I'll play around a bit to see if I can isolate it, but not sure how much time I have tonight (it's already ~10pm)

benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Discussion of future contributions and roadmap

Post by benelot » Mon May 09, 2016 1:29 pm

Basroil wrote: You should be able to set up a dropdown using the strings in that file (still trying to learn the ins and outs of the example browser's sliders/buttons/dropdowns/outputs unfortunately, not sure anything I code will be up to par just yet)
Here is a small heads-up on the buttons, sliders and comboboxes. You only need to do things as shown below in initPhysics(). The sliders automatically update the variable reference given by &friction, it even works directly with &rigidbody.m_friction. The callbacks make it possible to write custom callbacks for whatever you might need.

Code: Select all


   static btScalar friction = 1;

   void onFrictionChanged(float friction){
            printf("Friction changed to %f \n",friction );
    }
    {
        SliderParams slider("Friction",&friction);
        slider.m_callback=onFrictionChanged;
        slider.m_minVal=0;
        slider.m_maxVal=2000;
        slider.m_clampToNotches = false;
		if (m_guiHelper->getParameterInterface())
	        m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
    }


   void toggleUseInverseModel(int buttonId, bool buttonState, void* userPointer){
      useInverseModel=!useInverseModel;
      b3Printf("switched inverse model %s", useInverseModel?"on":"off");
   }

   {
        ButtonParams button("toggle inverse model",0,true);
        button.m_callback = toggleUseInverseModel;
        if (m_guiHelper->getParameterInterface())
            m_guiHelper->getParameterInterface()->registerButtonParameter(button);
    }

   void MyComboBoxCallback (int combobox, const char* item, void* userPointer)
   {
      b3Printf("Item selected %s", item);
   }

   {
   	ComboBoxParams comboParams;
   	comboParams.m_comboboxId = bodyIndex;
   	comboParams.m_numItems = 1;
   	comboParams.m_startItem = 0;
   	comboParams.m_callback = MyComboBoxCallback;
   	comboParams.m_userPointer = this;
   	const char* bla = "bla";
   	const char* blarray[1];
   	blarray[0] = bla;
				
   	comboParams.m_items=blarray;//{&bla};
   	m_guiHelper->getParameterInterface()->registerComboBox(comboParams);
    }
I added this description directly into the bullet physics article on adding a new example to the browser:
http://bulletphysics.org/mediawiki-1.5. ... ecialities
Last edited by benelot on Mon May 09, 2016 3:53 pm, edited 2 times in total.

Post Reply