Matthew-WangT / mobile_manipulator_mpc

这是我在硕士期间的一部分研究:基于(非线性)模型预测控制的移动机械臂(mobile manipulator)运动规划与控制。计划开源几个最简单的demo实现。
MIT License
36 stars 5 forks source link

Will each variable in parameter p receive external real-time updated data and be added to subsequent iterative calculations? #3

Open ww-dut opened 3 weeks ago

ww-dut commented 3 weeks ago

hello,the code i have seen many times,but there exists some questions.If you can help me solve this problem,i'll thanks you a lot. The problem is discribed below. Will each variable in parameter p receive external real-time updated data and be added to subsequent iterative calculations? I receive external data in real time to update p, but the external variables do not seem to change during the actual iteration.
p = ca.vertcat( state_now, # current state mpc.state_target, # target state arg_p_arm, car_desirestate, make_joint_dis, make_car_dis )

Matthew-WangT commented 2 weeks ago

Yes, each variable in parameter p receive external real-time updated data and be added to subsequent iterative calculations. In my original implementation, it was like this:

p = ca.vertcat(
            state_now,  # current state
            mpc.state_target,  # target state
            arg_p_arm
            )

In the mpc, p needs to be predefined with a length, like this:

self.P = ca.SX.sym('P', 2*self.n_states + 7 * (self.N + 1))

Only then can the reference values of the corresponding dimension be properly passed in. You may need to check whether you have correctly expanded the content of the p vector and updated it correctly throughout the program flow (such as building the cost).

ww-dut commented 2 weeks ago

Thank you for your reply. I have expanded self.P to subscribe to information sent by another node, but I feel that these information don't have any real application in the iterative process.Finally, I would like to ask if you have ever used soft or hard constraints to complete a specific task in the past. I would like to specify constraints through iterative information to complete the corresponding task.

Matthew-WangT commented 2 days ago

Indeed, I have experimented with a variety of constraints, both soft and hard. I believe that the efficacy of the reference can be readily assessed by incorporating essential diagnostic print statements.