Comments (22)
Hi @jhwangbo ,
suddenly I have a second question: how can we draw a point, a line or a polygon in raisimOgre?
Thanks in advance.
Best
from raisimogre.
- what you did looks correct. Can you change the friction coefficient to 0.001 and check if it slips?
- https://github.com/raisimTech/raisimOgre/blob/master/examples/src/visualObjects/visualObjects.cpp
from raisimogre.
Thanks for the reply.
For the friction coefficient, it still didn't slip even I changed it to 0.001. It seems weird to me because I just followed the tutorial from the website. I am using the world.integrate1() and world.integrate2() for the simulation, could they be the problem?
Best
from raisimogre.
Hi, any update on this? @jhwangbo
from raisimogre.
@jhwangbo After that, I also changed the bouncy coefficient in raisimOgre, this also didn't work. Any feedback?
Thanks!
from raisimogre.
Can you share a minimal code to reproduce the error?
from raisimogre.
So the code looks like this:
void setupCallback() {
auto vis = raisim::OgreVis::get();
/// light
vis->getLight()->setDiffuseColour(1, 1, 1);
vis->getLight()->setCastShadows(true);
Ogre::Vector3 lightdir(1., 1, -1);
lightdir.normalise();
vis->getLight()->setDirection(lightdir);
vis->setContactVisObjectSize(0.04, 0.3);
/// load textures
vis->addResourceDirectory(vis->getResourceDir() + "/material/checkerboard");
vis->loadMaterialFile("checkerboard.material");
/// shadow setting
vis->getSceneManager()->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
vis->getSceneManager()->setShadowTextureSettings(2048, 3);
// beyond this distance, shadow disappears
vis->getSceneManager()->setShadowFarDistance(10);
// size of contact points and contact forces
vis->setContactVisObjectSize(0.01, 0.4);
// speed of camera motion in freelook mode
vis->getCameraMan()->setTopSpeed(5);
}
// The visualizer we want to execute on the new thread.
void raisimOgre_visualizer()
{
auto vis = raisim::OgreVis::get();
/// these method must be called before initApp
vis->setWorld(&world);
vis->setWindowSize(1800, 1200);
vis->setImguiSetupCallback(imguiSetupCallback);
vis->setImguiRenderCallback(imguiRenderCallBack);
vis->setSetUpCallback(setupCallback);
vis->setAntiAliasing(8);
raisim::gui::manualStepping = false;
/// starts visualizer thread
vis->initApp();
/// create raisim objects
auto ground = world.addGround(0, "checkerboard_green");
/// create visualizer objects
vis->createGraphicalObject(ground, 20, "floor", "checkerboard_green");
anymal_visual.push_back(vis->createGraphicalObject(anymal.back(), "ANYmal_kinova"));
while(ros::ok()){
vis->renderOneFrame();
}
}
int main(int argc, char **argv) {
anymal.push_back(world.addArticulatedSystem(raisim::loadResource("anymal_modified.urdf")));
// Run the visualizer thread
std::thread t1(raisimOgre_visualizer);
anymal.back()->setGeneralizedCoordinate({0,0,0.57,......});
anymal.back()->setGeneralizedForce(Eigen::VectorXd::Zero(anymal.back()->getDOF()));
anymal.back()->setControlMode(raisim::ControlMode::PD_PLUS_FEEDFORWARD_TORQUE);
anymal.back()->setPdGains(jointPgain, jointDgain);
anymal.back()->setPdTarget(jointNominalConfig, jointVelocityTarget);
// Set friction coefficient
anymal.back()->getCollisionBody("LF_FOOT/0").setMaterial("LF_FOOT");
anymal.back()->getCollisionBody("RF_FOOT/0").setMaterial("RF_FOOT");
anymal.back()->getCollisionBody("LH_FOOT/0").setMaterial("LH_FOOT");
anymal.back()->getCollisionBody("RH_FOOT/0").setMaterial("RH_FOOT");
world.setMaterialPairProp("checkerboard_green", "LF_FOOT", 0.8, 0, 0);
world.setMaterialPairProp("checkerboard_green", "RF_FOOT", 0.8, 0, 0);
world.setMaterialPairProp("checkerboard_green", "LH_FOOT", 0.8, 0, 0);
world.setMaterialPairProp("checkerboard_green", "RH_FOOT", 0.8, 0, 0);
while (ros::ok()){
// Set the world time and do the integration 1
ros::Time begin = ros::Time::now();
ros::Time current_t = begin;
auto dt = (current_t - lastTimeStampt).toSec();
world.setTimeStep(dt);
world.integrate1();
// Here always calculates my commanded torque
torque = some_tracking_controller();
anymal.back()->setPdGains(jointPgain, jointDgain);
anymal.back()->setPdTarget(jointsPTarget, jointVelocityTarget);
anymal.back()->setGeneralizedForce(torque);
world.integrate2();
}
ros::spinOnce();
loop_rate.sleep();
}
Thanks a lot for any feedback!
Best
from raisimogre.
This code works for me. I see clear differences when I change the friction coefficient. Do you have the latest version?
from raisimogre.
Something weird happed. After I cloned the latest version of raisimLib and merge my local raisimLib (actually I didn't change this repo before from the original one) into the newest raisimLib, there is an error occurring during initializing the PD gains: "p gains should have the same dimension as the degrees of freedom". I went into the ArticulatedSystem.hpp and printed the dof dimension out. It sometimes became 0, sometimes became a very large number. I don't know what happens since I didn't change my code and just get the latest raisimLib from git. Any tipps for this problem?
Best
from raisimogre.
This happens if you have multiple versions of raisim in your system
from raisimogre.
Thanks, you are right, I have installed an old version raisim locally in some other directories. After updating it to the latest one, problem's solved.
However, when I change the friction coefficient again, I still cannot see the clear differences. Any tipps?
from raisimogre.
Change only one foot. Then you should see the difference.
from raisimogre.
Nope. It still walks fine without any slip. Really confusing.
from raisimogre.
Change only one foot. Then you should see the difference.
I also changed the bouncy coefficient to a larger value, like 2, but I also didn't see the contact becoming bouncier.
from raisimogre.
Can you change only one foot to 0.01 and share the code and video?
from raisimogre.
I added an example here. https://github.com/raisimTech/raisimLib/blob/7bad35165b7fb91bc4401bcefe22244c97551afd/examples/src/server/anymals.cpp#L48
This seems to work fine on my machine. Let me know if this example doesn't work for you
from raisimogre.
you have to uncomment the two lines to see the effect
from raisimogre.
Hi @jhwangbo
Sorry for the late reply. I did what you suggested, but still, it didn't affect the results that much.
Here are the codes before setting the friction coefficient to 0.01:
void setupCallback() {
auto vis = raisim::OgreVis::get();
/// light
vis->getLight()->setDiffuseColour(1, 1, 1);
vis->getLight()->setCastShadows(true);
Ogre::Vector3 lightdir(1., 1, -1);
lightdir.normalise();
vis->getLight()->setDirection(lightdir);
vis->setContactVisObjectSize(0.04, 0.3);
/// load textures
vis->addResourceDirectory(vis->getResourceDir() + "/material/checkerboard");
vis->loadMaterialFile("checkerboard.material");
/// shadow setting
vis->getSceneManager()->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
vis->getSceneManager()->setShadowTextureSettings(2048, 3);
// beyond this distance, shadow disappears
vis->getSceneManager()->setShadowFarDistance(10);
// size of contact points and contact forces
vis->setContactVisObjectSize(0.01, 0.4);
// speed of camera motion in freelook mode
vis->getCameraMan()->setTopSpeed(5);
}
// The visualizer we want to execute on the new thread.
void raisimOgre_visualizer()
{
auto vis = raisim::OgreVis::get();
/// these method must be called before initApp
vis->setWorld(&world);
vis->setWindowSize(1800, 1200);
vis->setImguiSetupCallback(imguiSetupCallback);
vis->setImguiRenderCallback(imguiRenderCallBack);
vis->setSetUpCallback(setupCallback);
vis->setAntiAliasing(8);
raisim::gui::manualStepping = false;
/// starts visualizer thread
vis->initApp();
/// create raisim objects
auto ground = world.addGround(0, "checkerboard_green");
/// create visualizer objects
vis->createGraphicalObject(ground, 20, "floor", "checkerboard_green");
anymal_visual.push_back(vis->createGraphicalObject(anymal.back(), "ANYmal_kinova"));
while(ros::ok()){
vis->renderOneFrame();
}
}
int main(int argc, char **argv) {
anymal.push_back(world.addArticulatedSystem(raisim::loadResource("anymal_modified.urdf")));
// Run the visualizer thread
std::thread t1(raisimOgre_visualizer);
anymal.back()->setGeneralizedCoordinate({0,0,0.57,......});
anymal.back()->setGeneralizedForce(Eigen::VectorXd::Zero(anymal.back()->getDOF()));
anymal.back()->setControlMode(raisim::ControlMode::PD_PLUS_FEEDFORWARD_TORQUE);
anymal.back()->setPdGains(jointPgain, jointDgain);
anymal.back()->setPdTarget(jointNominalConfig, jointVelocityTarget);
// Set friction coefficient
// anymal.back()->getCollisionBody("LH_FOOT/0").setMaterial("LH_FOOT");
// world.setMaterialPairProp("checkerboard_green", "LH_FOOT", 0.01, 0, 0);
while (ros::ok()){
// Set the world time and do the integration 1
ros::Time begin = ros::Time::now();
ros::Time current_t = begin;
auto dt = (current_t - lastTimeStampt).toSec();
world.setTimeStep(dt);
world.integrate1();
// Here always calculates my commanded torque
torque = some_tracking_controller();
anymal.back()->setPdGains(jointPgain, jointDgain);
anymal.back()->setPdTarget(jointsPTarget, jointVelocityTarget);
anymal.back()->setGeneralizedForce(torque);
world.integrate2();
}
ros::spinOnce();
loop_rate.sleep();
}
For the experiment, I did backward walking, then sideways walking. And the video is attached here:
https://user-images.githubusercontent.com/39060488/152913049-8867b727-f2f8-43bf-9123-596af5f10c31.mp4
After that, I set the friction coefficient to 0.01, here are the codes:
void setupCallback() {
auto vis = raisim::OgreVis::get();
/// light
vis->getLight()->setDiffuseColour(1, 1, 1);
vis->getLight()->setCastShadows(true);
Ogre::Vector3 lightdir(1., 1, -1);
lightdir.normalise();
vis->getLight()->setDirection(lightdir);
vis->setContactVisObjectSize(0.04, 0.3);
/// load textures
vis->addResourceDirectory(vis->getResourceDir() + "/material/checkerboard");
vis->loadMaterialFile("checkerboard.material");
/// shadow setting
vis->getSceneManager()->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
vis->getSceneManager()->setShadowTextureSettings(2048, 3);
// beyond this distance, shadow disappears
vis->getSceneManager()->setShadowFarDistance(10);
// size of contact points and contact forces
vis->setContactVisObjectSize(0.01, 0.4);
// speed of camera motion in freelook mode
vis->getCameraMan()->setTopSpeed(5);
}
// The visualizer we want to execute on the new thread.
void raisimOgre_visualizer()
{
auto vis = raisim::OgreVis::get();
/// these method must be called before initApp
vis->setWorld(&world);
vis->setWindowSize(1800, 1200);
vis->setImguiSetupCallback(imguiSetupCallback);
vis->setImguiRenderCallback(imguiRenderCallBack);
vis->setSetUpCallback(setupCallback);
vis->setAntiAliasing(8);
raisim::gui::manualStepping = false;
/// starts visualizer thread
vis->initApp();
/// create raisim objects
auto ground = world.addGround(0, "checkerboard_green");
/// create visualizer objects
vis->createGraphicalObject(ground, 20, "floor", "checkerboard_green");
anymal_visual.push_back(vis->createGraphicalObject(anymal.back(), "ANYmal_kinova"));
while(ros::ok()){
vis->renderOneFrame();
}
}
int main(int argc, char **argv) {
anymal.push_back(world.addArticulatedSystem(raisim::loadResource("anymal_modified.urdf")));
// Run the visualizer thread
std::thread t1(raisimOgre_visualizer);
anymal.back()->setGeneralizedCoordinate({0,0,0.57,......});
anymal.back()->setGeneralizedForce(Eigen::VectorXd::Zero(anymal.back()->getDOF()));
anymal.back()->setControlMode(raisim::ControlMode::PD_PLUS_FEEDFORWARD_TORQUE);
anymal.back()->setPdGains(jointPgain, jointDgain);
anymal.back()->setPdTarget(jointNominalConfig, jointVelocityTarget);
// Set friction coefficient
anymal.back()->getCollisionBody("LH_FOOT/0").setMaterial("LH_FOOT");
world.setMaterialPairProp("checkerboard_green", "LH_FOOT", 0.01, 0, 0);
while (ros::ok()){
// Set the world time and do the integration 1
ros::Time begin = ros::Time::now();
ros::Time current_t = begin;
auto dt = (current_t - lastTimeStampt).toSec();
world.setTimeStep(dt);
world.integrate1();
// Here always calculates my commanded torque
torque = some_tracking_controller();
anymal.back()->setPdGains(jointPgain, jointDgain);
anymal.back()->setPdTarget(jointsPTarget, jointVelocityTarget);
anymal.back()->setGeneralizedForce(torque);
world.integrate2();
}
ros::spinOnce();
loop_rate.sleep();
}
And the result looks like this:
https://user-images.githubusercontent.com/39060488/152915448-410e579d-e1f3-4776-b516-e9c1cb38f38c.mp4
From my point of view, I didn't see any clear difference. So I think changing the coefficient like this may not work.
P.S. I have noticed one thing: in your example code, you are using the raisim server. And after setting the coefficient, you directly send this change to the server. But in my case, I am using the world.integrate 1 and 2 for simulating the result. Perhaps, the integrator didn't involve these coefficient changes? There are only the differences between my codes and yours. Any suggestion?
Thanks.
from raisimogre.
"LH_FOOT/0" for the ANYmalC robot is the shank, not the foot. Please check your URDF
from raisimogre.
Thanks for the reply.
Since "LH_FOOT/0" means the first collision body of the link “LH_FOOT”, it is indeed the "LH_shank_fixed" if I understand correctly from urdf. Right?
Following questions come up to my mind:
- Then for changing the friction coefficient in ANYmal C, should I use "LH_FOOT" instead of "LH_FOOT/0"
(i.e., set "anymal.back()->getCollisionBody("LH_FOOT").setMaterial("LH_FOOT");")
? - If not, how should I do to select the foot?
- Moreover, why does the LH_FOOT link of ANYmal C have two collision properties (i.e., one for the adapter and another for the foot), where these properties are separated into link "LH_FOOT" and "LH_ADAPTER" respectively?
- In ANYmal B, "LH_FOOT/0" should be the link “ LH_ADAPTER” right? But I checked the collision body of this link, it is also the adapter, which causes the internal collision. So I was confused why "LH_FOOT/0" can be used in ANYmal B and cannot be used in C?
Thanks.
from raisimogre.
Can you post this question to raisimLib repo? I'll write a detailed answer but this is not the right repo to share.
from raisimogre.
Sure. I will find a time to write a question there. Thanks!
from raisimogre.
Related Issues (20)
- During cmake instructions when installing raisimOgre HOT 3
- Why the examples such as ANYmal can not move? HOT 1
- Scaling function HOT 1
- Black screen in renderer after brief flash HOT 16
- Height map is not visualized correctly HOT 3
- OgreVis.hpp: No such file or directory HOT 7
- ImportError: .cpython-36m-x86_64-linux-gnu.so: undefined symbol: HOT 4
- Finding an old repository HOT 1
- License Issue? graphics issue? HOT 1
- Compilation error: expression cannot be used as a function HOT 5
- Segmentation fault when trying to run the examples HOT 4
- Multiple threads for different views HOT 5
- Possibility of rendering one ogre visualization frame in different threat or loop HOT 2
- Stereo camera possible? HOT 2
- Unknown argument -OGRE_BUILD_COMPONENT_JAVA=OFF HOT 1
- PCRE SWIG problem solved HOT 4
- Unable to make the ogre (and hence raisimOgre) in Ubuntu 22.04 HOT 4
- Map visualization segfaults with multiple threads HOT 3
- file INSTALL cannot find libOgreMain.so.1.12.2 no such file or directory HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raisimogre.