July 12, 2024
Today, I began by fixing the launch files that I made yesterday. The launch files I made yesterday were different names, so calling them each time for each robot was a bit of a hassle. This time, I made every launch file the same for each robot, and then using the platform module and the platform.node() function, I could concatenate the robot host name to the front of all the topics and nodes.
Then, I worked on a node that would publish the angular error between the center of the AprilTag and the robot's camera. To do so, I created a triangle with the x-displacement and y-displacement between the center of the AprilTag and the center of the camera, and then used that triangle to find the angle between them. Then, I published this angular error as a float64 message, and then with another program that converted the node's float64 message to a Twist message, I could move the robot's motors so that the robot would turn to follow the AprilTag.
Finally, I read a bit of documentation about PushRosNamespace. To use this action, I first created another launch file named camera_namespace_launch.py, for example. I first included the original camera_launch.py inside the new launchfile, and then I applied a namespace, which is the robot's hostname, in order to distinguish the nodes and topics. I thought that with this, I could call this new launch file once and it would launch the child launch file on both robots at the same time, but when I tried this, it only worked for one.
I had one question about how to get the distance error. I was thinking about looking at the distance between the AprilTag corners. If the distances are small compared to some value, it means the tag is far away, while if the distances are big, it means the tag is close. Is there an easier way to find the distance error?
Comments
Post a Comment