MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / main

Function main

test/RobotClientAPI/SlopeFrictionMain.cpp:12–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "MinitaurSetup.h"
11#define NUM_SIM 1
12int main(int argc, char* argv[])
13{
14 b3RobotSimulatorClientAPI* sims[2];
15 b3Scalar fixedTimeStep = 1. / 240.;
16 for (int i = 0; i < NUM_SIM; i++)
17 {
18 b3RobotSimulatorClientAPI* sim = new b3RobotSimulatorClientAPI();
19 sims[i] = sim;
20 sim->connect(eCONNECT_GUI); //eCONNECT_GUI);//DIRECT);
21 //Can also use eCONNECT_DIRECT,eCONNECT_SHARED_MEMORY,eCONNECT_UDP,eCONNECT_TCP, for example:
22 //sim->connect(eCONNECT_UDP, "localhost", 1234);
23 sim->configureDebugVisualizer(COV_ENABLE_GUI, 0);
24 // sim->configureDebugVisualizer( COV_ENABLE_SHADOWS, 0);//COV_ENABLE_WIREFRAME
25 //sim->setTimeOut(3);
26 //syncBodies is only needed when connecting to an existing physics server that has already some bodies
27 sim->syncBodies();
28
29 sim->setTimeStep(fixedTimeStep);
30
31 b3Quaternion q = sim->getQuaternionFromEuler(b3MakeVector3(0.1, 0.2, 0.3));
32 b3Vector3 rpy;
33 rpy = sim->getEulerFromQuaternion(q);
34
35 sim->setGravity(b3MakeVector3(0, 0, -9.8));
36
37 //int blockId = sim->loadURDF("cube.urdf");
38 //b3BodyInfo bodyInfo;
39 //sim->getBodyInfo(blockId,&bodyInfo);
40
41 b3Quaternion orn;
42 orn.setEulerZYX(0, B3_PI * 0.23, 0);
43
44 b3RobotSimulatorLoadUrdfFileArgs args;
45 args.m_startPosition.setValue(0, 0, 0);
46 args.m_startOrientation = orn;
47 args.m_useMultiBody = i == 0 ? false : true; //true : false;//false : true;
48
49 sim->loadURDF("plane.urdf", args);
50
51 args.m_startPosition.setValue(0, 0, 0.66);
52 args.m_startOrientation.setEulerZYX(0, B3_PI * 0.23, 0);
53 sim->loadURDF("cube_soft.urdf", args);
54
55 double distance = 1.5;
56 double yaw = 50;
57 sim->resetDebugVisualizerCamera(distance, yaw, 20, b3MakeVector3(0, 0, 0.1));
58 sim->setRealTimeSimulation(false);
59 }
60 int enableSim = 1;
61 while (sims[0]->canSubmitCommand())
62 {
63#if 0
64 b3KeyboardEventsData keyEvents;
65 sim->getKeyboardEvents(&keyEvents);
66 if (keyEvents.m_numKeyboardEvents)
67 {
68
69 //printf("num key events = %d]\n", keyEvents.m_numKeyboardEvents);

Callers

nothing calls this directly

Calls 15

b3MakeVector3Function · 0.85
syncBodiesMethod · 0.80
setTimeStepMethod · 0.80
setRealTimeSimulationMethod · 0.80
connectMethod · 0.45
setGravityMethod · 0.45
setEulerZYXMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected