leggedrobotics / ocs2

Optimal Control for Switched Systems
https://leggedrobotics.github.io/ocs2
BSD 3-Clause "New" or "Revised" License
816 stars 219 forks source link

Useless subscription to /legged_robot_mode_schedule #66

Open IoannisDadiotis opened 1 year ago

IoannisDadiotis commented 1 year ago

When running the legged_robot_ddp.launch example there are two similar topics which create a bit of confusion, the /legged_robot_mode_schedule and /legged_robot_mpc_mode_schedule.

The first one has only a single subscriber, the mpc node, and does not seem to be useful at all. This subscription is created in the code below: https://github.com/leggedrobotics/ocs2/blob/ebde452b10d0eceaac45364f7bb8f0ac1038b637/ocs2_ros_interfaces/src/synchronized_module/RosReferenceManager.cpp#L57

Is there any reason for the existence of this subscription? In my opinion it could be removed since the mpc has already all the necessary info regarding the mode schedule from the /legged_robot_mpc_mode_schedule topic through the GaitReceiver object.

elpimous commented 1 year ago

hey, any help ? can't use /legged_robot_mpc_mode_schedule topic correctly !

rostopic pub -1 /legged_robot_mpc_mode_schedule ocs2_msgs/mode_schedule "eventTimes:
- [0,0.5]
modeSequence:
- [15]"

No error at topic, correctly sent.

doesn't produce a stance mode on gazebo !

however, original command work ! :

Enter the desired gait, for the list of available gait enter "list": stance
Enter the desired gait, for the list of available gait enter "list": [GaitReceiver]: Setting new gait after time 245.471
Template switching times: {0, 0.5}
Template mode sequence:   {15}