From f218eab91a222004b641ea0d7b9acb4f4490cfd8 Mon Sep 17 00:00:00 2001
From: TallBanana69 <166951711+TallBanana69@users.noreply.github.com>
Date: Mon, 10 Jun 2024 20:21:42 +0530
Subject: [PATCH 1/3] Create Assignment1.md
---
ROS/Assignment1.md | 147 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 147 insertions(+)
create mode 100644 ROS/Assignment1.md
diff --git a/ROS/Assignment1.md b/ROS/Assignment1.md
new file mode 100644
index 0000000..e7cfb0d
--- /dev/null
+++ b/ROS/Assignment1.md
@@ -0,0 +1,147 @@
+
+# SMB Gazebo Simulation Guide
+
+## Setting Up the Environment
+
+1. Source the workspace:
+ ```bash
+ source devel/setup.bash
+ ```
+
+2. Launch the Gazebo simulation:
+ ```bash
+ roslaunch smb_gazebo smb_gazebo.launch
+ ```
+
+3. List active ROS nodes:
+ ```bash
+ rosnode list
+ ```
+ Expected output:
+ ```
+ /base_controller_spawner
+ /gazebo
+ /gazebo_gui
+ /rosout
+ /smb_robot_state_publisher
+ ```
+
+4. List active ROS topics:
+ ```bash
+ rostopic list
+ ```
+ Expected output:
+ ```
+ /clock
+ /cmd_vel
+ /gazebo/link_states
+ /gazebo/model_states
+ /gazebo/parameter_descriptions
+ /gazebo/parameter_updates
+ /gazebo/performance_metrics
+ /gazebo/set_link_state
+ /gazebo/set_model_state
+ /gazebo_ros_control/pid_gains/LF_WHEEL_JOINT/parameter_descriptions
+ /gazebo_ros_control/pid_gains/LF_WHEEL_JOINT/parameter_updates
+ /gazebo_ros_control/pid_gains/LH_WHEEL_JOINT/parameter_descriptions
+ /gazebo_ros_control/pid_gains/LH_WHEEL_JOINT/parameter_updates
+ /gazebo_ros_control/pid_gains/RF_WHEEL_JOINT/parameter_descriptions
+ /gazebo_ros_control/pid_gains/RF_WHEEL_JOINT/parameter_updates
+ /gazebo_ros_control/pid_gains/RH_WHEEL_JOINT/parameter_descriptions
+ /gazebo_ros_control/pid_gains/RH_WHEEL_JOINT/parameter_updates
+ /imu0
+ /imu0/accel/parameter_descriptions
+ /imu0/accel/parameter_updates
+ /imu0/bias
+ /imu0/rate/parameter_descriptions
+ /imu0/rate/parameter_updates
+ /imu0/yaw/parameter_descriptions
+ /imu0/yaw/parameter_updates
+ /joint_states
+ /odom
+ /rosout
+ /rosout_agg
+ /smb_velocity_controller/cmd_vel
+ /smb_velocity_controller/odom
+ /smb_velocity_controller/parameter_descriptions
+ /smb_velocity_controller/parameter_updates
+ /tf
+ /tf_static
+ ```
+
+5. Echo the clock topic:
+ ```bash
+ rostopic echo /clock
+ ```
+ Expected output:
+ ```
+ clock:
+ secs: 405
+ nsecs: 532000000
+ ---
+ clock:
+ secs: 405
+ nsecs: 533000000
+ ```
+
+6. Get information about the clock topic:
+ ```bash
+ rostopic info /clock
+ ```
+ Expected output:
+ ```
+ Type: rosgraph_msgs/Clock
+ Publishers:
+ * /gazebo (http://Ubuntu20:38511/)
+ Subscribers:
+ * /rosout (http://Ubuntu20:34993/)
+ * /smb_robot_state_publisher (http://Ubuntu20:39761/)
+ * /base_controller_spawner (http://Ubuntu20:36055/)
+ * /gazebo (http://Ubuntu20:38511/)
+ * /gazebo_gui (http://Ubuntu20:45813/)
+ ```
+
+7. Measure the frequency of the clock topic:
+ ```bash
+ rostopic hz /clock
+ ```
+ Expected output (subscribes to the clock):
+ ```
+ average rate: 954.993
+ min: 0.001s max: 0.007s std dev: 0.00036s window: 680
+ ```
+
+8. Visualize the nodes and topics using `rqt_graph`:
+ ```bash
+ rqt_graph
+ ```
+
+## Publishing Velocity Commands
+
+1. Publish a velocity command:
+ ```bash
+ rostopic pub /cmd_vel geometry_msgs/Twist "{linear: {x: 0.5, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}" -r 3
+ ```
+
+2. Install and use `teleop_twist_keyboard` for controlling the robot:
+ ```bash
+ sudo apt-get install ros-noetic-teleop-twist-keyboard
+ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
+ ```
+ Note: The robot moves only if the terminal is the active window.
+
+## Launching a Custom World
+
+1. Create a new launch file in the `launch` directory of `smb_gazebo`:
+ ```xml
+
+
+
+
+
+ ```
+
+2. Launch the new world:
+ ```bash
+ roslaunch smb_gazebo .launch
+ ```
From 4b1e1524d4869ca91258acc7bb22512f5cfb35fd Mon Sep 17 00:00:00 2001
From: TallBanana69 <166951711+TallBanana69@users.noreply.github.com>
Date: Mon, 24 Jun 2024 11:44:57 +0530
Subject: [PATCH 2/3] Create launch
---
ROS_Assignment 2/launch | 1 +
1 file changed, 1 insertion(+)
create mode 100644 ROS_Assignment 2/launch
diff --git a/ROS_Assignment 2/launch b/ROS_Assignment 2/launch
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/ROS_Assignment 2/launch
@@ -0,0 +1 @@
+
From f2ef0f6fdf3c2d2a581c7220429555ab4045090f Mon Sep 17 00:00:00 2001
From: TallBanana69 <166951711+TallBanana69@users.noreply.github.com>
Date: Mon, 24 Jun 2024 11:47:16 +0530
Subject: [PATCH 3/3] Add files via upload
---
ROS_Assignment 2/CMakeLists.txt | 40 +++++++
ROS_Assignment 2/my_package.launch | 107 ++++++++++++++++++
ROS_Assignment 2/package.xml | 83 ++++++++++++++
ROS_Assignment 2/params.yaml | 3 +
ROS_Assignment 2/smb_highlevel_controller.cpp | 32 ++++++
5 files changed, 265 insertions(+)
create mode 100644 ROS_Assignment 2/CMakeLists.txt
create mode 100644 ROS_Assignment 2/my_package.launch
create mode 100644 ROS_Assignment 2/package.xml
create mode 100644 ROS_Assignment 2/params.yaml
create mode 100644 ROS_Assignment 2/smb_highlevel_controller.cpp
diff --git a/ROS_Assignment 2/CMakeLists.txt b/ROS_Assignment 2/CMakeLists.txt
new file mode 100644
index 0000000..9c392c6
--- /dev/null
+++ b/ROS_Assignment 2/CMakeLists.txt
@@ -0,0 +1,40 @@
+cmake_minimum_required(VERSION 3.0.2)
+project(my_package)
+
+## Find catkin macros and libraries
+find_package(catkin REQUIRED COMPONENTS
+ roscpp
+ std_msgs
+ gazebo_ros
+ pointcloud_to_laserscan
+ rviz
+ smb_control
+ smb_gazebo
+ # smb_description
+)
+
+## System dependencies are found with CMake's conventions
+# find_package(Boost REQUIRED COMPONENTS system)
+
+## Declare a catkin package
+catkin_package()
+
+## Specify additional locations of header files
+## Your package locations should be included here
+include_directories(
+ ${catkin_INCLUDE_DIRS}
+ # Add any additional include directories here if needed
+)
+
+## Declare a C++ executable
+add_executable(smb_highlevel_controller src/smb_highlevel_controller.cpp)
+
+## Specify libraries to link a library or executable target against
+target_link_libraries(smb_highlevel_controller
+ ${catkin_LIBRARIES}
+ # Add any additional libraries here if needed (e.g., PCL libraries)
+)
+
+## Add dependencies to the executable
+add_dependencies(smb_highlevel_controller ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
+
diff --git a/ROS_Assignment 2/my_package.launch b/ROS_Assignment 2/my_package.launch
new file mode 100644
index 0000000..c6956b6
--- /dev/null
+++ b/ROS_Assignment 2/my_package.launch
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ target_frame: rslidar # Leave disabled to output scan in pointcloud frame
+ transform_tolerance: 0.01
+ min_height: $(arg laser_scan_min_height)
+ max_height: $(arg laser_scan_max_height)
+
+ angle_min: -1.5708 # -M_PI/2
+ angle_max: 1.5708 # M_PI/2
+ angle_increment: 0.0087 # M_PI/360.0
+ scan_time: 0.03333
+ range_min: 0.45
+ range_max: 50.0
+ use_inf: true
+ inf_epsilon: 1.0
+
+ # Concurrency level, affects number of pointclouds queued for processing and number of threads used
+ # 0 : Detect number of cores
+ # 1 : Single threaded
+ # 2->inf : Parallelism level
+ concurrency_level: 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ROS_Assignment 2/package.xml b/ROS_Assignment 2/package.xml
new file mode 100644
index 0000000..c96e916
--- /dev/null
+++ b/ROS_Assignment 2/package.xml
@@ -0,0 +1,83 @@
+
+
+ my_package
+ 0.0.0
+ The my_package package
+
+
+
+
+ jack
+
+
+
+
+
+ TODO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ catkin
+ gazebo_ros
+ pointcloud_to_laserscan
+ roscpp
+ rviz
+ smb_control
+ smb_description
+ smb_gazebo
+ std_msgs
+ gazebo_ros
+ pointcloud_to_laserscan
+ roscpp
+ rviz
+ smb_control
+ smb_description
+ smb_gazebo
+ std_msgs
+ gazebo_ros
+ pointcloud_to_laserscan
+ roscpp
+ rviz
+ smb_control
+ smb_description
+ smb_gazebo
+ std_msgs
+
+
+
+
+
+
+
+
diff --git a/ROS_Assignment 2/params.yaml b/ROS_Assignment 2/params.yaml
new file mode 100644
index 0000000..2c92ebf
--- /dev/null
+++ b/ROS_Assignment 2/params.yaml
@@ -0,0 +1,3 @@
+scan_subscriber:
+ topic_name: "/scan"
+ queue_size: 1
diff --git a/ROS_Assignment 2/smb_highlevel_controller.cpp b/ROS_Assignment 2/smb_highlevel_controller.cpp
new file mode 100644
index 0000000..9949f4c
--- /dev/null
+++ b/ROS_Assignment 2/smb_highlevel_controller.cpp
@@ -0,0 +1,32 @@
+#include
+#include
+#include
+#include
+#include
+
+
+void laserScanCallback(const sensor_msgs::LaserScan& msg){
+ if (!msg.ranges.empty()) {
+ float min_distance = *std::min_element(msg.ranges.begin(), msg.ranges.end());
+ ROS_INFO("smallest distance: [%f]", min_distance);
+ } else {
+ ROS_WARN("warning: empty msg");
+ }
+}
+
+
+
+int main(int argc, char** argv)
+{
+ ros::init(argc, argv, "listener");
+ ros::NodeHandle nh;
+ std::string laser_topic_name;
+ int laser_queue_size;
+ nh.param("scan_subscriber/topic_name", laser_topic_name, "/scan");
+ nh.param("scan_subscriber/queue_size", laser_queue_size, 1);
+
+
+ ros::Subscriber laser_sub = nh.subscribe(laser_topic_name, laser_queue_size, laserScanCallback);
+ ros::spin();
+ return 0;
+}