问:
How to design a PID controller for boat?
I have a boat with two trusters and a trajectory planner which is based on the bicycle model. In order to control the boat, the linear velocity of each truster has to be provided.

The following information is known for trajectory tracker: position $P_d$, linear velocity $v_d$,and desired yaw angle $\theta_d$ and desired yaw rate $\omega_d$

The following information is known for the boat: current position $P_a$ and current yaw angle $\theta_a$ and yaw rate $\omega_a$

The objective is to navigate the boat according to the trajectory planner. I was trying to develop a PID controller. But still no luck. The following steps have been carried out, not sure exactly what is the correct way to achieve this?

PID controller

$v = k_p(P_d - P_a) - k_d v_a, \quad \omega = k_a(\theta_d-\theta_a) - k_v \omega_a$

Control signals (left and right velocities):

$v_l = v - k_1\omega, \quad v_r = v + k_1 \omega$, where $k_1$ is a constant.

If a PD controller can not be used for the boat, could someone suggest to me what kind of way to control the boat?

答:
It should be perfectly fine to control the boat with two thrusters (i.e. propellers with some distance in between them), via a PID control scheme. To compensate for ambiguities in the model and the real world (e.g. streams, wind, thruster inequalities, etc) integral terms are required, but I didn't include them in the following answer. :)

Your definition of velocity controller seems incorrect, in the derivative term.

```<code>define PositionError = Pdesired - Pactual;
define DerivativeOfPositionError = (PositionError - PreviousPositionError)/deltaTime
v_temporary = Kp * (PositionError) + Kd * (DerivativeOfPositionError)
</code>```

Btw, Position should be a vector (of latitude and longitude) but I'm leaving it to you(or others) to work out the geometric relationships (of position and yaw angle). The question is about the Controller not the Navigator, as far as I understand.

```<code>// the naming of w is somewhat misleading, so name it YawControl
YawControl = Kp_yaw * (Theta_desired - Theta_actual) + Kp_yawRate * (w_desired - w_actual)
</code>```

Important Note: There are two different (and related) variables being controlled with a single control command. This assumes that YawRate demand (w_desired) coming from the trajectory controller is consistent and convergent. Otherwise, the solution might not converge, i.e. the boat can oscillate around a Heading.

The rest is OK. You simply assign YawControl to left and right thrusters, with a scale factor, k1.

Body:
It should be perfectly fine to control the boat with two thrusters (i.e. propellers with some distance in between them), via a PID control scheme. To compensate for ambiguities in the model and the real world (e.g. streams, wind, thruster inequalities, etc) integral terms are required, but I didn't include them in the following answer. :)

Your definition of velocity controller seems incorrect, in the derivative term.

define PositionError = Pdesired - Pactual;
define DerivativeOfPositionError = (PositionError - PreviousPositionError)/deltaTime
v_temporary = Kp * (PositionError) + Kd * (DerivativeOfPositionError)

Btw, Position should be a vector (of latitude and longitude) but I'm leaving it to you(or others) to work out the geometric relationships (of position and yaw angle). The question is about the Controller not the Navigator, as far as I understand.

// the naming of w is somewhat misleading, so name it YawControl
YawControl = Kp_yaw * (Theta_desired - Theta_actual) + Kp_yawRate * (w_desired - w_actual)

Important Note: There are two different (and related) variables being controlled with a single control command. This assumes that YawRate demand (w_desired) coming from the trajectory controller is consistent and convergent. Otherwise, the solution might not converge, i.e. the boat can oscillate around a Heading.

The rest is OK. You simply assign YawControl to left and right thrusters, with a scale factor, k1.


问:
Where can I get a driver for the create2?
I just bought a create2 and wanted to connect it with my laptop. Unfortunatly my laptop is not able to recognice the create2. I suppose I need a driver to solve this. Does anyone know where a fitting driver is to download?
Thank you</p>

答:
You didn't say what operating system your laptop runs, so I'll assume Windows.

I suspect you need a USB-to-UART bridge driver. The one I use (albeit for an ESP32) was downloaded from Silicon Labs.
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

Once Windows itself recognizes the device, a COM port will get assigned. Mine always gets COM3. Also your software and your device need to agree on the classic UART parameters, most importantly speed (like 115200).

Good luck! I hope it works as well for Create2 as for ESP32.

ContentLicense: CC BY-SA 4.0


问:
How to abstract go to goal angle?
I'm currently developing a pygame based go to goal behavior. I approached the goal by Euclidean distance and vectorized mathematics. Here is the code

```<code>def move(roborect,i):

no_plants=len(test_x)
if(no_plants>i):
    dx = 8*test_x[i]-roborect.x
    dy = test_y[i]-roborect.y
    distance = math.sqrt(dx*dx + dy*dy)
    print(distance)
    if distance > 70:
        vx = dx * 2/ distance
        vy = dy * 2 / distance
    #print(vx,vy)
        #print(roborect.x,roborect.y)
        roborect.x += vx
        roborect.y += vy
    else:
        return 1
</code>```

But I could not understand to approach the orientation of the robot towards to goal.Please help.

答: What have you tried?  This seems like it should simply be the inverse tangent of dy/dx.</p>

Title: How to abstract go to goal angle?


问:
Is there a way to send commands to the Staubli CS9 from remote system via TCP/IP??(like ur_rtde, urx libraries for UR robots)
I am new to ROS development and Staubli robots. Though i have some prior knowledge on UR5e, I am finding it hard to understand the architecture of Staubli and its other programming interfaces (like staubli robotics suite) and more importantly, is there a way to send commands to the robot from remote system via TCP/IP??(like ur_rtde, urx libraries for UR robots).

So can anyone suggest a beginners tutorial or a guide where i can get a good understanding on the staubli's architecture(VAL3, SRS) and its ROS interfacing. I am not able to find much information or troubleshooting tutorials in the internet (no idea why). It looked like a very closed loop for a beginner like me. Any help from your side would be very helpful.

Thanks in advance. As i can't find any good forums (like UR forums) for Staubli (please suggest one,if anyone knows) , I thought this would be helpful for me.

答:
I don't know about ROS, but if you have Stäubli Robotic Suite you can write a program to read your TCP/IP commands (as a TCP client, server or UDP) and do whatever you want.

You need to go into the Physical I/O tab and modify the socket card, at this point you can add and set the way you want a new UDP/TCP server/TCP client.

If you want a tutorial about it there's one here: SRS 2016 TUTO 5 - Virtual wiring. It's part of a full introduction tutorials to SRS.


问:
Zero crossing events with brushless DC motors
I would like to ask a question about zero crossing event in a trapezoidal commutation on a brush-less DC motor. Here is a waveform that shows that the zero crossing event occurs every 180 electrical degrees in a sinusoidal commutation:

But what about trapezoidal commutation. Here is the waveform that I found about the trapezoidal commutation:

So as you see, the zero crossing occurs 30 electrical degrees after the previous commutation and 30 electrical degrees before the next commutation.
In a motor with one pole pair, we would have 30 electrical degrees = 30 mechanical degrees, so we would have this waveform:
You see that the zero crossing in phase A occurs when the magnet faces the phase C, or in other words, after 30 electrical degrees from the last commutation.
My question in why does the zero crossing happen at that moment, why not after 60 electrical degrees, or 15 electrical degrees?
Is it related to some law's of induction? What are those law and how do this law's appear in this motor?
Can someone explain to me this with some pics?

答:
First, some background to make sure we are clear on the basics:

1 mechanical degree = 1/360th of a full mechanical rotation

1 electrical degree = 1/360th of a full AC cycle

Zero crossing = the point where the voltage equals 0

Image from https://upload.wikimedia.org/wikipedia/commons/0/03/Zero_crossing.svg

Now, in an electric motor with 2 poles, a full AC cycle is needed to make 1 full mechanical rotation. So 1 electrical degree = 1 mechanical degree, and the zero crossing occurs twice, i.e once every 180 degrees.

"Sensored" Mode

You say that in sensored mode, the hall sensor tells you to commutate once every 60 degrees, so your zero crossing occurs once per 60 degrees, and the full AC cycle once per 120 mechanical degrees, which means you make 3 full AC cycles per 1 mechanical rotation.

That means your "sensored" motor has 6 poles (3 pole pairs).

Sensorless Mode

I found while searching that the zero crossing happens 30 electrical degrees after the previous commutation

Where did you find this? Looking at the linked chart above, shouldn't the commutation occur every 180 electrical degrees always? And the zero crossing should always be in the middle between 2 commutations, which means it is always going to happen 90 electrical degrees after (or before) a commutation.

If you meant 30 mechanical degrees, then we can say the commutation happens every 60 mechanical degrees (also the zero crossing happens every 60 mechanical degrees). This means a full AC cycle takes 120 mechanical degrees, so 3 full AC cycles per 1 mechanical rotation, which agrees with the information from the "sensored" mode.

ContentLicense: CC BY-SA 3.0


问:
Robotic Tasks in relation with components
I will try to ask the best i can:

Our Human Body has parts like arms, legs, head etc. An arm can rotate 360 degrees. Arm has a hand with five fingers which can grip, poke, push etc.

How would we address the same for a robot in technical terms?

I am really sorry if i do not explain it well enough ( my english is not very good).

答:
You question is pretty vague, but I am assuming that you are looking for a mathematical representation of a robot in terms of DoFs. We have Denavit-Hartenberg parameters to describe robot arms. I suggest you look search for more information on D-H parameters. There are questions and answers on this website about this subject as well. I suggest you look into Spong's Robot Modeling and Control to learn more about these.

Other than that, I am not sure what else you are asking for as your question is vague.


问:
Servos jittering problem
So I started building this 3D printed Bluetooth robotic arm that can be controlled via MIT app inventor from HowToMechatronics.com. After connecting all the servos and running the code, the servos seem to be jittering and doesn't follow the orders from the app. I have tried to increases the voltage from the external power supply and have also tested each servo individually but the outcome however was the same. Please do let me know if you have any suggestions or advice regarding this issue, I would be happy to try them out.

The setup I have, is approximately the following:

This is the link for the codes: https://github.com/darren-noyce/RoboticArm.git

If someone could help me to understand what's wrong, I would greatly appreciate it. Thanks.

答:
Since 1 servo at a time works, can you try 2 at time, then 3 at a time, and so on?

There is also a chance that you are seeing either noise or cross talk between the servo channels.

Title: Servos jittering problem


答:
Servo motors draw a lot of current. A 9-gram micro servo is the only servo you can drive off of an Arduino, and that means barely loading it. You will definitely need a separate power source for your servos. Remember, the arduino can only deliver 100 milliamps, so you should avoid using Arduino power sources as much as possible.
You also need ot make sure that the voltage on the servos is correct. I see 3 larger servos and 3 smaller servos. Are they all really 5 volt servos? I would guess that the larger servos are 7.2 or 9  or 12 volt servos. No matter how you slice it, you need to redo your power supply setup before continuing further. I concur with other users: you should start small and then add more as you go. If 1 or 2 servos work, but more don't work, it probably has to do with your power requirements.

EDIT:

Given your comment with the servo code, and your arduino pin choice, I suggest you look at a pinout diagram. Given your code, you are using non-pwm pins to drive servos. That is a mistake. Use PWM pins only.

Title: Servos jittering problem

Body:
So I started building this 3D printed Bluetooth robotic arm that can be controlled via MIT app inventor from HowToMechatronics.com. After connecting all the servos and running the code, the servos seem to be jittering and doesn't follow the orders from the app. I have tried to increases the voltage from the external power supply and have also tested each servo individually but the outcome however was the same. Please do let me know if you have any suggestions or advice regarding this issue, I would be happy to try them out.

The setup I have, is approximately the following:

This is the link for the codes: https://github.com/darren-noyce/RoboticArm.git

If someone could help me to understand what's wrong, I would greatly appreciate it. Thanks.


问:
Robotics Structure
I am a kind of a new developer and a beginner in Robotics and AI. I am currently learning using the Arduino Uno starter kit. My knowledge on C & C++ is on the beginner's level but i get the whole idea and flow of data.

I want to build a mini robot that can behave as a pedestrian. Navigate within a city as a pedestrian using a GPS system. It will have to "walk" any kind of terrain that it will encounter in a city e.g pavement, stairs e.t.c.

My question is, having in mind that it will never have to charge itself, what is the best build system in order for that robot to be able to do that? What kind of sensors will be needed apart from camera(visual)?

I know this is a very general question. I am very new to this so please bare with me. Any information and guidance much appreciated.

答: Look at the Duckietown project.  It is a robot (the Duckiebot) and an urban environment for learning about robotics and autonomy.  There is an Edx MOOC and curriculum designed for undergraduate university level.  The Duckiebot can be purchased as a kit from the Duckietown org, or you can build your own DIYDuckie.  Duckiebot is based on Python and ROS2 and and is open source.  ROS is pretty complex for an introduction to robots.  You might also try Donkeycar which is a popular python framework for creating autonomous racing cars from an RC (I'm a maintainer on that project).  As a first robot, this project that I created is easy to build and inexpensive (about $40 in parts); it includes a camera and can be extended in JavaScript.</p>

Title: Robotics Structure


问:
Recommended building materials for building a robot WITHOUT 3D printer?
I have a ton of ideas for building a robot using an arduino and raspberry pi. I have an assembled the wheels and chassis, and now I am left with an ugly raspberry pi and arduino + wires. It works, but I want to make a body / case to cover all the electronics.

I DO NOT have a 3D printer, I want one, but I currently don't have the $$ or space for it. Do you have any recommendations on materials that I can use instead of using a 3D printer service.

I am thinking about something along the lines of an erector set / legos, but I want something more durable, yet something I can cut holes in. I've seen the plastics that you boil and then shape with your hands, like Play-dough, but I'd have to make molds / take a lot of time to hand-craft parts out of it.

Any ideas for an alternative to a 3D printer?

Thanks!

答:
With consideration cheap, strong enough, not ugly and easy to shape, then my recommendation is you can use clipboard. I have seen people win international robotic competition with robot made using clipboard. So this idea worth to try.

Figure 1. Clipboard


答:
I have working with multiple servo for serial manipulator control. I recommend this following step to troubleshoot :

Make sure u gave it the right voltage

Read the datasheet and make sure your power source match with datasheet

Make sure u gave the right control signal

Read again the datasheet, what period of your servo control system.

Give more power

I see you try to increase the voltage to power your servo. DON'T! Do not give it more voltage than it stated at datasheet (I burnt 3 servos lol). Give your servo with same voltage but more amperage. In my case I use 5v 2 Amp and it didnt move. But when i change to 5v 10 Amp it work perfectly fine.

Since u ever increase voltage, check if your servo still working, maybe it already broken.

Hope that help

Title: Servos jittering problem


问:
How can I integrate a smart phone with my robotics project?
Smart phones these days typically come with a gyroscope, accelerometer, compass, camera, and GPS sensor all on board. They also usually have a connection to the internet with Wifi and mobile data networks. I've seen many cases of using a phone as a remote control for a robot, but to me, it seems like the phone itself is a perfect lightweight computing and sensing platform for an autonomous robot.

The main obstacle I see is interfacing with actuators. Being able to control motors to steer even a table-top robot, or control servos, for example. Connecting and communicating to a microcontroller could be an obstacle as well.

As a robot hobbyist, I'd like to know how I can overcome these and other obstacles to be able to harness the power of my smart phone with my robotics projects.

答:
The Android Accessory Development Kit (ADK) should do everything you need.

It's an Arduino board that is specifically designed to interact with Android. You can connect the two over Bluetooth or USB (or WiFi/Ethernet, I think).

Since the whole architecture is open, you can use each part for what it's best at. You write the Android code to get data from the phone's built-in sensors and control the display. And you write the Arduino code to control actuators, servo's and other sensors that phone's don't come. The code to communicate between the two is provided open source via Google.

From the Arduino Blog:

The Android Open Accessory Development Kit (ADK) provides an
  implementation of an Android USB accessory that is based on the
  Arduino open source electronics prototyping platform, the accessory’s
  hardware design files, code that implements the accessory’s firmware,
  and the Android application that interacts with the accessory. The
  hardware design files and code are contained in the ADK package
  download.

Most of the examples are designed around using the phone as a graphical interface for some sort of hardware accessory like a clock. But there's no reason you couldn't access the phone's sensors as well and pass data back and forth.

Adafruit even mentions using it to make robots on their store's page for the ADK:

Fast track your Android phone hardware development or just design
  cell-phone robots with the Arduino ADK! The Arduino ADK is a
  microcontroller board based on the powerful ATmega2560 (datasheet). It
  has a USB host interface to connect with Android based phones, and a
  power supply boost converter to charge up the phone from DC power
  while its plugged into the ADK

(emphasis mine)


问:
Access denied during PIC Programming in Windows XP
I'm programming a PIC16F77 with ProPic 2 which communicates via serial port. As I don't have this port in my PC, I used serial to USB adapter.
I'm using ICProg in Windows 8.

I've proggrammed it before but it was in Windows XP using the driver who specifies in http://www.ic-prog.com/index1.htm and worked perfectly.
But in this OS the only difference is the adapter, the program gives some errors while loading the driver:

"Error occured (Access is denied) while loading the driver!"

"Privileged instruction"

答:
If you're running this from command prompt, try this when launching command prompt: Right click. Run as administrator.

Then use as usual.


答:
Consider things like food storage containers, dishpans, and household storage bins. Some (HDPE?) ones are reasonably stiff yet compliant, and you can readily cut them. Beware the beautiful, crystal-clear ones that are hard and brittle.

If you're in the US, take a walk through your local Target or Walmart, and see whether some Rubbermaid or Tupperware shapes and sizes seem to suit your purposes.

Title: Recommended building materials for building a robot WITHOUT 3D printer?

Body:
I have a ton of ideas for building a robot using an arduino and raspberry pi. I have an assembled the wheels and chassis, and now I am left with an ugly raspberry pi and arduino + wires. It works, but I want to make a body / case to cover all the electronics.

I DO NOT have a 3D printer, I want one, but I currently don't have the $$ or space for it. Do you have any recommendations on materials that I can use instead of using a 3D printer service.

I am thinking about something along the lines of an erector set / legos, but I want something more durable, yet something I can cut holes in. I've seen the plastics that you boil and then shape with your hands, like Play-dough, but I'd have to make molds / take a lot of time to hand-craft parts out of it.

Any ideas for an alternative to a 3D printer?

Thanks!


问:
How to setup ROS and it's GUI tools in local server and connect to local macbook
I recently started learning ROS and I am having Macbook (MacOS Catalina) which is not ideal for running ROS. So, I decided to install ROS in my local home ubuntu 20.04 desktop server and connect it to my local Macbook, but I was searching for the setup all over the internet but I didn't find any so please help me to set up it.</p>

答:
On a general level, if we're talking about ROS1, then you can use your Macbook to send/receive ROS topics/services/parameters etc. using SSH to/from your Ubuntu server, where ROS master runs. I've mostly used this without GUI, since in my use case I have RViz installed on my client machine that I can use to process/display ROS topics etc., but you can use VNC to gain GUI access to your Ubuntu server as well.

Non-exhaustive list of steps you may need to perform:

Getting both server and client machines on the same network.

Setting up an SSH server on your Ubuntu machine and an SSH client on your Macbook.

Follow the steps listed here to set up the connection between the machines: http://wiki.ros.org/ROS/NetworkSetup. After you're done here you should be able to run some nodes on the Ubuntu server and receive the topics on your Macbook.

Set up VNC if you want to export the entire Ubuntu server session to your Macbook, effectively giving you full GUI access. There should be plenty of VNC servers available that you can find online.

I haven't done too much ROS2 to tell you about that though.


问:
Best way to power Raspberry Pi 4 8GB + Arduino Uno Robot?
I am building a robot that uses an arduino to drive 4 mecanum wheels, which will be controlled by a  Raspberry pi 4 8GB with the Lobe Machine Learning Hat via a serial connection.

I'm fine with having the robot be "wired" for the development, but I would like the final product to be completely wireless. I've purchased a power bank from Amazon that claims to have a 5V/3A output via a USBC port, but I'm skeptical.

Does anyone have any recommendations for a portable power solution for the pi + lobe camera + arduino uno + 4 DC motors, and potentially a few other sensors? I'm also looking for any other guides/videos that build something similar.

Thank you!

答:
For arduino and raspberry, powerbank is enough to power them for several hours. But the only problem i ever face when using powerbank is they sometime auto turn off because how little arduino current draw.

For dc motor, use lipo or any equvalent battery. So you would have enough power to move your wheels and make your robot have better mobility.


问:
How can I input joint angles to transformation matrix to get position in matlab?
I am trying to get the forward kinematics for a robot model in matlab (rigid body tree).
I created a 4 x4 transformation matrix from the base to the end-effector using the gettransform() function. I have 4 different joint angles to control. But how do I multiply the joint angles with the transformation matrix so that I get the correct orientation and position output of the end-effector?

Is there otherwise a better option to get the forward kinematics?

Thanks!

答:
After looking the documentation, in function gettransform you put your joint angle configuration there in radians.

Create the struct containing your join value

s = struct(nameofjoint1, valueofjoint1,..., nameofjointN, valueofjointN)

Get the position and orientation of your end-effector

    % Syntax

    % transform = getTransform(robot,jointconfiguration,startframe,lastframe)

    transform = getTransform(robot,s,'L1','L4')
```


答:
The Lithium polymer and Lithium ion batteries are a staple for this sort of robotics rig. They produce voltage levels in multiples of 3.7-4.2v. You’ll need at least a 2-cell series (2S).

Since your control circuitry will require logic-level voltages, you’d use a Buck converter to take the battery output down to 5v for the Pi and Arduino. 1A and 3A modules are available and should satisfy just about any small number of sensors that you could wire to those chips. Do the math to find what your current needs are.

For the motors, it’s common to run them straight from the battery. Here you’ll want to make sure the battery produces the voltage range desired by the motors you have. Be aware that speeds will decline slightly as your battery discharges. If you want a more controlled voltage source for the motors, you could design your own Buck converter for that.

Be sure to take the appropriate precautions (flyback diodes) for any power rails that feed inductive loads like motors.

Title: Best way to power Raspberry Pi 4 8GB + Arduino Uno Robot?

Body:
I am building a robot that uses an arduino to drive 4 mecanum wheels, which will be controlled by a  Raspberry pi 4 8GB with the Lobe Machine Learning Hat via a serial connection.

I'm fine with having the robot be "wired" for the development, but I would like the final product to be completely wireless. I've purchased a power bank from Amazon that claims to have a 5V/3A output via a USBC port, but I'm skeptical.

Does anyone have any recommendations for a portable power solution for the pi + lobe camera + arduino uno + 4 DC motors, and potentially a few other sensors? I'm also looking for any other guides/videos that build something similar.

Thank you!


问:
Unable to figure out the source for the bad_alloc error
I am getting a bad_alloc error when I try to use the costmap_2d::Costmap2DROS::getRobotPose function inside the makePlan function. Interestingly, if I call the same function from inside the initialize function (instead from inside the makePlan function), no error pops up.

I am attaching the relevant functions from my source code file.

```<code>#include <pluginlib/class_list_macros.h>
#include <my_global_planner/global_planner.h>
#include <tf/tf.h>
#include <queue>
#include<math.h>
#include <cstdlib>
#include <ctime>
#include<visualization_msgs/Marker.h>

//register this planner as a BaseGlobalPlanner plugin
PLUGINLIB_EXPORT_CLASS(global_planner::GlobalPlanner, nav_core::BaseGlobalPlanner)

using namespace std;

namespace global_planner {

  GlobalPlanner::GlobalPlanner (){

  }

  GlobalPlanner::GlobalPlanner(std::string name, costmap_2d::Costmap2DROS* costmap_ros){
    initialize(name, costmap_ros);

  }

  void GlobalPlanner::initialize(std::string name, costmap_2d::Costmap2DROS* costmap_ros){

    nh_ = ros::NodeHandle{"~abcd"};

    costmap_ros  = costmap_ros;
    costmap_ros_ = costmap_ros->getCostmap();

    size_x = costmap_ros_->getSizeInCellsX();
    size_y = costmap_ros_->getSizeInCellsY();

    geometry_msgs::PoseStamped global_pose_;
    costmap_ros->getRobotPose(global_pose_);

    cout << "global_pose_.x: " << global_pose_.pose.position.x << " global_pose_.y: " << global_pose_.pose.position.y << endl;

    cout << "Sleeping for 3 seconds!" << endl;
    ros::Duration(3.0).sleep();

    cout << "global_frame: " << costmap_ros->getGlobalFrameID() << endl;

    global_plan_pub = nh_.advertise<nav_msgs::Path>("my_global_path", 1 );
    goal_marker_pub = nh_.advertise<visualization_msgs::Marker>("goal_markers", 10);

    marker_id_cnt = 0 ;

    update_map_bounds();

    //pose_sub = nh_.subscribe("/camera/depth_registered/points", 1000, &GlobalPlanner::initialpose_callback, this);

    //pose_sub = nh_.subscribe("/camera/depth_registered/points", 1000, boost::bind(&GlobalPlanner::initialpose_callback, this, _1));

  }

bool GlobalPlanner::makePlan(const geometry_msgs::PoseStamped& start, const geometry_msgs::PoseStamped& goal,  std::vector<geometry_msgs::PoseStamped>& plan ){

    //Djikstra's Algorithm
    __uint32_t mx_i, my_i, mx_f, my_f;

    print_world_params(start, goal, mx_i, my_i, mx_f, my_f);

    Point curr_point = Point{mx_i, my_i};

    Point goal_point = Point{goal.pose.position.x, goal.pose.position.y};

    bool reached = false;

    //srand((__uint32_t)time(0));

    cout << "Testing costmap_ros for consistency!" << endl;

    cout << "ros_costmap->getGlobalFrameID(): " << costmap_ros->getGlobalFrameID() << endl;
    cout << "Sleeping for 2 seconds!" << endl;
    ros::Duration(2.0).sleep();

    cout << "Trying to fetch global_pose of the robot!" << endl;
    geometry_msgs::PoseStamped global_pose_;
    costmap_ros->getRobotPose(global_pose_);

    cout << "global_pose.x: " << global_pose_.pose.position.x << " global_pose_.y: " << global_pose_.pose.position.y  << endl;

    //generate_next_goal();

    return true;

  }

</code>```

I am also attaching the relevant header file -

```<code>/** include the libraries you need in your planner here */
/** for global path planner interface */
#include <ros/ros.h>
#include <costmap_2d/costmap_2d_ros.h>
#include <costmap_2d/costmap_2d.h>
#include <nav_core/base_global_planner.h>
#include <geometry_msgs/PoseStamped.h>
#include <angles/angles.h>
#include <base_local_planner/world_model.h>
#include <base_local_planner/costmap_model.h>
#include <map>
#include<nav_msgs/Path.h>

#ifndef GLOBAL_PLANNER_CPP
#define GLOBAL_PLANNER_CPP

namespace global_planner {

    class GlobalPlanner : public nav_core::BaseGlobalPlanner {

        struct Point {

                __uint32_t x, y;

                bool operator==(const Point &p1 ) const{   return ((p1.x == x) && (p1.y == y));  }

                bool operator<(const Point &p1 ) const{    return ((p1.x < x) || (p1.x == x && p1.y < y) ) ;  }

            };

        struct Cell {

            Point point;
            __uint32_t cost_till_now;

            bool operator<(const Cell &c1) const {

                return (c1.cost_till_now < cost_till_now || (c1.cost_till_now == cost_till_now && c1.point < point));

            }

        };

        public:

            GlobalPlanner();

            GlobalPlanner(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
            void initialize(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
            bool makePlan(const geometry_msgs::PoseStamped& start,const geometry_msgs::PoseStamped& goal,std::vector<geometry_msgs::PoseStamped>& plan);

        private:

            double heu(Point p1, Point p2);
            void update_planner_plan(std::vector<Point> &path_points, std::vector<geometry_msgs::PoseStamped> &plan, const geometry_msgs::PoseStamped &goal);
            void publish_global_path(const std::vector<geometry_msgs::PoseStamped> &plan, const geometry_msgs::PoseStamped &goal);
            bool print_cell(const Cell &cell);
            bool make_straight_plan(const geometry_msgs::PoseStamped& start, const geometry_msgs::PoseStamped& goal,  std::vector<geometry_msgs::PoseStamped>& plan);
            void print_world_params(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal, __uint32_t &mx_i, __uint32_t &my_i, __uint32_t &mx_f, __uint32_t &my_f);
            bool generate_straight_path(const Point &p1, const Point &p2);
            Point generate_next_goal();
            bool makePlanOne(const geometry_msgs::PoseStamped& start,const geometry_msgs::PoseStamped& goal,std::vector<geometry_msgs::PoseStamped>& plan);
            bool is_inside_robot_footprint(const Point &p);
            Point initialpose_callback(const geometry_msgs::PoseStamped::ConstPtr &msg);
            void update_map_bounds();

            costmap_2d::Costmap2D* costmap_ros_;
            costmap_2d::Costmap2DROS *costmap_ros;
            __uint32_t size_x, size_y;
            __uint32_t map_xi, map_xf, map_yi, map_yf;
            ros::Publisher global_plan_pub, goal_marker_pub;
            ros::Subscriber pose_sub;
            ros::NodeHandle nh_;
            int marker_id_cnt;
    };

};

#endif
</code>```

EDIT ONE - Attaching the error message

```<code>`[ INFO] [1623877214.383936978, 92.753000000]: global_costmap: Using plugin "static"
[ INFO] [1623877214.399754683, 92.769000000]: Requesting the map...
[ INFO] [1623877214.609456022, 92.979000000]: Resizing costmap to 4000 X 4000 at 0.050000 m/pix
[ INFO] [1623877214.758182943, 93.127000000]: Received a 4000 X 4000 map at 0.050000 m/pix
[ INFO] [1623877214.758233616, 93.127000000]: Subscribing to updates
[ INFO] [1623877214.763301804, 93.132000000]: global_costmap: Using plugin "inflation"
global_pose_.x: 0.0127673 global_pose_.y: -0.00185759
Sleeping for 3 seconds!
[ WARN] [1623877216.034654901, 94.401000000]: Map update loop missed its desired rate of 1.0000Hz... the loop actually took 1.2430 seconds
global_frame: map
x_mx: 1691 x_mn: 2307
y_mn: 1692 y_mx: 2308
[ INFO] [1623877218.021871851, 96.385000000]: local_costmap: Using plugin "obstacles_laser"
[ INFO] [1623877218.026462101, 96.390000000]:     Subscribed to Topics: laser
[ INFO] [1623877218.038852471, 96.402000000]: local_costmap: Using plugin "inflation"
[ INFO] [1623877218.073365799, 96.437000000]: Created local_planner dwa_local_planner/DWAPlannerROS
[ INFO] [1623877218.080402759, 96.444000000]: Sim period is set to 0.05
[ WARN] [1623877218.083561377, 96.447000000]: Parameter max_trans_vel is deprecated (and will not load properly). Use max_vel_trans instead.
[ WARN] [1623877218.084195753, 96.447000000]: Parameter min_trans_vel is deprecated (and will not load properly). Use min_vel_trans instead.
[ WARN] [1623877218.084750167, 96.448000000]: Parameter max_rot_vel is deprecated (and will not load properly). Use max_vel_theta instead.
[ WARN] [1623877218.085114421, 96.449000000]: Parameter min_rot_vel is deprecated (and will not load properly). Use min_vel_theta instead.
[ INFO] [1623877219.082219761, 97.444000000]: Recovery behavior will clear layer 'obstacles'
[ INFO] [1623877219.087005348, 97.448000000]: Recovery behavior will clear layer 'obstacles'
[ INFO] [1623877219.112662972, 97.473000000]: odom received!
[ WARN] [1623877220.007202261, 98.365000000]: Map update loop missed its desired rate of 1.0000Hz... the loop actually took 1.2070 seconds
Inside the make_plan function!
Hello World!
(int)costmap_2d::LETHAL_OBSTACLE: 254
(int)costmap_2d::NO_INFORMATION: 255
(int)costmap_2d::FREE_SPACE: 0
Sleeping for 2 seconds!

Printing start pose and goal pose:
w_i: (0.01278,-0.00185759) m_i: (2000,1999)
w_f: (-9.51565,0.0048027) m_f: (1809,2000)

Testing costmap_ros for consistency!
[move_base-1] process has died [pid 3322, exit code -11, cmd /home/skpro19/catkin_ws/devel/lib/move_base/move_base /odom:=odometry/filtered __name:=move_base __log:=/home/skpro19/.ros/log/d4e95946-cee5-11eb-8e7f-c8e2656b0bb1/move_base-1.log].
log file: /home/skpro19/.ros/log/d4e95946-cee5-11eb-8e7f-c8e2656b0bb1/move_base-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done<span class="math-container">`</span>
</code>```

答:
I'm no export in C++, but this line:

```<code>  void GlobalPlanner::initialize(std::string name, costmap_2d::Costmap2DROS* costmap_ros){

    nh_ = ros::NodeHandle{"~abcd"};

    costmap_ros  = costmap_ros;
</code>```

(the last) you are setting the costmap_ros parameter to itself, so I don't think you are setting the costmap_ros of the object so when you get to makePlan, costmap_ros is pointing to something random. Try renaming the costmap_ros parameter in the function to cm_ros and change the line to costmap_ros = cm_ros;

Body:
I'm no export in C++, but this line:

  void GlobalPlanner::initialize(std::string name, costmap_2d::Costmap2DROS* costmap_ros){

    nh_ = ros::NodeHandle{"~abcd"};

    costmap_ros  = costmap_ros;

(the last) you are setting the costmap_ros parameter to itself, so I don't think you are setting the costmap_ros of the object so when you get to makePlan, costmap_ros is pointing to something random. Try renaming the costmap_ros parameter in the function to cm_ros and change the line to costmap_ros = cm_ros;


问:
Reinforcement Learning in global and local path planning for mobile robots and self-driving car
Most RL courses start with grid world problem like this where robot has to navigate from start to end and RL helps in generating the optimum policy.  (State-action pairing).

I am not able to relate this to real robotic (or specifically self driving car application). Most self driving car RL application I have read is obtaining the right acceleration and steering angle given the position of the car relative to its environment. (Based on data from vision sensors).  This is very different from this grid-world application. So my questions are

Is this example, not applicable for self-driving cars or mobile robots?

If it is applicable, would it be right to say, this is a global planning application where robot find the path at a broad level for static obstacles? Also, this is not a local planning application where dynamic obstacles and robot actions relative to that cane be determined?

答:
No, this is not applicable for a car, it is just an introductory, extremely simplified example. It is one step closer to a mobile robot, then to a car, at least a mobile robot (at least some of them) is capable of moving in any direction (are holomonic), a car could not move instantaneously to the left or right (it is non holomonic).

In general as a first step, a global plan is planned. But this is nothing new, your navigation system does the same, finds a global path to your destination. Reinforcement learning can be used to make sure that the robot/car stays on that path and avoids obstacles. Control theory can also be applied to make sure the robot stays on the path, but it just maintains the trajectory, does not avoid obstacles (well in many cases does not avoid obstacles, olne could argue that advanced control theory methods, like model based predictive control can avoid obstacles).


答:
If you want to build a robot with lots of moving parts, or just a dedicated, aluminum building medium, and dont have a tight budget, you can use Actobotics building parts, from servo city.com (https://www.servocity.com/actobotics/)

They are metal pieces with holes, so you can attach screws, other Actobotics pieces, servos, motors, and they even have mounts for Arduino's and raspberry pi's. The holes are stategecly placed so that you can mount most boards and shields on them, and the holes will be in the right places.

You can see what you can do with Actobotics with their insights PDF: https://www.servocity.com/product-insights/


问:
Best way to control a robot from an application
I developed an application that places itself just before controlling the robot (CAD/CAM like application) and now I want to control my robot directly within the application.

Typically I have two choices when working with this industrial arm robot (I'm using a Stäubli robot in this case) :

I either use the manufacturer solution, and write programs with its own language and software that will just get a trajectory and perform the trajectory the way I want it by itself. So I'm just sending a trajectory file to the robot controller and then the robot is autonomous

Or I create the whole model by myself (or most likely using pre-existing general solutions) to simulate the robot's behavior first and stream the joints in real time to the robot to control it.

What would be the best choice here ? Should my application just

integrate a communication protocol that just sends a trajectory file to the robot and only gets the robots position during functioning time

or fully control the robot from within my application and send joints positions to the robot?

What is the best technical option here?

答:
This is a bit option based, but I think I can argue this unopinionated from two different perspectives. Go with the first option, because:

Safety:
Assuming you will have industrial applications where at some point some kind of safety certification will be required. My assumption is that you will have a hard time safety certifying a robot which gets joint values streamed to it. I am not saying it is impossible, but you will have a really hard time doing this.

Time to market:
The first option is much faster ready and it is much easier to do. At least you will have a functioning prototype and you can decide later if the second soltion is definetly needed.


答: I am not too familiar with your CAD application, but if you go ahead with option 2, within the ROS framework, there exists the moveit package that is purpose built for robotic arms. It is integrated with ROS but the whole library is open source and you might be able to get some useful code from there.</p>

Title: Best way to control a robot from an application

Body:
I developed an application that places itself just before controlling the robot (CAD/CAM like application) and now I want to control my robot directly within the application.

Typically I have two choices when working with this industrial arm robot (I'm using a Stäubli robot in this case) :

I either use the manufacturer solution, and write programs with its own language and software that will just get a trajectory and perform the trajectory the way I want it by itself. So I'm just sending a trajectory file to the robot controller and then the robot is autonomous

Or I create the whole model by myself (or most likely using pre-existing general solutions) to simulate the robot's behavior first and stream the joints in real time to the robot to control it.

What would be the best choice here ? Should my application just

integrate a communication protocol that just sends a trajectory file to the robot and only gets the robots position during functioning time

or fully control the robot from within my application and send joints positions to the robot?

What is the best technical option here?


答:
Cardboard on top of a cheap robot chassis can be quite effective.  See this version of Openbot that does not use a 3d printer: https://custom-build-robots.com/raspberry-pi-robot-cars/openbot-your-smartphone-controls-a-robot-car-introduction/13860?lang=en

I will typically use hobby-board plywood as a base and cardboard as a second layer.  Get the hobby-board at Ace hardware and order a pizza to get the cardboard!  You can cut the hobby-board with a razor knife (https://www.youtube.com/watch?v=xBSYU04QXj8) and drill mounting holes with a dremel or hand drill https://www.amazon.com/gp/product/B07JN1ZL6Y . Use brass standoffs to separate the layers to your liking https://www.amazon.com/gp/product/B01HWQ2VHE/. That makes it very easy to rework things until they are perfect.  You can then spray-paint black to give it a finished look.


答:
If you wanna develop application to control industrial arm robot, there are several thing you need to look up :

1. Accuracy and precision

If you create your own controller, would your program at least match original controller accuracy and precision?

2. Safety and reachability

From my experience, arm robotic control often face singularity which is very-very dangerous if not handled well. And some control method to avoid singularity, also prevent us from reaching some robot configuration.

3. Development

Developing controller and addressing two problem I mention before will take time and determination.

Thus if you sure you can handle several thing I mention, you are good to go developing your own application. But I suggest to just send trajectory to original controller, since it much faster, stable, easier to do and save you from problem that didn't exist in the first place.


答:
Certain low-level instructions are forbidden to be used by the User under Windows: unfortunately, these 'privileged' instructions can include port control commands.
Details: http://support.microsoft.com/kb/112298/EN-US

" The inp(), outp(), and other I/O port related functions map to privileged processor instructions. For example, on Intel processors, the inp() and outp() functions end up calling the IN and OUT instructions. The privileged instruction exception occurs when these instructions are executed because typical Windows NT applications execute in a non privileged (user) mode. Only code executing in kernel mode has the necessary rights to execute privileged instructions."

Device drivers run in kernel mode: if you're getting this error on your program run, its trying to access on the low-level (which is kind of by definition what a port controller does)

Seeing as ic-prog.com's page on windows drivers was last changed on 06/09/08, which is not a good sign.

Title: Access denied during PIC Programming in Windows XP

Body:
I'm programming a PIC16F77 with ProPic 2 which communicates via serial port. As I don't have this port in my PC, I used serial to USB adapter.
I'm using ICProg in Windows 8.

I've proggrammed it before but it was in Windows XP using the driver who specifies in http://www.ic-prog.com/index1.htm and worked perfectly.
But in this OS the only difference is the adapter, the program gives some errors while loading the driver:

"Error occured (Access is denied) while loading the driver!"

"Privileged instruction"


问:
What is the terminology used to describe control without measurement?
I am currently writing a paper on information theory. In the paper, I will be comparing feedback control ( with observations of the environment, of course) and control without observations.

My question is that what is the established technical terms for control without observation.

In my paper, the presence or absence of observation is an important point of discussion. Therefore, I would like to use a technical term that emphasizes the absence of observation.

I searched Google scholar with the following query:

"control without measurement": 69 papers

"control without
observation": 5 papers

"measurement-free control": 10 papers
"observation-free control": 0 paper

"unobserved control": 198 papers

"unmeasured control": 107 papers

I do not feel that those terms is appropriate.

答:
In control theory, we refer to this as "open-loop control", which emphasizes the lack of a feedback loop.

The wikipedia article has several examples of open-loop control.


答:
0.5mm 1x2m^2 sheet metal @ your local hardware store ~ 2EUR

metal cutting pliers ~ 4EUR

being able to cut it, fold it, punch* it for ventilation - priceless

* use a nail and hammer/stone; rest on a disposable plank; punch from out to in; protect any PCBs, motors and especially wires inside from the jagged edges or neutralise those with a file or sillicone


问:
How to control ESC from Arduino?
I have an Arduino Uno, 9 volt battery, ESC and a brushless outrunner motor. When connecting the motor straight to the battery the motor rotates once which is good but when using my Arduino code to make it turn it just doesn't. I am really new to this and have been lost for hours on what to do. I need to just make the motor spin from the ESC which is being controlled by the Arduino. Please help. Here is an image of my circuit, it's bad but I think it makes sense also "rushless motor" is meant to be "brushless motor":

Also here is my code (there is a closing bracket at the end but i just couldn't fit it all in the screenshot):

also thanks SO SO SO much in advance. I am really stressed at this problem right now.

EDIT:
if anyone who is looking on here is abit confused with the code, this is the code that i first use to make my brushless motors spin from my esc's:

automatic control:
https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep

potentiometer control:
https://www.arduino.cc/en/Tutorial/Knob

Suprisingly this code works with brushless motors as well as servo motors!

答:
There are quite a few issues I see with your setup.

You are setting up the ESC in your code to use pin 9, but your diagram shows that you've connected to pin 8. Pin 8 won't do anything because the code is writing to pin 9.

You are setting up the ESC in the code, but then you are never actually writing to it. You need to use ESC.write() and pass some value in there during the void loop() to actually send a signal over pin 9.

You are grounding the pin that's connected to the ESC, so even if you used the correct pin and wrote an output it would probably still not do anything.

All of your ground connections should be tied together so signal voltages can be read correctly. If your Arduino is not being powered by the same battery that is powering your ESC/motor combo then you need to attach the Arduino ground to the ESC/battery ground.

Try changing your setup to this (comments in red):

Title: How to control ESC from Arduino?


问:
Is there any need to guarantee the duration of one planned trajectory is an integer times rather than a decimal times of interpolation period Ti
Take  double S of velocity profile for example where the seven segments exist. Given the desired displacement s, the constraints jmax,amax, and vmax, after the computation I found that each duration which it takes respectively to reach amax,vmax,s are not the integer times of the period e.g. Ti=2 ms .

This picture is from Trajectory Planning for Automatic Machines and Robots.

I expect this would result in some problem when processed in CPU discretely. This would exceed the amax when round up the Tj1 to integer times of period or not reach the amax when round down. The similar problem also apply to vmax and s. This would not satisfy the accuracy of displacement.

Is there some solution or relevant investigation about this quesiton?

I thought up a solution by assigning the duration which equals the rounded up time as new constraints to resolve for the new jmax after the original computation.

答:
You're mentioning a period without going into any detail about it, so I'm not positive what you're asking about, but I'm guessing your concern is about a computation period - the inverse of the computation frequency. Is this right? That you mean it's possible to overshoot or undershoot a desired position because the time step required to achieve the target position doesn't fall on integer increments of the controller's sample time?

If this is what you're asking for, you're technically correct in that you're almost certainly guaranteed to not hit the position exactly correctly, but you're also describing open-loop control, where you're going to drive the system without regard to positioning error.

You can reduce the effect of the timing mismatch by reducing the effective mismatch, either by reducing the controller period (by increasing the computing frequency) or by reducing the speeds and accelerations.

There are a whole host of issues that are going to come up like this any time you talk about needing precision with open-loop control, for example: your ability to accelerate and decelerate will depend on the motor speed regulator, which in turn will need to be tuned to the exact vehicle weight; motor speed will depend on gearing and wheel radii; motor acceleration will depend on motor torque, which in turn will depend on the exact winding resistance and system voltage; etc.

Your (in)ability to drive the motor at the exact acceleration curve is probably going to have a much larger impact on ultimate accuracy than any timing issues. The only way to achieve the exact position is to use position feedback and build a controller to drive the positioning error to zero.


问:
Dynamic analysis of a robot pedestal
I have to design a robot pedestal for a research project.The robot I choose is kuka KR 6 R700 6.In the datasheet is said all the forces/moments in worst case scenario.I did some FEA for the structure taking into the accountant these, but this is only static analysis.Von Mises stress is below YS of the material, SOF atleast 2 and deformation of 0.3mm.Also I found natural frequencies of the structure.What im concerned of, is if I should also simulate something regarding dynamic analysis.Like while is moving, if is enough stable not vibrate and change my points values.</p>

答:
The static analysis should give you the worst-case position for the arm with regards to stress in the pedestal. The vibration modes of the pedestal may or may not be important for your application, but the thing I would be looking for in a dynamic analysis would be how the counter-torque compounds with the static loading. Don't forget to assume worst-case payload.

The robot in its worst-case kinematic orientation, with its worst-case payload, with its worst-case joint acceleration will give you the shear and bending information you need to evaluate the pedestal. Counter-torque should reduce stress in one half of the pedestal but make it worse in the other half, which may or may not cause you to exceed the yield strength of the base material.

Title: Dynamic analysis of a robot pedestal


问:
Robot Operating System can be usable other than Robot application?
I am asking very general question, but i would appreciate if someone helps me. I want to use ROS for manufacturing process (Not robots) as a middleware that can create simulated Cyber physical system environment to enabling the interoperability of different nodes in real time. Before start involving in ROS, i would like to ask you below questions.

ROS can be usable other than robot application for our manufacturing system ?

If yes, then what challenges i will face? if i want to use it for manufacturing system?

What are advantages/disadvantages of using ROS as a middleware in normal manufacturing process?

How much time it will take to develop ROS middleware for normal manufacturing process? (I never used ROS)

I know C++/Python are good options, but what programming language is best for me?

Is their any other options are available other than can use as a middleware in my manufacturing process that can create simulated Cyber physical system environment to enabling the interoperability of different nodes? I would appreciate if someone suggest me other options, which can easy to use than ROS.

Thanks a ton

答:
First of all, you have to define real-time. Is it "motion control real-time" or "instant messaging chat app real-time". For the first one, ROS is not a good option.

In theory yes, but in practice, the advantage of ROS, the ready made ROS nodes for interfacing with robots, path planning, interfaces to different sensors are largely only applicable for robots.

Interfacing all systems to ROS will be the main issue. As you do not intend to use it for robots, you will need to create your own interfaces.

Depending on how deep you are going down the automation pyramid. For motion control the main drawback is no real-time support. For programming logic, you do not have a clear separation between application programs and firmware. You will need to interface all your equipment to ROS. Even higher up in the pyramid, you do not have any options of SCADA, MES or ERP interface. Advantages to ROS...I do not see why it would be advantageous fr your use case. It uses DDS as a messaging system, you are probably better off using directly that and you are then not stuck to the ROS way of doing (building) things.

The middleware is not your problem, that is ROS. All the interfaces to the middleware will be your problem.

C++ is more complicated to write but is faster then Python. Python is more convenient but slower. So if execution time matters more, go with C++.

OPC-UA, MQTT, AMQP, EdgeX Foundry, Assest Administration Shells, TOGAF Open Process Automation, MT-Connect are all worth looking into related to your question.


答:
1- No it is not. This example is the beginning of RL, while Self-driving cars are way much complex. In a simplified view, there are two main differences. state and action in the shown example are discrete, while for a real robotic application are continuous.

2- Despite the promising results, still RL is far from global path planning -planning to long ahead- in partially observable environments -like for a self-driving car -. The best way to utilize RL is to use a classic path planning method, to find the waypoints toward the goal and feed those waypoints to the RL module as a trajectory following.

Title: Reinforcement Learning in global and local path planning for mobile robots and self-driving car

Body:
Most RL courses start with grid world problem like this where robot has to navigate from start to end and RL helps in generating the optimum policy.  (State-action pairing).

I am not able to relate this to real robotic (or specifically self driving car application). Most self driving car RL application I have read is obtaining the right acceleration and steering angle given the position of the car relative to its environment. (Based on data from vision sensors).  This is very different from this grid-world application. So my questions are

Is this example, not applicable for self-driving cars or mobile robots?

If it is applicable, would it be right to say, this is a global planning application where robot find the path at a broad level for static obstacles? Also, this is not a local planning application where dynamic obstacles and robot actions relative to that cane be determined?


问:
Zero crossing events with brushless DC motors
I would like to ask a question about zero crossing event in a trapezoidal commutation on a brush-less DC motor. Here is a waveform that shows that the zero crossing event occurs every 180 electrical degrees in a sinusoidal commutation:

But what about trapezoidal commutation. Here is the waveform that I found about the trapezoidal commutation:

So as you see, the zero crossing occurs 30 electrical degrees after the previous commutation and 30 electrical degrees before the next commutation.
In a motor with one pole pair, we would have 30 electrical degrees = 30 mechanical degrees, so we would have this waveform:
You see that the zero crossing in phase A occurs when the magnet faces the phase C, or in other words, after 30 electrical degrees from the last commutation.
My question in why does the zero crossing happen at that moment, why not after 60 electrical degrees, or 15 electrical degrees?
Is it related to some law's of induction? What are those law and how do this law's appear in this motor?
Can someone explain to me this with some pics?

答:
Each of the three Hall Effect sensor signals is out of phase with the others by 120°. The same is true for the BEMF signals. The Hall Effect signals and the BEMF signals are 30° out of phase with each other.

From this Microchip App note:

Hall sensor signals are out of phase by 120 degrees to each other. At
  every 60 degrees, one of the Hall sensors makes a transition.

The BEMF generated in the windings are also at 120 degrees out of
  phase to each other, but they are asynchronous  with the Hall sensor
  signals. In every energizing sequence, two phases are connected across
  the power supply and the third winding is left open. the BEMF voltage
  is monitored on the winding that is left open. With this, the BEMF
  voltage in windings increases when it is connected to power supply and
  reduces when it is connected to the return path. The transition takes
  place when the winding is left open in the sequence. The combination
  of all 3 zero cross over points are used to generate energizing
  sequence. The phase difference between the hall sensor and the BEMF
  signal is 30 degrees.

So if you commutate 30° after sensing a zero crossing, you are actually commutating at the same time you would be if you detected a change in the Hall Effect sensors.

The reason the Hall Effect signals and the BEMF are out of phase is because they are measuring two different things. The Hall Effect sensors are measuring rotor position. The BEMF signals are measuring stator sequence energization. It is from that energization that we can extrapolate rotor position and determine correct commutation timing.

From this Atmel App note:

The optimum drive sequence is to drive PWM at 30° after zero crossing
  to be in phase with the rotor position as shown by the figure below.
  Driving earlier or later to this 30° will increase the current
  comsumption [sic] of the motor.

So why 30°? 30° is the amount of time it takes for the interaction between the stator magnetic field and the rotor magnetic field to begin to weaken to the point that stator's electrical field needs to be altered in order to strengthen the interaction between the two magnetic fields.

You can actually play with this timing to some degree by doing things like rotating the Hall Effect sensors in order to achieve certain results and/or meet certain requirements. I go into this practice more in my answer to this question: Why Have Non-Zero Timing on a BLDC?.


问:
Are consumer grade CNC machines capable of cutting tile?
I'd like to slice and dice floor tile into pieces so I can arrange it in geometric patterns. I have CAD designs for the parts. Would any consumer grade CNC machine be capable of doing the job?</p>

答:
Most CNC mills use rotary tools which are not the best choice for material such as tiles. Commercially either diamond saws, which cut straight lines, or in some cases waterjets are used to cut tiles. Currently there not hobbyist CNC waterjets that I am aware of.

there is a company called https://www.wazer.com/ that makes a small CNC waterjet for around $8000-$10000, which is pretty high for a hobbyist. They do not list tile, but do list stone and glass.


问:
Vulnerability of LiDAR systems for autonomous drones
I will soon be working on an autonomous drone project and we're planning to use LIDAR systems for localization & mapping.

However, at the same time, we are looking into how to make drones safer when used in a crowded (human) environment. This also means taking vandalism into account.

Can Lidar sensors be manipulated/affected by people on the ground? If yes,
how? (perhaps a laser-pointer?)

Since Lidars are reflecting light on surfaces, are there surfaces it cant detect, such as glass?

Would a Solid State Lidar be more reliable (prone to vibrations) for this kind of application?

答:
Lidar systems are all going to be some wavelength of infrared, which means there isn't going to be a visible light component on the ground and, conversely, no amount of visible light emitted from the ground is really going to have any impact on your drone.

Specifically to your question, a visible laser being shot from the ground should have virtually no effect on the lidar unit. It might be possible to get an IR laser, but if that's the case then you're already dealing with someone more advanced than your run-of-the-mill vandal.

Once someone gets an IR laser, they'll then also need to be capable of spotting it in order to be able to target the drone. I've got first-hand experience trying to spot the lidar output from about 20 meters and I can tell you it's very difficult even with night-vision goggles, a dim viewing area, and knowing where the spot should be.

This means also that whoever is targeting your drone is going to need some very sophisticated IR/night vision equipment to spot the infrared laser from whatever distance you're going to be flying. Again, even at 20 meters, which isn't really that high, the laser spot is going to be very difficult to see, and again also they'll only really be able to interfere with your system at night.

So, from that end, I wouldn't really worry about someone being able interfere with drone.

Regarding your other points, yeah, the lidar needs the emitted laser light to be reflected back at the unit, so you're going to have difficulty measuring highly reflective surfaces and highly absorbent surfaces.

Finally, I would not be as concerned with the platform vibration affecting the scanner as the other way around - the lidar units have a spinning head inside that turns typically at 10-25 Hz or so, which means basically you're going to wind up rigidly coupling a gyroscope to your airframe. You may find this degrades your ability to control the quadcopter. You could of course get around this by using a solid-state lidar, but I've worked with quite a few lidar companies (SICK, Velodyne, Quanergy, Ouster) and nobody has even a demo unit for us to evaluate.


问:
Rotate a certain angle using PID and mpu6050
Currently I'm working with a 4 wheel robot and I'm trying to rotate a certain amount of angle. I used PID_V1 library to rotate this. But when I upload and test the code Robot rotate continously.

```<code>#include <MPU6050_tockn.h>
#include <Wire.h>
#include <PID_v1.h>
MPU6050 mpu6050(Wire);
double Setpoint, Input, Output;
int enA = 6;
int in1 = 4;
int in2 = 5;

int enB = 11;
int in3 = 8;
int in4 = 9;
double Kp = 8, Ki = 4, Kd = 5;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
void setup() {
 pinMode(enA, OUTPUT);
 pinMode(enB, OUTPUT);
 pinMode(in1, OUTPUT);
 pinMode(in2, OUTPUT);
 pinMode(in3, OUTPUT);
 pinMode(in4, OUTPUT);

digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);

  Serial.begin(9600);
  Wire.begin();
  mpu6050.begin();
  mpu6050.calcGyroOffsets(true);
  Setpoint = 15;

  myPID.SetMode(AUTOMATIC);
  }

 void loop() {
   mpu6050.update();

    Serial.print(mpu6050.getAngleZ());
    Input = mpu6050.getAngleZ();
 myPID.Compute();
    if(0<Output and Output<255){
    analogWrite(enA, Output );
    analogWrite(enB, Output);
    Serial.print("\toutput : ");
    Serial.println(Output);

  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  }
 }
</code>```

I used serial monitor to visualize the data and rotate the robot frame slowly and I figured out values of PWM signal is reduced. But when I powered the motors It rotate continously. Any help please.

答:
Started writing this as a comment, but there are quite a few troubleshooting/predictions here about what could be going on, so I'm posting it as an answer that I'll edit if you can provide more information.

Welcome to Robotics, Kasun Thushara. Could you please edit your question to include a diagram or picture of how your system is wired? I'm trying to guess by convention, but it looks like you're trying to write an analog value to a motor enable bit (enA/enB) and then you're writing outputs to... input pins? in1, in2, etc.

Given you've got two (enable?) en bits I'm going to guess there are two motors, but then your four outputs (inputs?) in bits might be setting up directions for a motor driver, or aligning power to an H-bridge for a single motor - I can't tell.

What I do see is:

You're only turning your motors on if your Output is greater than 0 or less than 255, which means you don't have the ability to change direction if (when!!) you overshoot your angle reference (i.e., when your output goes negative).

You never turn the motors off! This is probably as much to do with your bug as anything - what do you do if Output<1? You should have an else case there that disables your outputs.

Your serial message is inside your if statement; I would put it just below the call to the PID controller so you can see all the outputs, not just the ones that fall within your actionable range.

As stated at the top, I would need some wiring diagram or at least some explanation of how your equipment is setup to make better guesses about where your code could be going wrong.


问:
Does RRT perform graph search?
The basic RRT explores the space by sampling and if the goal is connected to the tree, the solution is returned. Can you define retrieving the path as a graph search?</p>

答:
I would argue, that it is not graph search.

In the implementation, you keep all the nodes in a flat list and check which of the nodes is closest to the sampled point. As all nodes are checked, this might be seen as a brute-force graph search, but in the implementation is just for loop iterating though all the points in a list.

The goal check is done for the newly added points to the tree. It is checked if it is in the vicinity of the goal point. If yes, then the path is defined by going up the tree to the root. This is also not search, since the list is available in the form of pointers from the child nodes to the parent nodes.

Title: Does RRT perform graph search?


问:
Attaching an optical rotary encoder to a bicycle wheel
I am currently working on a Sixth-Form experimental physics project, the end goal of which is to build a simplified Malkus Waterwheel, and to see whether chaotic synchronization can be achieved between the recorded motion of this and a modified form of the Lorenz Equations. Whilst I am confident with the mechanical and programmatic elements of this project, I am uncertain how to translate the wheel's motion into digital measurements of angular displacement/velocity.

Given the low-budget nature of the project, I will be using a bicycle wheel for the frame of the waterwheel. Answers to a previous question, Adding Rotary Encoders to an Electronic Wheel Chair, suggest to me that an optical rotary encoder is the best type of sensor to measure the motion of this. However, given that lack of non-technical material online, I would very much appreciate clarification on one key point:

Since my bicycle wheel's axle will remain stationary whilst the wheel spins, how is it possible to mount an optical rotary encoder's disc to the bicycle wheel in such a manner that its angular motion will mirror that of the wheel?

答:
I'm coming at this question from more of a, "How do rotary encoders work?" than anything specific to your question.

how is it possible to mount an optical rotary encoder's disc to the bicycle wheel in such a manner that its angular motion will mirror that of the wheel?

Welcome to engineering, haha.

A rotary encoder typically has to parts: an encoder disk and the reader. The general principle is that there is something "special" on the encoder disk that the reader can detect, and the detector converts that special mark to an output given the prior knowledge of what that mark means.

Typically the reader will be optical or magnetic (for a Hall effect sensor), and the encoder disk will be a series of lines, or holes, or magnets on a disk.

How accurate the encoder is depends on how many marks there are on the disk. For example, on my 1989 Pontiac Bonneville, there's only one magnet, which means the engine is only able to tell if the camshaft is in that position or not that position.

An optical encoder disk might have half the disc black and half white, which would make it a one-bit encoder. It could alternate quadrants black and white, which would make it a two-bit encoder. If it has 256 marks, it's an 8-bit encoder.

If the reader can detect 256 transitions per revolution, then it's an 8-bit encoder, but if it can't distinguish one transition from the other then it's a relative encoder. If you power the system on for the first time, it doesn't know the absolute position of the encoder wheel. To get around this, some encoders have multiple sections and multiple readers - one reads the 1-bit encoding section, one reads the 2-bit encoding section, etc., and you wind up with a wheel that, when read, reads out its position in binary. Here's a 3-bit encoder and here's what looks like a 10-bit encoder (1024 marks per revolution).

It's also possible to have a quadrature encoder which is a kind of 2-bit relative encoder that is capable of sensing direction because the bits both have the same encoder resolution, but they're offset to overlap. If channel A goes positive and then channel B goes positive then you're moving in one direction, and the opposite is true when you're moving in the other direction.

Now, finally, more to your question, the way these are mounted depends on your target application and there's basically a different style for every conceivable way you could use one.

Some encoders have a housing you would mount to a frame and a shaft you would couple to your rotating object. The housing, with the read head inside, stays still and the shaft spins an encoder disk inside. This wouldn't work for your application, because the shaft you would couple with will also remain stationary.

Some encoders have a "hollow shaft" and are meant to be installed over an existing shaft. The encoder is literally hollow in the middle and it makes a ring shape. You choose the diameter you want and the "hollow shaft" or sleeve is held to the driven shaft typically with a setscrew. Again, for you isn't not a matter of how you couple to the shaft, because the shaft in your case isn't rotating.

Finally, some encoders come essentially in two pieces - you get the encoder disk and the read head as two separate pieces, and then it's up to you to mount them how you want. This is probably the most appropriate for you because then you can attach the encoder disk to the wheel hub and mount the read head to whatever frame you're attaching the wheel.

I'm not affiliated with any of these sites, but you can generally find items like this or this by searching for "encoder disc" or "encoder disk" or "encoder wheel," but honestly you could also probably just make one yourself by printing off a pattern to a piece of cardstock and using an IR proximity sensor with a notecard wrapped around it to make a shroud. The rangefinder would get more reflection ("closer!") when shining on a white mark and less reflection ("farther!") when shining on a dark mark, and you could implement your own encoder looking for those reading variations.


问:
Identifying active PID-Controller parameters
A metric of a physical system is being controlled by a PID controller (in this case a valve controls the temperature of a liquid by mixing hot liquid into a stream of cold liquid). All measurement data regarding the valve, temperatures etc. is given, however, there is a certain error included.

I would like to calculate the PID parameters used, but for every time step it varies a little because of the error. Can I use optimization to find the best solution for the respective timeframe, and if yes, how do I use it?

PS. I do possess proficiency in Python and Excel

答:
There are methods to determine PID gains, but they require online testing. If you're not willing (or able) to do the testing with a real system then you would need to create a mathematical model of your system and do the tuning in a virtual environment. How appropriate your virtual gains are to your physical system depends on how well your model represents reality.

All real systems are going to have some degree of measurement noise or other inaccuracies, so you can approach that by implementing a filter to try to reduce the effects of noise on your readings.


答:
Assuming RRT is done in two steps:

Grow your tree from start state until one node is near enough to the goal state

Output path from start state to goal state along tree

I'm assuming based on your question that you're asking if part 2 is a graph search?

Usually in RRT, each node has exactly one parent (since it's a tree) and you can just walk back from the end node to the start node by following the parents of each node.
I guess that kind of qualifies as a graph search?

If each node has more than one parent (like in PRM) then you need to use a shortest path graph search algorithm to find the shortest path in your graph from the start state to end state

Title: Does RRT perform graph search?

Body: The basic RRT explores the space by sampling and if the goal is connected to the tree, the solution is returned. Can you define retrieving the path as a graph search?</p>


问:
Choosing the right dimensions for an underwater glider
I'm looking to potentially build an underwater glider, a type of submarine that's slow but can operate on extremely low power draw. However, in order for it to work effectively I've found several sources hinting that the dimensions of the components, especially the wings, are critical to its success.

However, I've found very sparse information about what these dimensions should be! I'm happy to do a bit of trial and error if it comes down to it, but to save some work does anyone have any information on what the critical dimensions should be?

答:
This is a classic design problem. It starts with want you want something to do - a design specification. Hence there is no one right answer.
I have designed a number of both aerial and underwater drones, they vary greatly in design because each was to meet a specific problem. The approach I took for a sea glider to map an offshore reef and record the biodiversity was;

Figure out what you want the glider to do - speed, endurance, depth, activity, sensors, communication, reliability,emergency systems etc. seperate into must have and nice to have.

Figure out what is needed to do the sensor part in  1 above - sensors, cameras, etc

Estimate the weight of that payload and it’s energy budget

Guess your size of glider payload bay  to fit the payload. Roughly estimate this at 20% of total volume.

Decide on the glider structure and given the operating parameters in 1 above calculate the thickness of the pressure vessel. Estimate the overall structural weight. Add this to the total weight.

Estimate the weight of the structure and payload to be 50 to 60% of the total weight.

Figure out how much buoyancy your engine needs to create - allow for changes in bouyancy with depth, temperature and salinity.   Check this roughly fits in your size estimates in 4 and 5 above.

Figure out how much power your engines require to operate the bouyancy engine, pitch and roll control elements.

Decide how large a battery you'll need - allowing for 20% reserve capacity and allowing for decreased battery efficiency at low temperatures, and then decide if you need to have power harvesting to meet the aims at 1 above. Add the battery weight and any power harvesting systems weight (mine was solar on the wings which meant increased surface time but extended duration).

Decide on the control method and Comms set up. Add the weight to the total.

Given the design speed over ground calculate the wing parameters required - this will largely be a function of the aerofoil shape, the angle of attack, wetted area, (together giving the drag) and the speed through water.

Iterate the parameters to create an efficient trim for your vehicle (wing placement, moving the battery fore and aft and the approach I took by shifting hydraulic fluid as part of the buoyancy engine) and calculate the pitch angles you'll be able to produce at different settings - and therefore the speed through water (lot of calculations here). You don’t have to be too pedantic here - you are simply looking to take out the obviously inefficient designs. The point up to here is to optimise the drag at design speed for your wetted surface to maximise performance (and hence minimise the power budget).

Repeat steps 1-11 as necessary until something looks like it might work.

Make a prototype shape, make its buoyancy roughly half of what the engine can produce. Then as noted above drag it to the bottom of a pool and see what happens. Repeat this with the trim and bouyancy  settings at both extremes of the operating envelope. Weird things happen at the operating extremes - which is where design survival occurs (or not).

Now build the prototype and test it (sink it) - I have yet to have something work perfectly first time. Consider if you want real time data during testing or can live with data post test. Consider how you recover it when it sinks. In the pool it’s easy - in 30m of sea water less so and at 200m it’s really hard(when that through hull sensor leaks).

Repeat steps 1-15 as necessary to get a reliable working glider.


问:
Standalone (or capable of being) Robotics Simulator
I'm a software engineer who volunteers with a non-profit that introduces young girls to technology. We have recently been talking about methods of introducing these children to the world of robotics, and I am curious what types of low-cost options we have.

One very appealing idea would be to have an online simulator, or (more preferable) an off-line standalone-simulator that we can build and program simple robots with. Perhaps nothing more than dragging components together, and then programming the interactions between those components.

What solution(s) exist that I might be able to make use of in our outreach?

答:
ZeroSim is an Open Source robotics simulation toolkit using Unity and ROS integration.  There are some prebuilt examples such as a wheeled autonomous robot and a 6-DOF robot arm.  It is meant for professional robotics simulation and not necessarily beginner level education tool -- that being said it being implemented using Unity, which is relatively easy to learn, and the pre-built examples may be sufficient for your use.

Disclosure:  I am a developer for ZeroSim.


问:
I am an entrepreneur and I want to start building robots for businesses, where do I start?
Over the last couple of years I've had good success with my technology startups and now looking to enter into robotics. I was interested in robotics and automation ever since I was a kid (yes, that sounds nerdy). So my question is: Where to get started, what to build? and how to sell? And lastly, how difficult it is to sell in this industry?</p>

答:
Where to get started?
Start with an idea, write down its properties, requirements, scope of the robot, its audience. Sketch it on paper. Make a CAD model using Solidworks if you have. You can simulate many properties in Solidworks. You can also import a 3D model of the ECAD file and estimate the production cost. Learn electronics, programmering and take several courses in mathematics.

What to build?
Build what you would love to have or exist.

How to sell?
Anything can be sold to anybody at any price, if the product makes an impression on the buyer.

How difficult it is to sell in this industry?
Robots nowadays are like computers 40 years ago. So the opportunities are huge. Having said that, the better it impresses the buyer the easier it gets sold. But generally robots related to "Saving the environment", "Saving human lives and increasing health and comfort", "Minimising crime or unwanted behaviors" are getting popular and get a lot of attention in the media.


问:
Good 3D simulator for outdoor autonomous navigation
What's an appropriate tool for simulating a car driving in a simple closed-loop racetrack? I'm trying to implement the control logic for an autonomous vehicle, and I'd like to be able to first simulate the behaviour before testing on a physical platform. The target environment is mostly 2D, but there are some 3D obstacle like small ramps and arches, so I can't use a strictly 2D simulator.

I've looked at some robotics simulators, as listed here, but they seem like overkill and none of them seemed designed to model outdoor environments. I've done a little work with Gazebo, and I can't find any guide of texturing the ground/sky/background.

All I really need is some way apply a texture map to the ground and sky, create a handful of obstacles, and then to calculate a camera feed as a simple two-wheeled chassis moves along a mostly 2D course. However, I need the video input to be as realistic as possible because I don't have access to the real world racetrack. I need to be able to test and train the control logic in the simulator, and then load that logic onto the real mobile platform and have it navigate the course.

答:
ZeroSim is an Open Source robotics simulation toolkit using Unity and ROS integration.  There are is an example with differential drive autonomous robot, but no examples yet of a Ackerman steering controller -- though Ackerman steering shouldn't be too hard to implement.  Because ZeroSim is using Unity it should be quite a bit easier to develop 3D environments then Gazebo and maybe even use one of the many examples of automobiles available via the Unity Asset Store or freely available elsewhere.

Disclosure:  I am a developer for ZeroSim.


问:
How to calculate extrinsic calibration of a non-overlapping multicamera rig?
thanks for taking the time to check my question. Firstly, let me describe the current configuration, I am using 4 cameras that produce non-overlapping images and the goal is to calculate their relative positions.

What I've tried so far:

[1] ROS Kalibr package. As the frames have a little overlap I tried to use a aprilgrid target hoping that if one marker can be caught to the frames I will have some hope to calibrate but it did not work, the overlapping areas are too small so there is no use to that.

[2] Meshroom camera rig calibration. For now this is my best bet but I can not find proper documentation about the workflow. Any ideas on how the pipeline should be are welcome.

In conclusion, all ideas are welcome because as you can see I have practically none.

P.S. I made this post more general instead of asking just about meshroom, thinking this might be helpful to more people in the future.

答:
Not sure if there is an existing good sw for that but if you want to implement that a motion-based method will work.

The motion-based approach basically estimates the trajectory of each camera and finds extrinsic parameters(relative positions and rotations). It doesn't need any view overlap. What you need to do is simply grabbing your device and making a proper motion.

The simplest approach to implement the algorithm is using calibration boards. Attach multiple calibration boards in a room wall and estimate each camera trajectory by tracking the calibration board location using some library like OpenCV. Once you got the trajectory, the rest of the process is simple. See my paper if you want to know more theory.

If your cameras are installed on heavy stuff like a car it could be a bit tricky though.


问:
Covariance of Gaussian after sequence of homogeneous transformations
Assume we have a robot that moves and observes landmarks on his path. The path is composed of $k$ poses $s_1  \: ... s_k$ where $s_i = [x,\ y,\ \theta]$. From the sensors, we read the motion measurements as a sequence of gaussian random variables $\mathcal{N}(\boldsymbol{\mu}^1_2, \boldsymbol{\Sigma}^1_2) \ ... \ \mathcal{N}(\boldsymbol{\mu}^{k-1}_k, \boldsymbol{\Sigma}^{k-1}_k)$, where $\boldsymbol{\mu}^{i-1}_i = [\Delta x, \ \Delta y, \ \Delta\theta]$ is the measurement of the motion from $s_{i-1}$ to $s_i$ and $\Sigma^{i-1}_{i}$ is the covariance of that measurement.

At pose $s_1$, the robot measures a landmark $l$, generating the measurement $\phi = \mathcal{N}(l^{(1)}, \Sigma_{l^{(1)}})$ where $l^{(1)} = [x, y]$ and represents the landmark position in the reference frame of $s_1$.

We now transform the landmark measurement $l^{(1)}$ into the reference frame of the last pose $s_k$ with the homogeneous transformation
\begin{equation}
l^{(k)} = M^{k}_1 \ \ l^{(1)}
\end{equation}
where $M^k_1$ is the transformation from $s_k$ to $s_1$ given by
\begin{equation}
M^k_1 = \prod_{i=1}^{k-1}\Big(M_{i+1}^{i}\Big)^{-1}
\end{equation}
and $M_{i+1}^i$ is the homogeneous matrix correspondent to the motion measurement $\boldsymbol{\mu}_i$.

I am interested in understanding what will the covariance of $l^{(k)}$ be. My intuition is that since components of $l^{(1)}$ do not appear in $M^1_k$, then $l^{k}$ is just a linear transformation of $l^{(1)}$ and the covariance $\Sigma_{l^{(k)}}$ will be
\begin{equation}
\Sigma_{l^{(k)}} = \Sigma^1_k \ \Sigma_{l^{(i)}} \ \Sigma^1_k
\end{equation}
where $\Sigma^1_k$ is the covariance associated with the transformation $M^1_k$, and I cannot directly compute it, but only approximate it with an EKF-like algorithm. Am I correct?

答:
I believe you can directly estimate the covariance if you have a trajectory before and after a loop closure. You can think of the trajectory after the loop closure as ground truth and you will see how much it drifts on each pose on average from the uncorrected trajectory. That's where you can get the hint for how you calculate the uncertainty of your individual pose estimation.

One tricky thing is that the poses are on the manifold. You can calculate the covariance on R3 space but it gives better results when done on SE2.

Also, your last equation is a simplified linear model whereas it should be much more complicated if you have to do it accurately. One old passioned method is Sigma point and the other more recent method is doing it on the manifold.

See State estimation book by Prof. Tim Barfoot. All you want to know is there.


问:
Matlab smooth transition between stored configurations (rigid body tree robot )
I currently have a few joint configurations stored for a robot model in Matlab. When I play back and show the robot in different configurations, there is of course no smooth, but abrupt transition. Is there a way to generate all joint configurations in between 2 configurations, so it transitions smoothly? Or if there is any other ideas on how to reach a smooth trajectory, please let me know. Thanks!</p>

答:
I don't know how you're storing or recalling your presets, but you can put a Rate Limiter block between it and your joint and limit how quickly your joint reference changes.

I made a short clip for you - here I'm using a square wave set to 45*(pi/180) as the amplitude, with a frequency of 0.25 Hz. The net result is 90 degree motion (-45 to +45 degrees) and it switches position every 2 seconds.

You can see at the start that it flips immediately from one position to another. I then add a Rate Limiter block and set the rising and falling slew rates to 90*(pi/180) or 90 degrees per second. This means it takes a full second to go from -45 to +45 degrees, then stays in that position for another second (2 seconds total) before toggling position. Again the transition from +45 to -45 degrees is limited to 90 degrees per second, so it takes a full second to transition.


问:
Quadcopter configuration
I'm building a quadcopter. It will be controlled by a Beaglebone black with several Sensors and a cam.

I new to the quadcopter stuff, therefore it would be nice if someone could have a look at my setup before I buy the parts.

Frame: X650F - 550mm

Battery: Turnigy nano-tech 5000mah 4S 25~50C Lipo Pack

Motor: NTM Prop Drive 28-30S 800KV / 300W Brushless Motor

ESC: Skywalker 4x 25A Brushless

This sums up to ~ 2kg. Giving me still some room for about 700g payload.

What do you think? Did I miss something important? Better ideas for some parts?

答:
Looks good to me. You also need:

propellers

power distribution board which keeps thing more organised until you make your own PCB.

A Li-Po battery charger with a compatible connector.

Spare parts. (Many propellers, and few motors and ESCs)

Also visit xcoptercalc to 'simulate' the parts.

Be careful with the motors since there are some openings at the bottom making it easy for small metal dust to enter the motor. If metallic dust enters the motor, it is almost impossible to detach it from those permanent magnets.

Title: Quadcopter configuration


问:
Log file getting spammed by "writing header" when calling service
I have a rospy node that hosts a very simple service, indicating if a modem is ready to send data. Another node calls this service very often. For some reason, the following log statement gets logged every time the service gets called.

```<code>./EnhancedAcomms.log:47152:[rospy.tcpros][DEBUG] 2021-07-06 04:54:22,451: [/EnhancedModemDriver/ReadyToSend]: writing header
</code>```

Note the "writing header" above. Nothing in my code logs this.

This is the service file

```<code>---
bool ready
</code>```

This is the actual service

```<code>def _readyToSendServiceHandler(self, request):
    readyToSend = self._micromodemDriver.readyToSend()
    res = ReadyToSendResponse()
    res.ready = readyToSend
    return readyToSend
</code>```

This is how it's called

```<code>_readyToSend = rospy.ServiceProxy(self.readyToSendServiceName, ReadyToSend)
res = _readyToSend()
return res.ready
</code>```

Does anyone have any idea where this is coming from (what is rospy.tcpros?) and why it's getting logged constantly? This is the ONLY service in a package with a dozen services that does this.

答:
Does anyone have any idea where this is coming from

Looks like line 640 of rospy.impl.tcpros_base:

```<code>logger.debug("[%s]: writing header", self.name)
</code>```

and why it's getting logged constantly?

The particular message is logged with a call to logger.debug which is putting this message in your log file. It's getting written every time the write_header method is called, which happens in line 561 of the same file. That, in turn, is part of the try block that's trying to setup your connection in the connect method.

I would guess you're getting spammed with the message because you're spamming calls to the connect method. You said that this is "a very simple service, indicating if a modem is ready to send data," but how does it work? Does it try to make a connection and indicate read-to-send when the connection status is good?

My immediate reaction was that there are bound to be more responses in your log file, but in looking at the catch section of the connect method, I see the following:

```<code>except TransportInitError as tie:
    rospyerr("Unable to initiate TCP/IP socket to %s:%s (%s): %s"%(dest_addr, dest_port, endpoint_id, traceback.format_exc()))
    raise
except Exception as e:
    #logerr("Unknown error initiating TCP/IP socket to %s:%s (%s): %s"%(dest_addr, dest_port, endpoint_id, str(e)))
    rospywarn("Unknown error initiating TCP/IP socket to %s:%s (%s): %s"%(dest_addr, dest_port, endpoint_id, traceback.format_exc()))
</code>```

So while your write_header code is using logger.debug, your exceptions are being written to rospyerr and rospywarn. To view those, follow the steps for reading your log messages.

If there really aren't any other log messages, in the local logs or on the /rosout topic, then you should try to investigate further into how that code is getting called - again it looks like you're spamming the connect call.

Looking at your service, it looks like you've got some stuff you're not doing anything with. You're calling

```<code>readyToSend = self._micromodemDriver.readyToSend()
return readyToSend
</code>```

and I can't tell what .readyToSend() is doing and then also you've got:

```<code>res = ReadyToSendResponse()
res.ready = readyToSend
</code>```

and I can't tell what the res is for (you're not returning it) and I can't see what ReadyToSendResponse is doing AND I can't tell why you have two very similarly-named functions, readyToSend() and ReadyToSendResponse().

Check for other logs and /rosout and see if you're getting exceptions from the connect call, then try to dig down into your code and see if you're calling connect on a loop somewhere.

Body:
Does anyone have any idea where this is coming from

Looks like line 640 of rospy.impl.tcpros_base:

logger.debug("[%s]: writing header", self.name)

and why it's getting logged constantly?

The particular message is logged with a call to logger.debug which is putting this message in your log file. It's getting written every time the write_header method is called, which happens in line 561 of the same file. That, in turn, is part of the try block that's trying to setup your connection in the connect method.

I would guess you're getting spammed with the message because you're spamming calls to the connect method. You said that this is "a very simple service, indicating if a modem is ready to send data," but how does it work? Does it try to make a connection and indicate read-to-send when the connection status is good?

My immediate reaction was that there are bound to be more responses in your log file, but in looking at the catch section of the connect method, I see the following:

except TransportInitError as tie:
    rospyerr("Unable to initiate TCP/IP socket to %s:%s (%s): %s"%(dest_addr, dest_port, endpoint_id, traceback.format_exc()))
    raise
except Exception as e:
    #logerr("Unknown error initiating TCP/IP socket to %s:%s (%s): %s"%(dest_addr, dest_port, endpoint_id, str(e)))
    rospywarn("Unknown error initiating TCP/IP socket to %s:%s (%s): %s"%(dest_addr, dest_port, endpoint_id, traceback.format_exc()))

So while your write_header code is using logger.debug, your exceptions are being written to rospyerr and rospywarn. To view those, follow the steps for reading your log messages.

If there really aren't any other log messages, in the local logs or on the /rosout topic, then you should try to investigate further into how that code is getting called - again it looks like you're spamming the connect call.

Looking at your service, it looks like you've got some stuff you're not doing anything with. You're calling

readyToSend = self._micromodemDriver.readyToSend()
return readyToSend

and I can't tell what .readyToSend() is doing and then also you've got:

res = ReadyToSendResponse()
res.ready = readyToSend

and I can't tell what the res is for (you're not returning it) and I can't see what ReadyToSendResponse is doing AND I can't tell why you have two very similarly-named functions, readyToSend() and ReadyToSendResponse().

Check for other logs and /rosout and see if you're getting exceptions from the connect call, then try to dig down into your code and see if you're calling connect on a loop somewhere.


问:
Extract laser scan from a map and known location
If we have the map of an environment (an occupancy grid for instance) and precisely know the pose of the robot within it. How can one reconstruct what the laser scan should look like at a given location ?</p>

答:
You can do it manually with a protractor and straight edge - put the center of your protractor on the scanner center, align your protractor's zero-angle mark to the scanner zero, then mark off ticks at whatever your scanner resolution is.

Then you use the straight edge to connect the dots from the center, through each tick, until either you draw to an object or you reach the max range of the laser scanner.

In software, you can simulate this by "ray casting" from the scanner center along each scan angle.