Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to add objects to gazebo

Shulou Source: shulou.com Published: 2022-06-02 06:36:26 09月19日 Update

This article introduces the knowledge of "how to add objects in gazebo". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Modified to virtual machine IP address

Ipaddress = '192.168.137.129'

Initialization

Rosinit (ipaddress)

Get gazebo element

Gazebo = ExampleHelperGazeboCommunicator ()

Create a new ball

Ball = ExampleHelperGazeboModel ('Ball')

%% set the details of the ball

Spherelink = addLink (ball,'sphere',0.6,'color', [0 0 1 1])

% place ball

SpawnModel (gazebo,ball, [8.5pj0pl 1])

%% defines several object positions

X = [1.5 1.5 1.5 2.5 2.5 2.5 3.5 3.5 4.5]

Y = [- 1.5-0.5 0.5 1.5-10 1-0.5 0 0]

Create a new post

Pin = ExampleHelperGazeboModel ('BowlPin')

%% details of setting up posts

Link1 = addLink (pin,'cylinder', [1. 2], 'position', [0. 0. 5])

Link2 = addLink (pin,'sphere',0.2,'position', [0,1.2], 'color', [0.70 0.21])

Joint = addJoint (pin,link1,link2,'revolute', [0 0], [0 01])

%% place these posts

For I = 1:10

SpawnModel (gazebo,pin, [x (I), y (I), 0.7])

Pause (1)

End

If the robot was in it last time, remove it.

If ismember ('mobile_base',getSpawnedModels (gazebo))

RemoveModel (gazebo,'mobile_base')

End

Create a new barrier

Barrier = ExampleHelperGazeboModel ('jersey_barrier','gazeboDB')

% place barrier

SpawnModel (gazebo,barrier, [1.5 Right barrier 3jue 0]);%

Pause (1)

SpawnModel (gazebo,barrier, [1.5 ~ 3pm 0]);% Left barrier

%% get the blue ball you just placed by name

SpawnedBall = ExampleHelperGazeboSpawnedModel (ball.Name,gazebo)

%% set the magnitude and direction time of the external force

Duration = 1;% Seconds

Forcevec = [- 7500];% Newtons

%% external force

ApplyForce (spawnedBall, spherelink, duration, forcevec)

Pause (5)

% clear balls and posts

ExampleHelperGazeboCleanupBowling

% emptying

Clear

% close connection

Rosshutdown

Matlab2016b environment is required to run the program

Win64 link: http://pan.baidu.com/s/1hs7GMBM password: kwe8Linux link: http://pan.baidu.com/s/1kVtx9YZ password: rl9l "how to add objects in gazebo" content is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Posts objects content external forces passwords barriers more knowledge links practicality learning next location element name dilemma address size reality situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL Shulou Tech Info Apple vpn