Previously on this page.....
- We saw how to configure the PID values for joint control.
- We gave color to our robot and made him happy.
Building Environment for robot....
- In this post we build our own environment for robot, lets start building it first.
- Open Fusion 360 and in new file start sketch and sketch the base for environment, its up to you how creative you are , you can design any thing what ever you want, e.g. maze, house, etc.
- So, here is my environment, its kind of maze, in this we have some check points as well, we have to pick boxes cans etc.
- as I mentioned we have to pick boxes and cans you can design them according to your convince, also you can add objects from gazebo library which will take look in next section.
- now export this file to your computer in FBX format you need not to export this file as urdf we will be making sdf file for the same.
- now if you have, open source software blender then import this fbx file, if you don't have blender you can download it form here.
- now after importing the the fbx file your window will look like this:
- now on right click on the object name and in bottom right you can see transform tab, yes you guessed it correctly we have to make changes to it.
- under rotations tab make sure everything is zero degree, and in scale tab change each scale value to 1.
- after doing this operation your window will look like this:
- feel free to rotate the screen by pressing mouse wheel and panning using the pan (✋) option, to see the model, full model will not be displayed but you can trust me and export the file.
- To export the model navigate to file>export>collada(.dae), select the location where you want to export.
- This is how we export the files in color format, after the file is exported which you will see in bottom tab, you can delete this model and add another one, if you have and can continue the exporting as mentioned above.
- now navigate to the exported dae file and copy the file, then if you are using wsl open vs code and navigate to catkin_ws>src>pnp_bot_description, and make new folder of name which ever you wish, I have named it , pnp_bot_game_field ,inside this folder make another folder named meshes, and then paste dae file here.
- now before we move ahead, I want to announce that this project is now available on my GitHub page you can download it by clicking (code) download button.
- To keep things simple download this package and extract it in catkin_ws/src.
- you can see the same pnp_bot_game_field folder is there and you can notice one more folder named box, these both folders are gazebo models you can cut paste both into ~/.gazebo/models and feel free to open the folder and take look at config and sdf files, here is how one of these looks:
- now try and launch gazebo and in insert section you will find the both of models.
- now lets come back to our making from scratch attitude😁, navigate to folder we have created and till now we have just created meshes folder, now in same pnp folder create a new file and name it as model.config , this file is important as gazebo will recognize using this file that the folder contains a gazebo model.
- Inside this file copy the contents of config file which you have downloaded and feel free to change the contents of name, email, etc. expect sdf file.
- now create another file named model.sdf and again copy the contents of the sdf file which you have downloaded, now here just change the values of paths, to your dae file which will be same as it is if you are following this post.
- now save both files and copy this folder to ~/.gazebo/models, now gazebo will recognize this model, you can create similar files in same format, you can explore the box folder which you have downloaded.
- Now to make the world for robot navigate to catkin_ws/src/pnp_bot_description and make a new folder named world inside which make a file with name pnp_bot.world , this file will be describing the world.
- now copy the contents of world file which you have downloaded and take a look now at this file, make sure the name of files matches with your file names.
- to know more about world files click here.
- now inside gazebo.launch file in launch folder add this line: <arg name="world_name" value="$(find pnp_bot_description)/worlds/pnp_bot.world"/> under include tag.
- now you have created the custom world in gazebo, I want you to experiment this file by changing the values.
- And now you can create more of such files, according to need just follow the conventions.
Creating a script to control joints....
- now you know that controller launch file launches various topics and we can control the joints via publishing data on topics.
- now navigate to the pnp_bot description and create folder named scripts and inside this create a file named control.py , yes you guessed correctly we will use python as programming language you can use CPP but you have to take care that you replace corresponding functions.
- now copy the content of test.py file from scripts folder which you have downloaded from GitHub.
- this script is simple publisher you can customize it according to your convince.
- Let me give a glimpse what the code is doing, first we define publisher and subscriber variables then to get feedback we subscribe to process_value topic of joint, and then once the state is achieved we publish the next data.
- now lets launch the bot with world and control it.
Launching the robot and controlling it.....
- now we are ready to launch the robot, just type roslaunch pnp_bot_description gazebo.launch
- if you haven't added contents of controller launch file to gazebo launch file then in new terminal using roslaunch command launch the controller file.
- then in another terminal using command rosrun pnp_bot_description control.py run the script, it will ask for joint in which type the joint name which will either be arm or gripper.
- for now this script is simple which can connect to only one joint at every run hence you have to run the script again to control another joint.
- then now in new terminal run the command rosrun teleop_twist_keyboard teleop_twist_keyboard.py to start the differential derive control.
- and now we are ready to go, here is my robot:
Conclusion.....
- After launching and controlling the robot I found that gripper was small to grip the objects, I need to modify it.
- further I was not able to switch between the joints within same script, I will try to achieve it or will find any other way to do so.
- further this bot is not carrying any kind of sensors hence we cannot automate it.
- also arm has just 1 DOF making it less work efficient, hence we need improvement in it.
Announcement....
- I would like to announce the next project in which we will redesign this bot and try to automate it.
- Further we will deploy Deep neural network to identify the objects, this project will be long term minimum of 5-6 months hence I will be posting blogs every Sundays in which I will update the status of project.
Superb 🔥🔥💥
ReplyDeleteNice👏
ReplyDelete