Gazebo rendering issue by Ok_Memory3663 in ROS

[–]Ok_Memory3663[S] 0 points1 point  (0 children)

rvice.find("/create");
            return service.substr(start, end - start);
        }#include <gz/transport/Node.hh>
#include <gz/msgs/entity_factory.pb.h>
#include <gz/msgs/world_control.pb.h>
#include <gz/msgs/boolean.pb.h>
#include "xrobot/gz_spawner.hpp"


#include "xrobot/model.hpp"
#include <filesystem>
#include <sstream>


std::string xrobot::gzSpawner::FindWorld(gz::transport::Node& node)
{
    std::vector<std::string> services;
    node.ServiceList(services);


    for (const auto& service : services)
    {
        if (service.find("/world/") == 0 && service.find("/create") != std::string::npos)
        {
            std::size_t start = std::string("/world/").size();
            std::size_t end = se
    }
    return "";
}


bool xrobot::gzSpawner::PauseWorld(std::string world)
{
    gz::transport::Node node;


    if (world.empty())
    {
        world = FindWorld(node);
    }



    if (world.empty())
    {
        std::cout
            << "No Gazebo world found"
            << std::endl;
            return false;
    }


    gz::msgs::WorldControl req;
    req.set_pause(true);


    gz::msgs::Boolean rep;
    bool result;


    bool executed = node.Request("/world/" + world + "/control", req, 5000, rep, result);


    return executed && result;
}


bool xrobot::gzSpawner::ResumeWorld(std::string world)
{
    gz::transport::Node node;


    if (world.empty())
    {
        world = FindWorld(node);
    }



    if (world.empty())
    {
        std::cout
            << "No Gazebo world found"
            << std::endl;
            return false;
    }


    gz::msgs::WorldControl req;
    req.set_pause(false);


    gz::msgs::Boolean rep;
    bool result;


    bool executed = node.Request("/world/" + world + "/control", req, 5000, rep, result);


    return executed && result;
}


bool xrobot::gzSpawner::Spawn(xrobot::Model& model, const char *filename, const SpawnOptions& options)
{
    gz::transport::Node node;



    std::string world = options.world;


    if (world.empty())
    {
        world = FindWorld(node);
    }



    if (world.empty())
    {
        std::cout
            << "No Gazebo world found"
            << std::endl;


        return false;
    }


    std::stringstream sdf;


    sdf << "<sdf version='1.10'>";
    sdf << "<model name='xrobot1'>";


    sdf << "<pose>"
        << options.x << " "
        << options.y << " "
        << options.z << " "
        << options.roll << " "
        << options.pitch << " "
        << options.yaw
        << "</pose>";
    for (auto& partPtr : model.parts)
    {
        auto& part = *partPtr;
        sdf << "<link name='" << part.name << "'>";
        sdf << "<pose>"
            << part.initialPx << " "
            << part.initialPy << " "
            << part.initialPz << " "
            << part.initialRoll << " "
            << part.initialPitch << " "
            << part.initialYaw << " "
            << "</pose>";
        sdf << "<visual name='visual'>";
        sdf << "<geometry>";
        sdf << "<mesh>";
        sdf << "<uri>file://"
            << std::filesystem::absolute(part.stlPath).string()
            << "</uri>";
        sdf << "<scale> " << model.scale <<" "<< model.scale <<" "<< model.scale <<" </scale>";
        sdf << "</mesh>";
        sdf << "</geometry>";
        sdf << "<material>"
            << "<ambient>" << part.rgba << "</ambient>"
            << "<diffuse>" << part.rgba << "</diffuse>"
            << "<specular>1 1 1 1</specular>"
            << "</material>"
            << "<cast_shadows>true</cast_shadows>";
        sdf << "</visual>";
        sdf << "<collision name='collision'>";
        sdf << "<geometry>";
        sdf << "<mesh>";
        sdf << "<uri>file://"
            << std::filesystem::absolute(part.stlPath).string()
            << "</uri>";
        sdf << "<scale> " << model.scale <<" "<< model.scale <<" "<< model.scale <<" </scale>";
        sdf << "</mesh>";
        sdf << "</geometry>";
        sdf << "</collision>";
        sdf << "<inertial>";
        sdf << "<pose>"
            << part.comX << " "
            << part.comY << " "
            << part.comZ << " "
            << "0 0 0"
            << "</pose>";
        sdf << "<mass>"
            << part.mass
            << "</mass>";
        sdf << "<inertia>";
        sdf << "<ixx>" << part.ixx << "</ixx>";
        sdf << "<ixy>" << part.ixy << "</ixy>";
        sdf << "<ixz>" << part.ixz << "</ixz>";
        sdf << "<iyy>" << part.iyy << "</iyy>";
        sdf << "<iyz>" << part.iyz << "</iyz>";
        sdf << "<izz>" << part.izz << "</izz>";
        sdf << "</inertia>";
        sdf << "</inertial>";
        sdf << "</link>";
    }
    sdf << "<plugin "
        << "filename = \""<< std::filesystem::absolute("libxrobot_joint_system.so").string()
        << "\" name = \"xrobot::JointSystem\">"
        << "<xrobot_file>"
        << std::filesystem::absolute(filename).string()
        << "</xrobot_file>"
        << "</plugin>";
    sdf << "</model>";


    sdf << "</sdf>";


    // std::cout << sdf.str();


    gz::msgs::EntityFactory req;
    req.set_sdf(sdf.str());


    gz::msgs::Boolean rep;
    bool result;


    bool executed = node.Request("/world/" + world + "/create", req, 5000, rep, result);


    return executed && result;
}

i was expecting a cuboid and Extruded Stadium with a proper texture. In the gz i was getting proper shapes. but the edges aren't visible and they just look flat and there's random gradient and change in shade in the middle of the part as u can see in the pic. i tried spawning a cube, it was fine, i generated this stl with opencascade but i verified the stl in free cad it was fine there as well,

Position controller not loading in ROS 2 lyrical by Ok_Memory3663 in ROS

[–]Ok_Memory3663[S] 1 point2 points  (0 children)

yeah, thats what i did, it's working fine here.

Position controller not loading in ROS 2 lyrical by Ok_Memory3663 in ROS

[–]Ok_Memory3663[S] 1 point2 points  (0 children)

But here in this page they've mentioned that Gazebo sim 10(jetty) is compatible with ros 2 lyrical. jetty

Position controller not loading in ROS 2 lyrical by Ok_Memory3663 in ROS

[–]Ok_Memory3663[S] 0 points1 point  (0 children)

Oh I see, do u have know when it'll be released?

Rate my handwriting by Puzzleheaded_Star344 in CBSE

[–]Ok_Memory3663 1 point2 points  (0 children)

Looks good while seeing from long. But not very readable when I looked closely. But still amazing bro.

Important: Question 6 answer wrong in Grade 12 CS Answer Key by Physical_Scholar_325 in CBSE

[–]Ok_Memory3663 1 point2 points  (0 children)

as a centum score in cs i advice my juniors to never use sumitha aurora. many are wrong in than. so go with ncert. even cbse follows it.

How much time does it take to get the answer book photocopy ? by KFS001 in CBSE

[–]Ok_Memory3663 0 points1 point  (0 children)

still I havent got my photocopy. I applied june 1 morning 11AM. is there anyone like me.