Hi The Construct Team,
I found that some parts of the ROS2 Basics in 5 Days Galactic C++ course seem to be copied from ROS Basics in 5 Days course.
This post contains the necessary changes that are needed in the ROS2 Basics in 5 Days Galactic C++ course.
I will try to keep this issue updated as and when I see any errors so that the tutorial does not misguide any new students, especially those taking ROS2 Basics in C++ for the first time without taking ROS(1).
Main Request : We need chapter quizzes for chapters 1 and 2. At the moment [as of 28/09/2022], clicking on “Mark Unit as Completed” does not give any quizzes.
Changes:
[More to come in the future, if found]
Thanks,
Girish
Continuation of Post - Part 2
-
Doing user:~$ source .bashrc_ros2
prints:
user:~$ source .bashrc_ros2
bash: /opt/ros/foxy/setup.bash: No such file or directory
ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different
distributions.
user:~$ cat .bashrc_ros2
gives:
user:~$ cat .bashrc_ros2
# ROS2
export ROS_DISTRO=foxy
source /opt/ros/$ROS_DISTRO/setup.bash
source /home/user/ros2_ws/install/local_setup.bash
source /home/simulations/ros2_sims_ws/install/setup.bash
replacing export ROS_DISTRO=foxy
with export ROS_DISTRO=galactic
never persists, that is, get reset back to export ROS_DISTRO=foxy
upon webshell reset.
-
ros2 interface proto <interface_type>
can be used in place of ros2 topic echo /topic_name
.
Reason: The topic that actually has the interface_type may not be available to perform echo. You can also avoid a bunch of those messages from being printed with echo.
-
Some changes in units 3.5 and 3.6. First time users might just complain that it does not work after copy-pasting the code. This correction would focus on avoiding that.
-
Could not submit actions_quiz
for AutoGrader / GradeBot correction. The “green tick symbol” is not available and no quiz / questions when “Mark Unit as Completed”, [as of 29/06/2022].
Thanks,
Girish
Hello @girishkumar.kannan ,
Many thanks for the great feedback! I’ve already fixed most of the issues presented in the post. As for the Quizzes, there is currently an issue we are working on solving. Hopefully, it will be solved today.
1 Like
Additionally @girishkumar.kannan ,
In which unit did you find the source .bashrc_ros2
instruction? I’ve been looking through the notebooks but couldn’t find it.
@albertoezquerro ,
That information is mentioned in ROS2 Basics with Python. It is not explicitly mentioned in any of the units of ROS2 Basics with C++, at the moment.
[Actually, my bad that I did it because I got used to that command from doing Python version of the course].
You may include that or ignore it.
Thanks,
Girish
1 Like
Continuation of Post - Part 3
-
Code Review Chapter 4.3.1
-
Solution to Exercise 4.1 - Service Client to Stop the Robot
-
Code Review Chapter 4.6.1
-
Services Quiz Description
Thanks,
Girish
Continuation of Post - Part 4
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
- Chapter 5 - ROS2 Actions with C++ : Actions Quiz Instructions
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
-
Chapter 7 - Node Composition:
- in file moverobot_component.hpp,
#include "my_components/visibility_control.h"
becomes #include "visibility_control.h"
Modified **moverobot_component.hpp** file here.
#ifndef COMPOSITION__MOVEROBOT_COMPONENT_HPP_
#define COMPOSITION__MOVEROBOT_COMPONENT_HPP_
#include "geometry_msgs/msg/twist.hpp"
#include "rclcpp/rclcpp.hpp"
#include "visibility_control.h"
namespace my_components {
class MoveRobot : public rclcpp::Node {
public:
COMPOSITION_PUBLIC
explicit MoveRobot(const rclcpp::NodeOptions &options);
protected:
void on_timer();
private:
rclcpp::Publisher<geometry_msgs::msg::Twist>::SharedPtr pub_;
rclcpp::TimerBase::SharedPtr timer_;
};
} // namespace my_components
#endif // COMPOSITION__MOVEROBOT_COMPONENT_HPP_
- in file moverobot_component.cpp,
#include "my_components/moverobot_component.hpp"
becomes #include "moverobot_component.hpp"
, also this include line comes after system includes like chrono, iostream, memory, utility.
Modified **moverobot_component.cpp** file here.
#include <chrono>
#include <iostream>
#include <memory>
#include <utility>
#include "moverobot_component.hpp"
#include "geometry_msgs/msg/twist.hpp"
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
using namespace std::chrono_literals;
namespace my_components {
MoveRobot::MoveRobot(const rclcpp::NodeOptions &options)
: Node("moverobot", options) {
pub_ = create_publisher<geometry_msgs::msg::Twist>("cmd_vel", 10);
timer_ = create_wall_timer(1s, std::bind(&MoveRobot::on_timer, this));
}
void MoveRobot::on_timer() {
auto msg = std::make_unique<geometry_msgs::msg::Twist>();
msg->linear.x = 0.3;
msg->angular.z = 0.3;
std::flush(std::cout);
pub_->publish(std::move(msg));
}
} // namespace my_components
#include "rclcpp_components/register_node_macro.hpp"
RCLCPP_COMPONENTS_REGISTER_NODE(my_components::MoveRobot)
- Keeping
my_components/...
will cause colcon build
to fail with following error messages:
**colcon build** error messages
user:~/ros2_ws$ colcon build --packages-select my_components && source install/setup.bash
Starting >>> my_components
--- stderr: my_components
/home/user/ros2_ws/src/my_components/src/moverobot_component.cpp:6:10: fatal error: my_components/moverobot_component.hpp: No
such file or directory 6 | #include "my_components/moverobot_component.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~compilation terminated.
make[2]: *** [CMakeFiles/moverobot_component.dir/build.make:63: CMakeFiles/moverobot_component.dir/src/moverobot_component.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/moverobot_component.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed <<< my_components [0.40s, exited with code 2]
Summary: 0 packages finished [0.82s]
1 package failed: my_components
1 package had stderr output: my_components
user:~/ros2_ws$
user:~/ros2_ws$ colcon build --packages-select my_components && source install/setup.bash
Starting >>> my_components
--- stderr: my_components
In file included from /home/user/ros2_ws/src/my_components/src/moverobot_component.cpp:6:
/home/user/ros2_ws/src/my_components/include/moverobot_component.hpp:5:10: fatal error: my_components/visibility_control.h: No such file or directory
5 | #include "my_components/visibility_control.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/moverobot_component.dir/build.make:63: CMakeFiles/moverobot_component.dir/src/moverobot_component.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/moverobot_component.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed <<< my_components [0.39s, exited with code 2]
Summary: 0 packages finished [0.78s]
1 package failed: my_components
1 package had stderr output: my_components
user:~/ros2_ws$
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
-
Chapter 7 - Node Composition - Exercise 7.2 - Link to Solution has Error.
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
Thanks,
Girish
Continuation of Post - Part 5 - Final Part !
Correction in Final “Extra” Chapter - Chapter 8 - ROS1 Bridge
Subtopic E.2 - Parameter Bridge
To create **catkin_ws** directory
Issue the following lines into your terminal:
cd /home/user
source /opt/ros/noetic/setup.bash
mkdir -p ./catkin_ws/src
cd catkin_ws
catkin_make
Modified **topics.yaml** for reference
topics: [{topic: /joint_states,
type: sensor_msgs/msg/JointState,
queue_size: 100},
{topic: /tf,
type: tf2_msgs/msg/TFMessage,
queue_size: 100}]
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
This will be the End of all Corrections for this course !
Thanks,
Girish
Many thanks for the feedback @girishkumar.kannan !
I will take care of all the remaining issues today.
1 Like
Hi @albertoezquerro ,
Thanks for all the fixes! Much appreciated. I have also verified them.
There is one minor correction still required. As in attached image below.
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
I am marking this post as solved with your previous reply!
Thanks,
Girish
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.